Retry with fresh otp if publish fails (#20582)
Currently, if publishing a package fails, the script crashes, and the user must start it again from the beginning. Usually this happens because the one-time password has timed out. With this change, the user will be prompted for a fresh otp, and the script will resume publishing.
This commit is contained in:
parent
e6ed2bcf42
commit
fc07b070a0
|
@ -48,8 +48,22 @@ const run = async () => {
|
|||
await confirmVersionAndTags(params);
|
||||
await validateSkipPackages(params);
|
||||
await checkNPMPermissions(params);
|
||||
const otp = await promptForOTP(params);
|
||||
await publishToNPM(params, otp);
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
const otp = await promptForOTP(params);
|
||||
await publishToNPM(params, otp);
|
||||
break;
|
||||
} catch (error) {
|
||||
console.error(error.message);
|
||||
console.log();
|
||||
console.log(
|
||||
theme.error`Publish failed. Enter a fresh otp code to retry.`
|
||||
);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
await updateStableVersionNumbers(params);
|
||||
await printFollowUpInstructions(params);
|
||||
} catch (error) {
|
||||
|
|
Loading…
Reference in New Issue