Fix lerna publish to include publishing prerelease versions
This commit is contained in:
parent
39724292e3
commit
195c3af84e
@ -19,11 +19,6 @@ const DOC_GEN_COMMAND = 'docs:json';
|
|||||||
const NPM_NAMESPACE = '@0xproject/';
|
const NPM_NAMESPACE = '@0xproject/';
|
||||||
const IS_DRY_RUN = process.env.IS_DRY_RUN === 'true';
|
const IS_DRY_RUN = process.env.IS_DRY_RUN === 'true';
|
||||||
const TODAYS_TIMESTAMP = moment().unix();
|
const TODAYS_TIMESTAMP = moment().unix();
|
||||||
const semverNameToIndex: { [semver: string]: number } = {
|
|
||||||
patch: SemVerIndex.Patch,
|
|
||||||
minor: SemVerIndex.Minor,
|
|
||||||
major: SemVerIndex.Major,
|
|
||||||
};
|
|
||||||
const packageNameToWebsitePath: { [name: string]: string } = {
|
const packageNameToWebsitePath: { [name: string]: string } = {
|
||||||
'0x.js': '0xjs',
|
'0x.js': '0xjs',
|
||||||
'web3-wrapper': 'web3_wrapper',
|
'web3-wrapper': 'web3_wrapper',
|
||||||
@ -176,6 +171,7 @@ async function lernaPublishAsync(packageToVersionChange: { [name: string]: strin
|
|||||||
cwd: constants.monorepoRootPath,
|
cwd: constants.monorepoRootPath,
|
||||||
});
|
});
|
||||||
let shouldPrintOutput = false;
|
let shouldPrintOutput = false;
|
||||||
|
let packageName: string;
|
||||||
child.stdout.on('data', (data: Buffer) => {
|
child.stdout.on('data', (data: Buffer) => {
|
||||||
const output = data.toString('utf8');
|
const output = data.toString('utf8');
|
||||||
if (shouldPrintOutput) {
|
if (shouldPrintOutput) {
|
||||||
@ -184,14 +180,15 @@ async function lernaPublishAsync(packageToVersionChange: { [name: string]: strin
|
|||||||
const isVersionPrompt = _.includes(output, 'Select a new version');
|
const isVersionPrompt = _.includes(output, 'Select a new version');
|
||||||
if (isVersionPrompt) {
|
if (isVersionPrompt) {
|
||||||
const outputStripLeft = output.split('new version for ')[1];
|
const outputStripLeft = output.split('new version for ')[1];
|
||||||
const packageName = outputStripLeft.split(' ')[0];
|
packageName = outputStripLeft.split(' ')[0];
|
||||||
let versionChange = packageToVersionChange[packageName];
|
child.stdin.write(`${SemVerIndex.Custom}\n`);
|
||||||
const isPrivatePackage = _.isUndefined(versionChange);
|
return;
|
||||||
if (isPrivatePackage) {
|
}
|
||||||
versionChange = 'patch'; // Always patch updates to private packages.
|
const isCustomVersionPrompt = _.includes(output, 'Enter a custom version');
|
||||||
}
|
if (isCustomVersionPrompt) {
|
||||||
const semVerIndex = semverNameToIndex[versionChange];
|
const versionChange = packageToVersionChange[packageName];
|
||||||
child.stdin.write(`${semVerIndex}\n`);
|
child.stdin.write(`${versionChange}\n`);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
const isFinalPrompt = _.includes(output, 'Are you sure you want to publish the above changes?');
|
const isFinalPrompt = _.includes(output, 'Are you sure you want to publish the above changes?');
|
||||||
if (isFinalPrompt && !IS_DRY_RUN) {
|
if (isFinalPrompt && !IS_DRY_RUN) {
|
||||||
|
@ -22,6 +22,11 @@ export enum SemVerIndex {
|
|||||||
Patch,
|
Patch,
|
||||||
Minor,
|
Minor,
|
||||||
Major,
|
Major,
|
||||||
|
Prepatch,
|
||||||
|
Preminor,
|
||||||
|
Premajor,
|
||||||
|
Prerelease,
|
||||||
|
Custom,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PackageToVersionChange {
|
export interface PackageToVersionChange {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user