{"id":13495603,"url":"https://github.com/upgradejs/depngn","last_synced_at":"2025-03-28T16:33:04.043Z","repository":{"id":60519961,"uuid":"542731321","full_name":"upgradejs/depngn","owner":"upgradejs","description":"A CLI tool to find out if your dependencies support a given version of node.","archived":false,"fork":false,"pushed_at":"2023-07-28T14:00:11.000Z","size":459,"stargazers_count":104,"open_issues_count":6,"forks_count":3,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-03-01T03:36:55.867Z","etag":null,"topics":["cli","dependencies","nodejs","typescript"],"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/upgradejs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-09-28T18:16:50.000Z","updated_at":"2025-02-10T10:52:58.000Z","dependencies_parsed_at":"2023-02-19T11:00:41.621Z","dependency_job_id":null,"html_url":"https://github.com/upgradejs/depngn","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upgradejs%2Fdepngn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upgradejs%2Fdepngn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upgradejs%2Fdepngn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upgradejs%2Fdepngn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/upgradejs","download_url":"https://codeload.github.com/upgradejs/depngn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246063141,"owners_count":20717750,"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":["cli","dependencies","nodejs","typescript"],"created_at":"2024-07-31T19:01:36.331Z","updated_at":"2025-03-28T16:33:03.655Z","avatar_url":"https://github.com/upgradejs.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# depngn (short for dependency engine)\n\nA CLI tool to find out if your dependencies support a given version of `node`.\nIt fetches the `engines` field of your dependencies' `package.json` file and,\nif it's present, determines whether or not the version of `node` satisfies the\nrange of supported versions.\n\n## CLI\n\n### Usage\n\n```bash\nnpx depngn \u003cnode-version\u003e [options]\n\n# examples\nnpx depngn 10.0.0\n\nnpx depngn 14.17.6 --reporter=json\n```\n\n### Node Version\n\n`depngn` will accept any single value version of `node` as an argument (ie, not a range). If no version is given, it will attempt to determine your current `node` version and use that.\n\n### Options\n\n`depngn` supports these options:\n\n- `--help`\n- `--cwd`\n- `--reporter`\n- `--reportDir`\n- `--reportFileName`\n\n#### `--cwd`\n\nSpecify the path where you want the check to be performed \n\n#### `--reporter`\n\nThese are the valid values for `--reporter`:\n\n- `terminal` (**default**): It will output a table to the terminal.\n- `html`: It will generate an HTML file named `compat.html` to the directory the\ncommand is executed in.\n- `json`: It will write a file named `compat.json` to the directory the command\nis executed in. It uses the following format:\n\n```javascript\n[package_name]: {\n  compatible: boolean // whether or not this package will work with the given Node version\n  range: string // the range of supported Node versions\n}\n```\n\n#### `--reportDir`\nThis allows you to specify the path where you want the report to be generated. If no path is specified, it will default to the current working directory.\n\n#### `--reportFileName`\nThis allows you to specify the name of the report file. If no name is specified, it will default to `compat`.\n\n### A Note on The Engines Field\n\nThe `engines` field in `package.json` is optional and many libraries don't include it. If that's the case, the output for that package will be:\n\n```javascript\n{\n  compatible: undefined,\n  range: 'n/a'\n}\n```\n\n## Standalone Package\n\nYou can also import `depngn` as a standalone function to use in your own CLI\ntools. It takes an object as an argument:\n\n```typescript\ninterface Options {\n  version: string;\n  cwd: string | undefined;\n}\n```\n\nAnd it returns a promise that resolves to:\n\n```typescript\ntype DepngnReturn = Record\u003cstring, CompatData\u003e;\n\ninterface CompatData {\n  compatible: boolean | 'invalid' | undefined;\n  range: string;\n}\n```\n\n### Usage\n\n```javascript\nimport { depngn } from 'depngn';\n\nconst generateReport = async () =\u003e {\n  return await depngn({ version: '10.0.0' });\n};\n```\n\nThere's also a chance there *is* an `engines` field specified in the package, but the range is invalid in some way. Since RegEx for SemVer can be tricky, we return the following, if that's the case:\n\n```javascript\n{\n  compatible: 'invalid',\n  range: '1 .2 . 0not-a-valid-range'\n}\n```\n\n## Report module\n\nYou can import `report` (the function that generates a report file when using CLI) as a standalone function to use in your tools to create reports exactly when you need them. It takes two arguments - the first is a result of the `depngn` function, and the second is an object with options:\n\n```typescript\ninterface CliOptions {\n  version: string;\n  cwd: string | undefined;\n  reporter: 'terminal' | 'html' | 'json' | undefined;\n  reportDir: string | undefined;\n  reportFileName: string | undefined;\n}\n```\n\nIt returns a promise that resolves as a report file of the given type (`html`, `json`) or prints the result to the console if the report is not provided or is `terminal`.\n\n### Usage\n\n```javascript\nimport { report } from 'depngn/report';\n\nconst createReport = async () =\u003e {\n  const desiredVersion = '10.0.0';\n  const result = await depngn({ version: desiredVersion });\n  await report(result, { version: desiredVersion, reportDir: './dependencies-reports', reportFileName: 'depngn' });\n};\n```\n\n## Supported Package Managers\n\nFor now, this package supports `npm` and `yarn`. If you want support for\nyour favorite package manager, feel free to open a PR!\n\n## Development\n\nIn order to start contributing to `depngn`, you can follow these steps: [CONTRIBUTING.md](CONTRIBUTING.md)\n\n## CHANGELOG\n\nIf you want to see what changed between versions: [CHANGELOG.md](CHANGELOG.md)\n\n## Possible future features\n- Support the ability to sort and/or filter output\n- Ignore irrelevant dependencies (ie, `@types/\u003cpackage\u003e`)\n- Support all `node` versions (pretty sure this should work going back to `node` version `10`, but if we wrote our own versions of some dependencies, we could support further back. the main offender is `table` (`\u003e=10.0.0`), but a lot of modern cli table packages seem to only support `node` `10` or `12` and above).\n- Support attempting to determine support for dependencies that don't include `engines` field (not sure if it's worth it, since we'd have to fetch the `engines` of the dependency's dependencies and make an educated guess on what the supported version range is)\n- Support `pnpm`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupgradejs%2Fdepngn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fupgradejs%2Fdepngn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupgradejs%2Fdepngn/lists"}