Use spawn instead of exec so we can bubble up the OTP prompt since OTP is only valid for 30sec, and we might need several
This commit is contained in:
parent
65e5b09cd1
commit
0a47d89963
@ -264,10 +264,25 @@ async function lernaPublishAsync(packageToNextVersion: { [name: string]: string
|
||||
lernaPublishCmd += ` --no-git-tag-version --no-push`;
|
||||
}
|
||||
utils.log('Lerna is publishing...');
|
||||
await execAsync(lernaPublishCmd, {
|
||||
const child = await spawnAsync(lernaPublishCmd, {
|
||||
cwd: constants.monorepoRootPath,
|
||||
maxBuffer: 102400000, // 500 * 1024 * 200
|
||||
});
|
||||
child.stdout.on('data', async (data: Buffer) => {
|
||||
const output = data.toString('utf8');
|
||||
utils.log('Lerna publish cmd: ', output);
|
||||
const isOTPPrompt = _.includes(output, 'Enter OTP:');
|
||||
if (isOTPPrompt) {
|
||||
// Prompt for OTP
|
||||
prompt.start();
|
||||
const result = await promisify(prompt.get)(['OTP']);
|
||||
child.stdin.write(`${result.OTP}\n`);
|
||||
}
|
||||
});
|
||||
child.stderr.on('data', (data: Buffer) => {
|
||||
const output = data.toString('utf8');
|
||||
utils.log('Lerna publish cmd: ', output);
|
||||
});
|
||||
}
|
||||
|
||||
function updateVersionNumberIfNeeded(currentVersion: string, proposedNextVersion: string): string {
|
||||
|
Loading…
x
Reference in New Issue
Block a user