Skip to content

Commit

Permalink
chore(release): prompt for OTP for npm publish (#3129)
Browse files Browse the repository at this point in the history
  • Loading branch information
ltm authored Nov 3, 2021
1 parent 0bb8ccf commit 1b8b7ec
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/release-tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export function runReleaseTasks(opts: BuildOptions, args: ReadonlyArray<string>)
title: 'Publish @stencil/core to npm',
task: () => {
const cmd = 'npm';
const cmdArgs = ['publish'].concat(opts.tag ? ['--tag', opts.tag] : []);
const cmdArgs = ['publish', '--otp', opts.otp].concat(opts.tag ? ['--tag', opts.tag] : []);

if (isDryRun) {
return console.log(`[dry-run] ${cmd} ${cmdArgs.join(' ')}`);
Expand Down
12 changes: 12 additions & 0 deletions scripts/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,24 @@ async function publishRelease(opts: BuildOptions, args: ReadonlyArray<string>):
return `Will publish ${opts.vermoji} ${color.yellow(opts.version)}${tagPart}. Continue?`;
},
},
{
type: 'input',
name: 'otp',
message: 'Enter OTP:',
validate: (input: any) => {
if (input.length !== 6) {
return 'Please enter a valid one-time password.';
}
return true;
},
},
];

await inquirer
.prompt(prompts)
.then((answers) => {
if (answers.confirm) {
opts.otp = answers.otp;
runReleaseTasks(opts, args);
}
})
Expand Down
1 change: 1 addition & 0 deletions scripts/utils/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export interface BuildOptions {
parse5Verion?: string;
sizzleVersion?: string;
terserVersion?: string;
otp?: '';
}

export interface CmdLineArgs {
Expand Down

0 comments on commit 1b8b7ec

Please sign in to comment.