From 69f53ce50b23c5ca4cef08eda6e69fddb39e223a Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Tue, 21 Mar 2023 08:02:38 -0700 Subject: [PATCH] fix(scripts): use json-stringify as parser for package.json (#4559) --- scripts/generate-clients/copy-to-clients.js | 4 ++-- scripts/update-versions/updateVersions.mjs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/generate-clients/copy-to-clients.js b/scripts/generate-clients/copy-to-clients.js index e2f8907e887f..4e0c2c6e6f01 100644 --- a/scripts/generate-clients/copy-to-clients.js +++ b/scripts/generate-clients/copy-to-clients.js @@ -154,7 +154,7 @@ const copyToClients = async (sourceDir, destinationDir, solo) => { ] = `node ../../scripts/generate-clients/single-service --solo ${serviceName}`; } - writeFileSync(destSubPath, prettier.format(JSON.stringify(mergedManifest), { parser: "json" })); + writeFileSync(destSubPath, prettier.format(JSON.stringify(mergedManifest), { parser: "json-stringify" })); } else if (packageSub === "typedoc.json") { const typedocJson = { extends: ["../../typedoc.client.json"], @@ -216,7 +216,7 @@ const copyServerTests = async (sourceDir, destinationDir) => { // don't generate documentation for private packages delete mergedManifest.scripts["build:docs"]; } - writeFileSync(destSubPath, prettier.format(JSON.stringify(mergedManifest), { parser: "json" })); + writeFileSync(destSubPath, prettier.format(JSON.stringify(mergedManifest), { parser: "json-stringify" })); } else if (overWritableSubs.includes(packageSub) || !existsSync(destSubPath)) { if (lstatSync(packageSubPath).isDirectory()) removeSync(destSubPath); copySync(packageSubPath, destSubPath, { diff --git a/scripts/update-versions/updateVersions.mjs b/scripts/update-versions/updateVersions.mjs index 2d3fd580f685..c551c7437a01 100644 --- a/scripts/update-versions/updateVersions.mjs +++ b/scripts/update-versions/updateVersions.mjs @@ -11,6 +11,6 @@ export const updateVersions = (depToVersionHash) => { const packageJsonPath = join(workspacePath, "package.json"); const packageJson = JSON.parse(readFileSync(packageJsonPath).toString()); const updatedPackageJson = getUpdatedPackageJson(packageJson, depToVersionHash); - writeFileSync(packageJsonPath, format(JSON.stringify(updatedPackageJson), { parser: "json" })); + writeFileSync(packageJsonPath, format(JSON.stringify(updatedPackageJson), { parser: "json-stringify" })); }); };