Skip to content

Commit

Permalink
fix(scripts): prettify package.json when updating version numbers (#4552
Browse files Browse the repository at this point in the history
)
  • Loading branch information
trivikr authored Mar 20, 2023
1 parent 9afbb72 commit 4d47810
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/update-versions/updateVersions.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @ts-check
import { readFileSync, writeFileSync } from "fs";
import { join } from "path";
import { format } from "prettier";

import { getWorkspacePaths } from "../utils/getWorkspacePaths.mjs";
import { getUpdatedPackageJson } from "./getUpdatedPackageJson.mjs";
Expand All @@ -10,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, JSON.stringify(updatedPackageJson, null, 2).concat(`\n`));
writeFileSync(packageJsonPath, format(JSON.stringify(updatedPackageJson), { parser: "json" }));
});
};

0 comments on commit 4d47810

Please sign in to comment.