1.0.22 • Published 2 months ago

extract-dependencies-from-sources v1.0.22

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

extract-dependencies-from-sources

Open in Visual Studio Code npm bundle size Github workflow Quality Gate Status Maintainability Rating Security Rating Reliability Rating Coverage Lines of Code Technical Debt Code Smells Bugs Vulnerabilities Duplicated Lines (%) Last commit

Inferring dependencies from the source code of a monorepo app

⚡ Quickstart

🔶 Install

yarn add -D extract-dependencies-from-sources
pnpm i -D extract-dependencies-from-sources

🔶 Usage

extractDeps --packagejson ./package.json --path codebasePath

Options:
  --help          Show help                                            [boolean]
  --version       Show version number                                  [boolean]
  --packagejson   Root package.json path  [required] [default: "./package.json"]
  --path          Codebase path                                       [required]
  --externaldeps  Path to external dependencies file (optional)

Examples:
  extractDeps --packagejson ./package.json --path ./apps/back --path
  ./libs/back

Inferring dependencies from the source code of a monorepo app

For 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.

yarn extractDeps --path apps/back --path libs/back/database

You can also use the function directly in your code:

import { getCodebasesDependencies } from 'extract-dependencies-from-sources';
import { readJson } from 'fs-extra';

(async () => {
  const data = await readJson('./package.json');
  const deps = await getCodebasesDependencies(data.dependencies, [
    'apps/front/auth',
    'lib/front/components',
  ]);
})();

🧿 Including external dependencies

You can also specify external dependencies to include in the output by providing a path to a yaml file containing a map of dependencies:

external-deps.yml

externaldeps:
  - msw: ^1.1.0
  - eslint: ~8.36.0

You can then use the --externaldeps option to include them:

yarn extractDeps --path apps/front --externaldeps ./external-deps.yml
1.0.22

2 months ago

1.0.21

3 months ago

1.0.19

3 months ago

1.0.18

3 months ago

1.0.17

3 months ago

1.0.20

3 months ago

1.0.15

5 months ago

1.0.14

7 months ago

1.0.13

8 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.11

10 months ago

1.0.10

10 months ago

1.0.12

10 months ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago