Skip to content

Commit a6a1005

Browse files
Start verdaccio earlier and keep it alive longer (#8016)
* Start verdaccio earlier and keep it alive longer Start the verdaccio server immediately when running publish-npm and keep it alive until the first OTP is entered. Also, add a tip for how to access the server from your browser. This makes it easier to verify that all packages will be published correctly to NPM. * Fix CI timeout from asking to quit verdaccio
1 parent 00831de commit a6a1005

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

scripts/publish-npm.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ parser.addArgument(['--auto-publish-local-newer'], {
110110

111111
parser.addArgument(['--ci'], {
112112
action: 'storeTrue',
113-
help: 'Enable CI bazel flags for faster compilation. No effect on results.',
113+
help: 'Enable CI bazel flags for faster compilation and don\'t ask for user '
114+
+ 'input before closing the verdaccio server once tests are done. '
115+
+ 'Has no effect on results.',
114116
});
115117

116118
parser.addArgument(['packages'], {
@@ -221,6 +223,8 @@ async function publish(pkg: string, registry: string, otp?: string,
221223
async function main() {
222224
const args = parser.parseArgs();
223225

226+
const killVerdaccio = await runVerdaccio();
227+
224228
let releaseUnits: ReleaseUnit[];
225229
if (args.release_this_branch) {
226230
console.log('Releasing current branch');
@@ -359,19 +363,24 @@ async function main() {
359363
// Build and publish all packages to a local Verdaccio repo for staging.
360364
console.log(
361365
chalk.magenta.bold('~~~ Staging packages locally in Verdaccio ~~~'));
362-
const killVerdaccio = await runVerdaccio();
366+
363367
try {
364368
for (const pkg of packages) {
365369
await publish(pkg, VERDACCIO_REGISTRY);
366370
}
367-
} finally {
371+
} catch (e) {
368372
// Make sure to kill the verdaccio server before exiting even if publish
369373
// throws an error. Otherwise, it blocks the port for the next run.
370374
killVerdaccio();
375+
throw e;
371376
}
372377

373378
if (args.dry) {
374379
console.log('Not publishing packages due to \'--dry\'');
380+
if (!args.ci) {
381+
await question('Press enter to quit verdaccio.');
382+
}
383+
killVerdaccio();
375384
} else {
376385
// Publish all built packages to the selected registry
377386
let otp = '';
@@ -380,6 +389,8 @@ async function main() {
380389
}
381390
console.log(`Publishing packages to ${args.registry}`);
382391

392+
killVerdaccio();
393+
383394
const toPublish = [...packages];
384395
while (toPublish.length > 0) {
385396
// Using a while loop instead of .map since a stale OTP will require

scripts/release-util.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,8 @@ export async function runVerdaccio(): Promise<() => void> {
640640
641641
serverProcess.on('message', (msg: {verdaccio_started: boolean}) => {
642642
if (msg.verdaccio_started) {
643-
console.log('Verdaccio Started.');
643+
console.log(chalk.magenta.bold(
644+
`Verdaccio Started. Visit http://localhost:4873 to see packages.`));
644645
clearTimeout(timeout);
645646
resolve();
646647
}

0 commit comments

Comments
 (0)