{"id":19972579,"url":"https://github.com/jpb06/extract-dependencies-from-sources","last_synced_at":"2025-05-04T01:30:50.939Z","repository":{"id":153447809,"uuid":"628922804","full_name":"jpb06/extract-dependencies-from-sources","owner":"jpb06","description":"Extracts external dependencies used in a typescript codebase","archived":false,"fork":false,"pushed_at":"2025-04-30T13:02:10.000Z","size":541,"stargazers_count":4,"open_issues_count":6,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-30T14:28:30.019Z","etag":null,"topics":["code-analysis","dependencies-collector","effect-ts"],"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/jpb06.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-04-17T09:01:02.000Z","updated_at":"2025-04-20T14:20:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"5865fcf0-7f0c-4e31-b20b-d22c9479ae9c","html_url":"https://github.com/jpb06/extract-dependencies-from-sources","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpb06%2Fextract-dependencies-from-sources","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpb06%2Fextract-dependencies-from-sources/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpb06%2Fextract-dependencies-from-sources/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpb06%2Fextract-dependencies-from-sources/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpb06","download_url":"https://codeload.github.com/jpb06/extract-dependencies-from-sources/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251721194,"owners_count":21632782,"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":["code-analysis","dependencies-collector","effect-ts"],"created_at":"2024-11-13T03:08:36.499Z","updated_at":"2025-05-04T01:30:50.417Z","avatar_url":"https://github.com/jpb06.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# extract-dependencies-from-sources\n\n[![Open in Visual Studio Code](https://img.shields.io/static/v1?logo=visualstudiocode\u0026label=\u0026message=Open%20in%20Visual%20Studio%20Code\u0026labelColor=2c2c32\u0026color=007acc\u0026logoColor=007acc)](https://github.dev/jpb06/extract-dependencies-from-sources)\n![npm bundle size](https://img.shields.io/bundlephobia/min/extract-dependencies-from-sources)\n![Github workflow](https://img.shields.io/github/actions/workflow/status/jpb06/extract-dependencies-from-sources/tests-scan.yml?branch=main\u0026logo=github-actions\u0026label=last%20workflow)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=jpb06_extract-dependencies-from-sources\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=jpb06_extract-dependencies-from-sources)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=jpb06_extract-dependencies-from-sources\u0026metric=sqale_rating)](https://sonarcloud.io/dashboard?id=jpb06_extract-dependencies-from-sources)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=jpb06_extract-dependencies-from-sources\u0026metric=security_rating)](https://sonarcloud.io/dashboard?id=jpb06_extract-dependencies-from-sources)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=jpb06_extract-dependencies-from-sources\u0026metric=reliability_rating)](https://sonarcloud.io/dashboard?id=jpb06_extract-dependencies-from-sources)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=jpb06_extract-dependencies-from-sources\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=jpb06_extract-dependencies-from-sources)\n[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=jpb06_extract-dependencies-from-sources\u0026metric=ncloc)](https://sonarcloud.io/summary/new_code?id=jpb06_extract-dependencies-from-sources)\n[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=jpb06_extract-dependencies-from-sources\u0026metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=jpb06_extract-dependencies-from-sources)\n[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=jpb06_extract-dependencies-from-sources\u0026metric=code_smells)](https://sonarcloud.io/dashboard?id=jpb06_extract-dependencies-from-sources)\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=jpb06_extract-dependencies-from-sources\u0026metric=bugs)](https://sonarcloud.io/summary/new_code?id=jpb06_extract-dependencies-from-sources)\n[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=jpb06_extract-dependencies-from-sources\u0026metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=jpb06_extract-dependencies-from-sources)\n[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=jpb06_extract-dependencies-from-sources\u0026metric=duplicated_lines_density)](https://sonarcloud.io/dashboard?id=jpb06_extract-dependencies-from-sources)\n![Last commit](https://img.shields.io/github/last-commit/jpb06/extract-dependencies-from-sources?logo=git)\n\nInferring dependencies from the source code of a monorepo app\n\n\u003c!-- readme-package-icons start --\u003e\n\n\u003cp align=\"left\"\u003e\u003ca href=\"https://docs.github.com/en/actions\" target=\"_blank\"\u003e\u003cimg height=\"50\" src=\"https://raw.githubusercontent.com/jpb06/jpb06/master/icons/GithubActions-Dark.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://www.typescriptlang.org/docs/\" target=\"_blank\"\u003e\u003cimg height=\"50\" src=\"https://raw.githubusercontent.com/jpb06/jpb06/master/icons/TypeScript.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://nodejs.org/en/docs/\" target=\"_blank\"\u003e\u003cimg height=\"50\" src=\"https://raw.githubusercontent.com/jpb06/jpb06/master/icons/NodeJS-Dark.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://bun.sh/docs\" target=\"_blank\"\u003e\u003cimg height=\"50\" src=\"https://raw.githubusercontent.com/jpb06/jpb06/master/icons/Bun-Dark.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://biomejs.dev/guides/getting-started/\" target=\"_blank\"\u003e\u003cimg height=\"50\" src=\"https://raw.githubusercontent.com/jpb06/jpb06/master/icons/Biome-Dark.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://github.com/conventional-changelog\" target=\"_blank\"\u003e\u003cimg height=\"50\" src=\"https://raw.githubusercontent.com/jpb06/jpb06/master/icons/CommitLint.Dark.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://github.com/motdotla/dotenv#readme\" target=\"_blank\"\u003e\u003cimg height=\"50\" src=\"https://raw.githubusercontent.com/jpb06/jpb06/master/icons/Dotenv-Dark.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://vitest.dev/guide/\" target=\"_blank\"\u003e\u003cimg height=\"50\" src=\"https://raw.githubusercontent.com/jpb06/jpb06/master/icons/Vitest-Dark.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://www.effect.website/docs/quickstart\" target=\"_blank\"\u003e\u003cimg height=\"50\" src=\"https://raw.githubusercontent.com/jpb06/jpb06/master/icons/Effect-Dark.svg\" /\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003c!-- readme-package-icons end --\u003e\n\n## ⚡ Quickstart\n\n### 🔶 Install\n\n```bash\nyarn add -D extract-dependencies-from-sources\n```\n\n```bash\npnpm i -D extract-dependencies-from-sources\n```\n\n### 🔶 Usage\n\n#### 🧿 cjs\n\n```bash\nextractDeps --packagejson ./package.json --path codebasePath\n\nOptions:\n  --help          Show help                                            [boolean]\n  --version       Show version number                                  [boolean]\n  --packagejson   Root package.json path  [required] [default: \"./package.json\"]\n  --path          Codebase path                                       [required]\n  --externaldeps  Path to external dependencies file (optional)\n\nExamples:\n  extractDeps --packagejson ./package.json --path ./apps/back --path\n  ./libs/back\n\nInferring dependencies from the source code of a monorepo app\n```\n\nFor example, running the following command will replace the `dependencies` property of the root `package.json` with the dependencies found in the codebases located in `apps/back` and `libs/back/database`.\n\n```bash\nyarn extractDeps --path apps/back --path libs/back/database\n```\n\n#### 🧿 esm\n\n```bash\nextractDepsEsm --packagejson ./package.json --path codebasePath\n\nOptions:\n  --help          Show help                                            [boolean]\n  --version       Show version number                                  [boolean]\n  --packagejson   Root package.json path  [required] [default: \"./package.json\"]\n  --path          Codebase path                                       [required]\n  --externaldeps  Path to external dependencies file (optional)\n\nExamples:\n  extractDeps --packagejson ./package.json --path ./apps/back --path\n  ./libs/back\n\nInferring dependencies from the source code of a monorepo app\n```\n\n#### 🧿 node\n\nYou can also use the function directly in your code:\n\n```ts\nimport { getCodebasesDependencies } from 'extract-dependencies-from-sources';\nimport { readJson } from 'fs-extra';\n\nconst data = await readJson('./package.json');\nconst deps = await getCodebasesDependencies(data.dependencies, [\n  'apps/front/auth',\n  'lib/front/components',\n]);\n```\n\n### 🔶 Including external dependencies\n\nYou can also specify external dependencies to include in the output by providing a path to a yaml file containing a map of dependencies:\n\n\u003e external-deps.yml\n\n```yaml\nexternaldeps:\n  - msw: ^1.1.0\n  - eslint: ~8.36.0\n```\n\nYou can then use the `--externaldeps` option to include them:\n\n```bash\nyarn extractDeps --path apps/front --externaldeps ./external-deps.yml\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpb06%2Fextract-dependencies-from-sources","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpb06%2Fextract-dependencies-from-sources","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpb06%2Fextract-dependencies-from-sources/lists"}