diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-08-09 05:01:12 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-08-09 05:01:12 +0800 |
commit | 797fd38e00e48abddc03be214984f81bf7b1c29c (patch) | |
tree | 1f90bf3e7f8fbdbc8572d0ef67ef92dda4b6b18b /packages/monorepo-scripts | |
parent | 8199e8794331f555679496d32cb87ad8513c31d1 (diff) | |
download | dexon-0x-contracts-797fd38e00e48abddc03be214984f81bf7b1c29c.tar dexon-0x-contracts-797fd38e00e48abddc03be214984f81bf7b1c29c.tar.gz dexon-0x-contracts-797fd38e00e48abddc03be214984f81bf7b1c29c.tar.bz2 dexon-0x-contracts-797fd38e00e48abddc03be214984f81bf7b1c29c.tar.lz dexon-0x-contracts-797fd38e00e48abddc03be214984f81bf7b1c29c.tar.xz dexon-0x-contracts-797fd38e00e48abddc03be214984f81bf7b1c29c.tar.zst dexon-0x-contracts-797fd38e00e48abddc03be214984f81bf7b1c29c.zip |
feat(monorepo-scripts): Add confirmation prompt before publishing
Diffstat (limited to 'packages/monorepo-scripts')
-rw-r--r-- | packages/monorepo-scripts/src/publish.ts | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts index 5992131db..6ff0c9bef 100644 --- a/packages/monorepo-scripts/src/publish.ts +++ b/packages/monorepo-scripts/src/publish.ts @@ -31,12 +31,25 @@ const packageNameToWebsitePath: { [name: string]: string } = { 'ethereum-types': 'ethereum-types', }; +async function confirmAsync(message: string): Promise<void> { + prompt.start(); + const result = await promisify(prompt.get)([message]); + const didConfirm = result[message] === 'y'; + if (!didConfirm) { + utils.log('Publish process aborted.'); + process.exit(0); + } +} + (async () => { // Fetch public, updated Lerna packages const shouldIncludePrivate = true; const allUpdatedPackages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate); if (!configs.IS_LOCAL_PUBLISH) { + await confirmAsync( + 'THIS IS NOT A TEST PUBLISH! You are about to publish one or more packages to npm. Are you sure you want to continue? (y/n)', + ); await confirmDocPagesRenderAsync(allUpdatedPackages); } @@ -107,14 +120,7 @@ package.ts. Please add an entry for it and try again.`, opn(link); }); - prompt.start(); - const message = 'Do all the doc pages render properly? (yn)'; - const result = await promisify(prompt.get)([message]); - const didConfirm = result[message] === 'y'; - if (!didConfirm) { - utils.log('Publish process aborted.'); - process.exit(0); - } + await confirmAsync('Do all the doc pages render properly? (y/n)'); } async function pushChangelogsToGithubAsync(): Promise<void> { |