Skip to content

Commit 9728648

Browse files
committed
[auto-publish.ts] Add an idempotency check.
1 parent d041d8e commit 9728648

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

script/auto-publish.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ if ((await $`git status --porcelain`).stdout.toString().trim()) {
88

99
const version = (await $`npm show cubing version`).stdout.toString().trim();
1010

11+
const currentDependencyVersion: string = (
12+
await $`cd app-template && npm ls cubing --json`.json()
13+
).dependencies.cubing.version;
14+
if (currentDependencyVersion === version) {
15+
console.log(`Current version matches lates from \`npm\`: ${version}`);
16+
console.log("Exiting (without error)");
17+
exit(0);
18+
}
19+
1120
await $`npm install --prefix ${fileURLToPath(new URL(import.meta.resolve("../app-template/")))} "cubing@v${version}"`;
1221
await $`npm version --no-git-tag-version "v${version}"`;
1322
await $`git commit --all --message "v${version}"`;

0 commit comments

Comments
 (0)