Skip to content

Commit 393a3c9

Browse files
committed
build: dedupe targets in api golden script
In the past we had one API golden target per component, but now the target is per package. This means that if we run something like `approve-goldens material/button material/dialog material/datepicker`, we'll run the same command three times. These changes dedupe the set of targets.
1 parent 1cef533 commit 393a3c9

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

scripts/approve-api-golden.mts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import sh from 'shelljs';
66
import {guessPackageName} from './util.mjs';
77

88
const bazel = process.env['BAZEL'] || 'pnpm -s bazel';
9+
const targetsToRun = new Set<string>();
910

1011
if (process.argv.length < 3) {
1112
console.error(chalk.red('No package name has been passed in for API golden approval.'));
@@ -29,7 +30,9 @@ for (const searchPackageName of process.argv.slice(2)) {
2930
}
3031

3132
const [packageName] = packageNameGuess.result.split('/');
32-
const apiGoldenTargetName = `//goldens:${packageName}_api.accept`.replace(/-/g, '_');
33+
targetsToRun.add(`//goldens:${packageName}_api.accept`.replace(/-/g, '_'));
34+
}
3335

34-
sh.exec(`${bazel} run ${apiGoldenTargetName}`);
36+
for (const target of targetsToRun) {
37+
sh.exec(`${bazel} run ${target}`);
3538
}

0 commit comments

Comments
 (0)