diff --git a/scripts/update-next-tags.mjs b/scripts/update-next-tags.mjs index aa50617b7..f06f8f582 100644 --- a/scripts/update-next-tags.mjs +++ b/scripts/update-next-tags.mjs @@ -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( @@ -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"