Should print out lerna publish
stdout so we can see if anything went wrong
This commit is contained in:
@@ -112,8 +112,12 @@ async function lernaPublishAsync(packageToVersionChange: { [name: string]: strin
|
||||
const child = spawn('lerna', ['publish', '--registry=https://registry.npmjs.org/'], {
|
||||
cwd: constants.monorepoRootPath,
|
||||
});
|
||||
let shouldPrintOutput = false;
|
||||
child.stdout.on('data', (data: Buffer) => {
|
||||
const output = data.toString('utf8');
|
||||
if (shouldPrintOutput) {
|
||||
utils.log(output);
|
||||
}
|
||||
const isVersionPrompt = _.includes(output, 'Select a new version');
|
||||
if (isVersionPrompt) {
|
||||
const outputStripLeft = output.split('new version for ')[1];
|
||||
@@ -129,6 +133,8 @@ async function lernaPublishAsync(packageToVersionChange: { [name: string]: strin
|
||||
const isFinalPrompt = _.includes(output, 'Are you sure you want to publish the above changes?');
|
||||
if (isFinalPrompt && !IS_DRY_RUN) {
|
||||
child.stdin.write(`y\n`);
|
||||
// After confirmations, we want to print the output to watch the `lerna publish` command
|
||||
shouldPrintOutput = true;
|
||||
} else if (isFinalPrompt && IS_DRY_RUN) {
|
||||
utils.log(
|
||||
`Submitted all versions to Lerna but since this is a dry run, did not confirm. You need to CTRL-C to exit.`,
|
||||
|
Reference in New Issue
Block a user