Skip to content

Commit dedd706

Browse files
committed
refactor: replace individual prettier and buildifier calls with pnpm ng-dev format for version file updates
This ensures the correct formatting of files.
1 parent a986fa6 commit dedd706

1 file changed

Lines changed: 11 additions & 19 deletions

File tree

  • bazel/rules/rules_browsers/browsers/private/update-tool

bazel/rules/rules_browsers/browsers/private/update-tool/index.mts

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -113,25 +113,17 @@ async function downloadMilestonesAndWriteVersionsFiles({
113113
generateVersionsBzlFile(getReadableBrowserName(browser), defaultVersion, versions),
114114
);
115115

116-
// Format the resulting `.json` file. Prettier may apply some formatting that
117-
// isn't consistent with default stringification (e.g. line length).
118-
exec(`npx prettier --write ${jsonFilePath}`, (err, stdout, stderr) => {
119-
if (err) {
120-
console.log(stdout);
121-
console.log(stderr);
122-
console.warn(`Formatting of ${jsonFilePath} failed: ${err.message}`);
123-
}
124-
});
125-
126-
// Format the resulting `.bzl` file. JSON is valid here, but it's not
127-
// formatted quite right (e.g. no trailing comma).
128-
exec(`buildifier ${bzlFilePath}`, (err, stdout, stderr) => {
129-
if (err) {
130-
console.log(stdout);
131-
console.log(stderr);
132-
console.warn(`Formatting of ${bzlFilePath} failed: ${err.message}`);
133-
}
134-
});
116+
exec(
117+
`pnpm ng-dev format files ${bzlFilePath} ${jsonFilePath}`,
118+
{cwd: workspaceRoot},
119+
(err, stdout, stderr) => {
120+
if (err) {
121+
console.log(stdout);
122+
console.log(stderr);
123+
console.warn(`Formatting of ${bzlFilePath} and ${jsonFilePath} failed: ${err.message}`);
124+
}
125+
},
126+
);
135127
}
136128

137129
async function main() {

0 commit comments

Comments
 (0)