diff options
author | Fabio Berger <me@fabioberger.com> | 2018-07-24 01:56:53 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-07-24 01:56:53 +0800 |
commit | 195c3af84e080b51c4258739da0e996f690f52f5 (patch) | |
tree | 40decf50baade23421486a856e4422f77ca5e678 /packages/monorepo-scripts | |
parent | 39724292e36c9812ec727d2734e34a2ffd92cdb7 (diff) | |
download | dexon-sol-tools-195c3af84e080b51c4258739da0e996f690f52f5.tar dexon-sol-tools-195c3af84e080b51c4258739da0e996f690f52f5.tar.gz dexon-sol-tools-195c3af84e080b51c4258739da0e996f690f52f5.tar.bz2 dexon-sol-tools-195c3af84e080b51c4258739da0e996f690f52f5.tar.lz dexon-sol-tools-195c3af84e080b51c4258739da0e996f690f52f5.tar.xz dexon-sol-tools-195c3af84e080b51c4258739da0e996f690f52f5.tar.zst dexon-sol-tools-195c3af84e080b51c4258739da0e996f690f52f5.zip |
Fix lerna publish to include publishing prerelease versions
Diffstat (limited to 'packages/monorepo-scripts')
-rw-r--r-- | packages/monorepo-scripts/src/publish.ts | 23 | ||||
-rw-r--r-- | packages/monorepo-scripts/src/types.ts | 5 |
2 files changed, 15 insertions, 13 deletions
diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts index 958cb58ba..e22d9800c 100644 --- a/packages/monorepo-scripts/src/publish.ts +++ b/packages/monorepo-scripts/src/publish.ts @@ -19,11 +19,6 @@ const DOC_GEN_COMMAND = 'docs:json'; const NPM_NAMESPACE = '@0xproject/'; const IS_DRY_RUN = process.env.IS_DRY_RUN === 'true'; const TODAYS_TIMESTAMP = moment().unix(); -const semverNameToIndex: { [semver: string]: number } = { - patch: SemVerIndex.Patch, - minor: SemVerIndex.Minor, - major: SemVerIndex.Major, -}; const packageNameToWebsitePath: { [name: string]: string } = { '0x.js': '0xjs', 'web3-wrapper': 'web3_wrapper', @@ -176,6 +171,7 @@ async function lernaPublishAsync(packageToVersionChange: { [name: string]: strin cwd: constants.monorepoRootPath, }); let shouldPrintOutput = false; + let packageName: string; child.stdout.on('data', (data: Buffer) => { const output = data.toString('utf8'); if (shouldPrintOutput) { @@ -184,14 +180,15 @@ async function lernaPublishAsync(packageToVersionChange: { [name: string]: strin const isVersionPrompt = _.includes(output, 'Select a new version'); if (isVersionPrompt) { const outputStripLeft = output.split('new version for ')[1]; - const packageName = outputStripLeft.split(' ')[0]; - let versionChange = packageToVersionChange[packageName]; - const isPrivatePackage = _.isUndefined(versionChange); - if (isPrivatePackage) { - versionChange = 'patch'; // Always patch updates to private packages. - } - const semVerIndex = semverNameToIndex[versionChange]; - child.stdin.write(`${semVerIndex}\n`); + packageName = outputStripLeft.split(' ')[0]; + child.stdin.write(`${SemVerIndex.Custom}\n`); + return; + } + const isCustomVersionPrompt = _.includes(output, 'Enter a custom version'); + if (isCustomVersionPrompt) { + const versionChange = packageToVersionChange[packageName]; + child.stdin.write(`${versionChange}\n`); + return; } const isFinalPrompt = _.includes(output, 'Are you sure you want to publish the above changes?'); if (isFinalPrompt && !IS_DRY_RUN) { diff --git a/packages/monorepo-scripts/src/types.ts b/packages/monorepo-scripts/src/types.ts index 9f991c86c..62d52d7bf 100644 --- a/packages/monorepo-scripts/src/types.ts +++ b/packages/monorepo-scripts/src/types.ts @@ -22,6 +22,11 @@ export enum SemVerIndex { Patch, Minor, Major, + Prepatch, + Preminor, + Premajor, + Prerelease, + Custom, } export interface PackageToVersionChange { |