@@ -7,21 +7,13 @@ import {checkReleaseOutput} from './check-release-output';
7
7
import { extractReleaseNotes } from './extract-release-notes' ;
8
8
import { GitClient } from './git/git-client' ;
9
9
import { getGithubNewReleaseUrl } from './git/github-urls' ;
10
- import {
11
- isNpmAuthenticated ,
12
- npmLogout ,
13
- npmLoginInteractive ,
14
- npmPublish ,
15
- } from './npm/npm-client' ;
10
+ import { npmPublish } from './npm/npm-client' ;
16
11
import { promptForNpmDistTag } from './prompt/npm-dist-tag-prompt' ;
17
12
import { promptForUpstreamRemote } from './prompt/upstream-remote-prompt' ;
18
13
import { releasePackages } from './release-output/release-packages' ;
19
14
import { CHANGELOG_FILE_NAME } from './stage-release' ;
20
15
import { parseVersionName , Version } from './version-name/parse-version' ;
21
16
22
- /** Maximum allowed tries to authenticate NPM. */
23
- const MAX_NPM_LOGIN_TRIES = 2 ;
24
-
25
17
/**
26
18
* Class that can be instantiated in order to create a new release. The tasks requires user
27
19
* interaction/input through command line prompts.
@@ -94,10 +86,6 @@ class PublishReleaseTask extends BaseReleaseTask {
94
86
await this . _promptStableVersionForNextTag ( ) ;
95
87
}
96
88
97
- // Ensure that we are authenticated, so that we can run "npm publish" for
98
- // each package once the release output is built.
99
- this . _checkNpmAuthentication ( ) ;
100
-
101
89
this . _buildReleasePackages ( ) ;
102
90
console . info ( chalk . green ( ` ✓ Built the release output.` ) ) ;
103
91
@@ -140,15 +128,6 @@ class PublishReleaseTask extends BaseReleaseTask {
140
128
141
129
console . log ( ) ;
142
130
console . info ( chalk . green ( chalk . bold ( ` ✓ Published all packages successfully` ) ) ) ;
143
-
144
- // Always log out of npm after releasing to prevent unintentional changes to
145
- // any packages.
146
- if ( npmLogout ( ) ) {
147
- console . info ( chalk . green ( ` ✓ Logged out of npm` ) ) ;
148
- } else {
149
- console . error ( chalk . red ( ` ✘ Could not log out of NPM. Please manually log out!` ) ) ;
150
- }
151
-
152
131
console . info ( chalk . yellow ( ` ⚠ Please draft a new release of the version on Github.` ) ) ;
153
132
console . info ( chalk . yellow ( ` ${ newReleaseUrl } ` ) ) ;
154
133
}
@@ -201,40 +180,6 @@ class PublishReleaseTask extends BaseReleaseTask {
201
180
}
202
181
}
203
182
204
- /**
205
- * Checks whether NPM is currently authenticated. If not, the user will be prompted to enter
206
- * the NPM credentials that are necessary to publish the release. We achieve this by basically
207
- * running "npm login" as a child process and piping stdin/stdout/stderr to the current tty.
208
- */
209
- private _checkNpmAuthentication ( ) {
210
- if ( isNpmAuthenticated ( ) ) {
211
- console . info ( chalk . green ( ` ✓ NPM is authenticated.` ) ) ;
212
- return ;
213
- }
214
-
215
- let failedAuthentication = false ;
216
- console . log ( chalk . yellow ( ` ⚠ NPM is currently not authenticated. Running "npm login"..` ) ) ;
217
-
218
- for ( let i = 0 ; i < MAX_NPM_LOGIN_TRIES ; i ++ ) {
219
- if ( npmLoginInteractive ( ) ) {
220
- // In case the user was able to login properly, we want to exit the loop as we
221
- // don't need to ask for authentication again.
222
- break ;
223
- }
224
-
225
- failedAuthentication = true ;
226
- console . error ( chalk . red ( ` ✘ Could not authenticate successfully. Please try again.` ) ) ;
227
- }
228
-
229
- if ( failedAuthentication ) {
230
- console . error ( chalk . red ( ` ✘ Could not authenticate after ${ MAX_NPM_LOGIN_TRIES } tries. ` +
231
- `Exiting..` ) ) ;
232
- process . exit ( 1 ) ;
233
- }
234
-
235
- console . info ( chalk . green ( ` ✓ Successfully authenticated NPM.` ) ) ;
236
- }
237
-
238
183
/** Publishes the specified package within the given NPM dist tag. */
239
184
private _publishPackageToNpm ( packageName : string , npmDistTag : string ) {
240
185
console . info ( chalk . green ( ` ⭮ Publishing "${ packageName } "..` ) ) ;
0 commit comments