diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index fd7561a2a96f0..ac30ca2d466dd 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -190,9 +190,9 @@ graph LR; npmcli-config-->npmcli-eslint-config["@npmcli/eslint-config"]; npmcli-config-->npmcli-map-workspaces["@npmcli/map-workspaces"]; npmcli-config-->npmcli-mock-globals["@npmcli/mock-globals"]; + npmcli-config-->npmcli-package-json["@npmcli/package-json"]; npmcli-config-->npmcli-template-oss["@npmcli/template-oss"]; npmcli-config-->proc-log; - npmcli-config-->read-package-json-fast; npmcli-config-->semver; npmcli-docs-->ignore-walk; npmcli-docs-->npmcli-eslint-config["@npmcli/eslint-config"]; @@ -622,9 +622,9 @@ graph LR; npmcli-config-->npmcli-eslint-config["@npmcli/eslint-config"]; npmcli-config-->npmcli-map-workspaces["@npmcli/map-workspaces"]; npmcli-config-->npmcli-mock-globals["@npmcli/mock-globals"]; + npmcli-config-->npmcli-package-json["@npmcli/package-json"]; npmcli-config-->npmcli-template-oss["@npmcli/template-oss"]; npmcli-config-->proc-log; - npmcli-config-->read-package-json-fast; npmcli-config-->semver; npmcli-config-->tap; npmcli-config-->walk-up-path; @@ -797,9 +797,9 @@ packages higher up the chain. - @npmcli/arborist - @npmcli/metavuln-calculator - pacote, libnpmversion - - @npmcli/run-script, libnpmhook, libnpmorg, libnpmsearch, libnpmteam, init-package-json, npm-profile + - @npmcli/run-script, @npmcli/config, libnpmhook, libnpmorg, libnpmsearch, libnpmteam, init-package-json, npm-profile - @npmcli/package-json, npm-registry-fetch - - @npmcli/git, make-fetch-happen, @npmcli/config + - @npmcli/git, make-fetch-happen - @npmcli/installed-package-contents, @npmcli/map-workspaces, cacache, npm-pick-manifest, promzard - @npmcli/docs, @npmcli/fs, npm-bundled, read-package-json-fast, unique-filename, npm-install-checks, npm-package-arg, normalize-package-data, npm-packlist, bin-links, nopt, parse-conflict-json, @npmcli/mock-globals, read - @npmcli/eslint-config, @npmcli/template-oss, ignore-walk, semver, npm-normalize-package-bin, @npmcli/name-from-folder, json-parse-even-better-errors, fs-minipass, ssri, unique-slug, @npmcli/promise-spawn, hosted-git-info, proc-log, validate-npm-package-name, @npmcli/node-gyp, @npmcli/redact, @npmcli/agent, minipass-fetch, @npmcli/query, cmd-shim, read-cmd-shim, write-file-atomic, abbrev, proggy, minify-registry-metadata, ini, mute-stream, npm-audit-report, npm-user-validate diff --git a/package-lock.json b/package-lock.json index 40b49770f076e..42f12893d9b73 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15874,11 +15874,11 @@ "license": "ISC", "dependencies": { "@npmcli/map-workspaces": "^3.0.2", + "@npmcli/package-json": "^5.1.1", "ci-info": "^4.0.0", "ini": "^4.1.2", "nopt": "^7.2.1", "proc-log": "^4.2.0", - "read-package-json-fast": "^3.0.2", "semver": "^7.3.5", "walk-up-path": "^3.0.1" }, diff --git a/workspaces/config/lib/index.js b/workspaces/config/lib/index.js index e786828589aaf..4aa76d8e2d9a2 100644 --- a/workspaces/config/lib/index.js +++ b/workspaces/config/lib/index.js @@ -669,12 +669,12 @@ class Config { } if (this.localPrefix && hasPackageJson) { - const rpj = require('read-package-json-fast') + const pkgJson = require('@npmcli/package-json') // if we already set localPrefix but this dir has a package.json // then we need to see if `p` is a workspace root by reading its package.json // however, if reading it fails then we should just move on - const pkg = await rpj(resolve(p, 'package.json')).catch(() => false) - if (!pkg) { + const { content: pkg } = await pkgJson.normalize(p).catch(() => ({ content: {} })) + if (!pkg?.workspaces) { continue } diff --git a/workspaces/config/package.json b/workspaces/config/package.json index 7c4e56b3efcbf..294f160e23a3a 100644 --- a/workspaces/config/package.json +++ b/workspaces/config/package.json @@ -37,11 +37,11 @@ }, "dependencies": { "@npmcli/map-workspaces": "^3.0.2", + "@npmcli/package-json": "^5.1.1", "ci-info": "^4.0.0", "ini": "^4.1.2", "nopt": "^7.2.1", "proc-log": "^4.2.0", - "read-package-json-fast": "^3.0.2", "semver": "^7.3.5", "walk-up-path": "^3.0.1" },