@@ -13,7 +13,7 @@ import {
13
13
npmLoginInteractive ,
14
14
npmPublish ,
15
15
} from './npm/npm-client' ;
16
- import { promptForNpmDistTag } from './prompt/npm-dist-tag-prompt' ;
16
+ import { promptForNpmDistTag , promptForNpmOtp } from './prompt/npm-dist-tag-prompt' ;
17
17
import { promptForUpstreamRemote } from './prompt/upstream-remote-prompt' ;
18
18
import { releasePackages } from './release-output/release-packages' ;
19
19
import { CHANGELOG_FILE_NAME } from './stage-release' ;
@@ -123,8 +123,12 @@ class PublishReleaseTask extends BaseReleaseTask {
123
123
// the user to interactively confirm that the script should continue.
124
124
await this . _promptConfirmReleasePublish ( ) ;
125
125
126
+ // Prompt for the OTP right before publishing so that it doesn't expire while building the
127
+ // packages.
128
+ const npmOtp = await promptForNpmOtp ( ) ;
129
+
126
130
for ( let packageName of releasePackages ) {
127
- this . _publishPackageToNpm ( packageName , npmDistTag ) ;
131
+ this . _publishPackageToNpm ( packageName , npmDistTag , npmOtp ) ;
128
132
}
129
133
130
134
const newReleaseUrl = getGithubNewReleaseUrl ( {
@@ -237,10 +241,10 @@ class PublishReleaseTask extends BaseReleaseTask {
237
241
}
238
242
239
243
/** Publishes the specified package within the given NPM dist tag. */
240
- private _publishPackageToNpm ( packageName : string , npmDistTag : string ) {
244
+ private _publishPackageToNpm ( packageName : string , npmDistTag : string , npmOtp : string ) {
241
245
console . info ( green ( ` ⭮ Publishing "${ packageName } "..` ) ) ;
242
246
243
- const errorOutput = npmPublish ( join ( this . releaseOutputPath , packageName ) , npmDistTag ) ;
247
+ const errorOutput = npmPublish ( join ( this . releaseOutputPath , packageName ) , npmDistTag , npmOtp ) ;
244
248
245
249
if ( errorOutput ) {
246
250
console . error ( red ( ` ✘ An error occurred while publishing "${ packageName } ".` ) ) ;
0 commit comments