Skip to content

Commit 4d47810

Browse files
authored
fix(scripts): prettify package.json when updating version numbers (#4552)
1 parent 9afbb72 commit 4d47810

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/update-versions/updateVersions.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @ts-check
22
import { readFileSync, writeFileSync } from "fs";
33
import { join } from "path";
4+
import { format } from "prettier";
45

56
import { getWorkspacePaths } from "../utils/getWorkspacePaths.mjs";
67
import { getUpdatedPackageJson } from "./getUpdatedPackageJson.mjs";
@@ -10,6 +11,6 @@ export const updateVersions = (depToVersionHash) => {
1011
const packageJsonPath = join(workspacePath, "package.json");
1112
const packageJson = JSON.parse(readFileSync(packageJsonPath).toString());
1213
const updatedPackageJson = getUpdatedPackageJson(packageJson, depToVersionHash);
13-
writeFileSync(packageJsonPath, JSON.stringify(updatedPackageJson, null, 2).concat(`\n`));
14+
writeFileSync(packageJsonPath, format(JSON.stringify(updatedPackageJson), { parser: "json" }));
1415
});
1516
};

0 commit comments

Comments
 (0)