diff --git a/scripts/publish-npm.ts b/scripts/publish-npm.ts index 870a43e8643..aa2916cc4fb 100755 --- a/scripts/publish-npm.ts +++ b/scripts/publish-npm.ts @@ -110,7 +110,9 @@ parser.addArgument(['--auto-publish-local-newer'], { parser.addArgument(['--ci'], { action: 'storeTrue', - help: 'Enable CI bazel flags for faster compilation. No effect on results.', + help: 'Enable CI bazel flags for faster compilation and don\'t ask for user ' + + 'input before closing the verdaccio server once tests are done. ' + + 'Has no effect on results.', }); parser.addArgument(['packages'], { @@ -221,6 +223,8 @@ async function publish(pkg: string, registry: string, otp?: string, async function main() { const args = parser.parseArgs(); + const killVerdaccio = await runVerdaccio(); + let releaseUnits: ReleaseUnit[]; if (args.release_this_branch) { console.log('Releasing current branch'); @@ -359,19 +363,24 @@ async function main() { // Build and publish all packages to a local Verdaccio repo for staging. console.log( chalk.magenta.bold('~~~ Staging packages locally in Verdaccio ~~~')); - const killVerdaccio = await runVerdaccio(); + try { for (const pkg of packages) { await publish(pkg, VERDACCIO_REGISTRY); } - } finally { + } catch (e) { // Make sure to kill the verdaccio server before exiting even if publish // throws an error. Otherwise, it blocks the port for the next run. killVerdaccio(); + throw e; } if (args.dry) { console.log('Not publishing packages due to \'--dry\''); + if (!args.ci) { + await question('Press enter to quit verdaccio.'); + } + killVerdaccio(); } else { // Publish all built packages to the selected registry let otp = ''; @@ -380,6 +389,8 @@ async function main() { } console.log(`Publishing packages to ${args.registry}`); + killVerdaccio(); + const toPublish = [...packages]; while (toPublish.length > 0) { // Using a while loop instead of .map since a stale OTP will require diff --git a/scripts/release-util.ts b/scripts/release-util.ts index c5326ee6717..5e6107fb260 100755 --- a/scripts/release-util.ts +++ b/scripts/release-util.ts @@ -640,7 +640,8 @@ export async function runVerdaccio(): Promise<() => void> { serverProcess.on('message', (msg: {verdaccio_started: boolean}) => { if (msg.verdaccio_started) { - console.log('Verdaccio Started.'); + console.log(chalk.magenta.bold( + `Verdaccio Started. Visit http://localhost:4873 to see packages.`)); clearTimeout(timeout); resolve(); }