GithubHelp home page GithubHelp logo

00mjk / deps Goto Github PK

View Code? Open in Web Editor NEW

This project forked from privatenumber/deps

0.0 0.0 0.0 357 KB

๐Ÿ“ฆ๐Ÿ” Analyze which package.json dependencies are in-use with V8 Coverage ๐Ÿ”ฅ

License: MIT License

JavaScript 1.01% Shell 3.63% TypeScript 95.36%

deps's Introduction

๐Ÿ“ฆ๐Ÿ” deps


Analyze which package.json dependencies are in-use with V8 Coverage ๐Ÿ”ฅ

๐Ÿ™‹ Why?

  • ๐Ÿงน Tidy package.json Find out which dependencies are used/unused
  • ๐Ÿ”ฅ V8 Coverage Uses Node's Coverage feature to accurately identify which modules are loaded
  • ๐Ÿ’… Pretty output View the results in a readable table. Save the output in JSON to view later
  • ๐Ÿš€ Ready-to-go Designed to be easy to use with npxโ€”No installation required!

๐Ÿ‘‰ Try it out!

$ npx deps [...Node command]

eg. npx deps npm run build

๐Ÿš€ Install

Install globally if you don't want to use it via npx.

npm i -g deps

Usage

๐Ÿ”ฌ Quick analysis

Prefix your Node command with deps and it will analyze and output the dependencies it used

$ deps ...

eg. deps npm run build

๐Ÿ‘ฉโ€๐Ÿ”ฌ Analyzing dependency usage across commands

Prerequisite: install deps globally

  1. Start recording dependecy usage (note the dot-space at the beginning)
$ . deps-start
  1. Run a series of Node scripts eg.
  • npm run dev
  • npm run build
  • npm run lint
  • etc.
  1. Analyze used dependencies
$ deps analyze
  • Save data to file:
    deps analyze -o output.json
  • Read later with:
    deps -f output.json
  1. When you're done, stop recording
$ . deps-stop

๐Ÿ’โ€โ™‚๏ธ FAQ

How does deps work?

deps detects which modules are loaded by using V8's code coverage feature, so it's very accurate. However, it doesn't detect file-system reads, as they are simply read as text rather than actually being parsed and executed. That means it can't detect what files are statically analyzed by bundlers (eg. Webpack, Rollup, etc.). I am considering supporting FS reads in the future.

How does deps compare to depcheck?

depcheck statically analyzes your project to see which dependencies are imported, avoiding the need to execute code. In contrast, deps executes code to analyze which dependencies were loaded during run-time. They work in completely different ways, but a major drawback for me is that depcheck requires a "special" for supporting whether a module was loaded via dev-tools.

๐Ÿ’ผ License

MIT

deps's People

Contributors

privatenumber avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.