From d185c9bdcab7dd2a8a485cd167b9a7c5c1f43ad0 Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 30 May 2024 07:11:00 -0700 Subject: [PATCH] fix: use @npmcli/package-json to parse local package --- workspaces/config/lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workspaces/config/lib/index.js b/workspaces/config/lib/index.js index e786828589aaf..8d2749f27452a 100644 --- a/workspaces/config/lib/index.js +++ b/workspaces/config/lib/index.js @@ -669,11 +669,11 @@ 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) + const { content: pkg } = await pkgJson.normalize(p).catch(() => ({ content: {} })) if (!pkg) { continue }