From 286739c0224bad88c4a38927bafd61973f71098c Mon Sep 17 00:00:00 2001 From: Reggi Date: Mon, 14 Oct 2024 13:47:38 -0400 Subject: [PATCH] chore: add creation of a DEPENDENCIES.json file (#7824) adds a DEPENDENCIES.json for programatic use --- .gitattributes | 1 + .gitignore | 1 + DEPENDENCIES.json | 99 ++++++++++++++++++++++++++++++++++++ scripts/dependency-graph.js | 4 ++ scripts/template-oss/root.js | 1 + 5 files changed, 106 insertions(+) create mode 100644 DEPENDENCIES.json diff --git a/.gitattributes b/.gitattributes index 5d3dbc3b3ac65..c70f4d0bcee0a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -16,6 +16,7 @@ /node_modules/.gitignore text eol=lf /workspaces/arborist/test/fixtures/.gitignore text eol=lf /DEPENDENCIES.md text eol=lf +/DEPENDENCIES.json text eol=lf /AUTHORS text eol=lf # fixture tarballs should be treated as binary diff --git a/.gitignore b/.gitignore index cf767636080ce..9d9d69178ed10 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ !/CODE_OF_CONDUCT.md !/configure !/CONTRIBUTING.md +!/DEPENDENCIES.json !/DEPENDENCIES.md !/docs/ !/index.js diff --git a/DEPENDENCIES.json b/DEPENDENCIES.json new file mode 100644 index 0000000000000..d2dbb4c78b2b7 --- /dev/null +++ b/DEPENDENCIES.json @@ -0,0 +1,99 @@ +[ + [ + "npm" + ], + [ + "@npmcli/smoke-tests", + "libnpmaccess", + "libnpmexec", + "libnpmpublish" + ], + [ + "@npmcli/mock-registry", + "libnpmdiff", + "libnpmfund", + "libnpmpack" + ], + [ + "@npmcli/arborist" + ], + [ + "@npmcli/metavuln-calculator" + ], + [ + "pacote", + "@npmcli/config", + "libnpmversion" + ], + [ + "@npmcli/run-script", + "@npmcli/map-workspaces", + "libnpmhook", + "libnpmorg", + "libnpmsearch", + "libnpmteam", + "init-package-json", + "npm-profile" + ], + [ + "@npmcli/package-json", + "npm-registry-fetch" + ], + [ + "@npmcli/git", + "make-fetch-happen" + ], + [ + "npm-pick-manifest", + "@npmcli/installed-package-contents", + "cacache", + "promzard" + ], + [ + "@npmcli/docs", + "npm-package-arg", + "npm-install-checks", + "npm-bundled", + "normalize-package-data", + "@npmcli/fs", + "unique-filename", + "npm-packlist", + "@npmcli/mock-globals", + "bin-links", + "nopt", + "parse-conflict-json", + "read-package-json-fast", + "read" + ], + [ + "@npmcli/eslint-config", + "@npmcli/template-oss", + "ignore-walk", + "semver", + "hosted-git-info", + "proc-log", + "validate-npm-package-name", + "@npmcli/promise-spawn", + "ini", + "npm-normalize-package-bin", + "json-parse-even-better-errors", + "@npmcli/node-gyp", + "fs-minipass", + "ssri", + "unique-slug", + "@npmcli/redact", + "@npmcli/agent", + "minipass-fetch", + "@npmcli/name-from-folder", + "@npmcli/query", + "cmd-shim", + "read-cmd-shim", + "write-file-atomic", + "abbrev", + "proggy", + "minify-registry-metadata", + "mute-stream", + "npm-audit-report", + "npm-user-validate" + ] +] diff --git a/scripts/dependency-graph.js b/scripts/dependency-graph.js index 4d80f5207d8c1..95c313f5838ed 100644 --- a/scripts/dependency-graph.js +++ b/scripts/dependency-graph.js @@ -114,6 +114,10 @@ const main = async function () { ` - ${hierarchyOurs.reverse().join(`${EOL} - `)}`, ] + fs.writeFile(join(CWD, 'DEPENDENCIES.json'), + JSON.stringify(hierarchyOurs.map(v => v.split(', ')), null, 2) + ) + return fs.writeFile(join(CWD, 'DEPENDENCIES.md'), out.join(EOL)) } diff --git a/scripts/template-oss/root.js b/scripts/template-oss/root.js index fb2d964a3f993..58a8c66e077e8 100644 --- a/scripts/template-oss/root.js +++ b/scripts/template-oss/root.js @@ -60,6 +60,7 @@ module.exports = { '/node_modules/', '/index.js', '/DEPENDENCIES.md', + '/DEPENDENCIES.json', '/CONTRIBUTING.md', '/configure', '/AUTHORS',