Skip to content

Commit

Permalink
fix(build): sort build.json content (#11124)
Browse files Browse the repository at this point in the history
* chore(build): type BuildMetadata

* fix(build): sort build.json content
  • Loading branch information
caugner authored May 15, 2024
1 parent 710685e commit 77ec929
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion build/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,17 @@ interface GlobalMetadata {
}

interface BuildMetadata {
[locale: string]: any;
[locale: string]: {
baseline?: {
total: number;
high: number;
highPaths: string[];
low: number;
lowPaths: string[];
not: number;
notPaths: string[];
};
};
}

async function buildDocumentInteractive(
Expand Down Expand Up @@ -376,6 +386,13 @@ async function buildDocuments(
);

for (const [locale, meta] of Object.entries(buildMetadata)) {
if (meta.baseline) {
// Sort to avoid build difference.
meta.baseline.highPaths.sort();
meta.baseline.lowPaths.sort();
meta.baseline.notPaths.sort();
}

// have to write per-locale because we build each locale concurrently
fs.writeFileSync(
path.join(BUILD_OUT_ROOT, locale.toLowerCase(), "build.json"),
Expand Down

0 comments on commit 77ec929

Please sign in to comment.