{"id":16347752,"url":"https://github.com/privatenumber/deps","last_synced_at":"2025-03-16T15:31:11.991Z","repository":{"id":53127037,"uuid":"263224497","full_name":"privatenumber/deps","owner":"privatenumber","description":"📦🔍 Analyze which package.json dependencies are in-use with V8 Coverage 🔥","archived":false,"fork":false,"pushed_at":"2021-04-05T17:06:22.000Z","size":357,"stargazers_count":34,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-19T01:10:53.715Z","etag":null,"topics":["coverage","dependencies","nodejs","v8"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/privatenumber.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-12T03:38:52.000Z","updated_at":"2024-01-04T02:33:00.000Z","dependencies_parsed_at":"2022-09-03T23:51:57.161Z","dependency_job_id":null,"html_url":"https://github.com/privatenumber/deps","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Fdeps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Fdeps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Fdeps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Fdeps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/privatenumber","download_url":"https://codeload.github.com/privatenumber/deps/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221665277,"owners_count":16860213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coverage","dependencies","nodejs","v8"],"created_at":"2024-10-11T00:45:41.928Z","updated_at":"2024-10-27T10:49:43.192Z","avatar_url":"https://github.com/privatenumber.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📦🔍 deps \u003ca href=\"https://npm.im/deps\"\u003e\u003cimg src=\"https://badgen.net/npm/v/deps\"\u003e\u003c/a\u003e \u003ca href=\"https://npm.im/deps\"\u003e\u003cimg src=\"https://badgen.net/npm/dm/deps\"\u003e\u003c/a\u003e \u003ca href=\"https://packagephobia.now.sh/result?p=deps\"\u003e\u003cimg src=\"https://packagephobia.now.sh/badge?p=deps\"\u003e\u003c/a\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/privatenumber/deps/raw/master/.github/screenshot.png\" width=\"70%\"\u003e\n  \u003cbr\u003e\n  Analyze which \u003ccode\u003epackage.json\u003c/code\u003e dependencies are in-use with V8 Coverage 🔥\n\u003c/p\u003e\n\n## 🙋 Why?\n- 🧹 **Tidy `package.json`** Find out which dependencies are used/unused\n- 🔥 **V8 Coverage** Uses [Node's Coverage feature](https://nodejs.org/api/cli.html#cli_node_v8_coverage_dir) to accurately identify which modules are loaded\n- 💅 **Pretty output** View the results in a readable table. Save the output in JSON to view later\n- 🚀 **Ready-to-go** Designed to be easy to use with `npx`—No installation required!\n\n#### 👉 Try it out!\n```sh\n$ npx deps [...Node command]\n```\n_eg._ `npx deps npm run build`\n\n## :rocket: Install\nInstall globally if you don't want to use it via [npx](https://blog.npmjs.org/post/162869356040/introducing-npx-an-npm-package-runner).\n```sh\nnpm i -g deps\n```\n\n## Usage\n### 🔬 Quick analysis\nPrefix your Node command with `deps` and it will analyze and output the dependencies it used\n```sh\n$ deps ...\n```\neg. `deps npm run build`\n\n### 👩‍🔬 Analyzing dependency usage across commands\n_Prerequisite: install `deps` globally_\n1. Start recording dependecy usage (note the [dot-space](https://superuser.com/questions/1136409/what-is-the-dot-space-filename-command-doing-in-bash) at the beginning)\n  ```sh\n  $ . deps-start\n  ```\n\n2. Run a series of Node scripts eg.\n  - `npm run dev`\n  - `npm run build`\n  - `npm run lint`\n  - etc.\n\n3. Analyze used dependencies\n  ```sh\n  $ deps analyze\n  ```\n  - Save data to file:\n    ```sh\n    deps analyze -o output.json\n    ```\n  - Read later with:\n    ```sh\n    deps -f output.json\n    ```\n\n4. When you're done, stop recording\n  ```sh\n  $ . deps-stop\n  ```\n\n## 💁‍♂️ FAQ\n\n#### How does `deps` work?\n`deps` detects which modules are loaded by using [V8's code coverage](https://nodejs.org/api/cli.html#cli_node_v8_coverage_dir) 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.\n\n#### How does `deps` compare to `depcheck`?\n[`depcheck`](https://github.com/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\"](https://github.com/depcheck/depcheck#special) for supporting whether a module was loaded via dev-tools.\n\n## 💼 License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprivatenumber%2Fdeps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprivatenumber%2Fdeps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprivatenumber%2Fdeps/lists"}