Skip to content

Commit

Permalink
Wait for dist-tag updates to finish
Browse files Browse the repository at this point in the history
The logs from the `update-next-tags` script indicate that things
aren't correctly being waited on. Some logs are missing entirely.
Some packages don't get their appropriate update. This change
should at least get us the logs if it doesn't fix the issue itself.
  • Loading branch information
trevor-scheer committed Sep 18, 2023
1 parent f4c9f80 commit 78b24a2
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions scripts/update-next-tags.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// @ts-check
import { exec } from "child_process";
import { promisify } from "util";
import { readFileSync } from "fs";
import fetch from "node-fetch";
import { resolve } from "path";
import semver from "semver";

const asyncExec = promisify(exec);

let statusCode = 0;
// Collect all the packages that we publish
const workspaces = JSON.parse(
Expand Down Expand Up @@ -37,14 +40,14 @@ await Promise.all(
const command = `npm dist-tag add ${pkg}@${mostRecentVersion} next`;
if (nextVersion !== mostRecentVersion) {
console.log(`\`next\` tag is behind, updating...`);
exec(command, (e) => {
if (e) {
console.error(e);
throw e;
} else {
console.log("`next` tag updated successfully!");
}
});
try {
const { stdout, stderr } = await asyncExec(command)
if (stderr) console.error(stderr);
if (stdout) console.log(stdout);
} catch (e) {
console.error(e);
throw e;
}
} else {
console.log(
"No action needed, `next` tag is pointed to most recent version"
Expand Down

0 comments on commit 78b24a2

Please sign in to comment.