@@ -7,7 +7,12 @@ import {checkReleaseOutput} from './check-release-output';
77import { extractReleaseNotes } from './extract-release-notes' ;
88import { GitClient } from './git/git-client' ;
99import { getGithubNewReleaseUrl } from './git/github-urls' ;
10- import { isNpmAuthenticated , runInteractiveNpmLogin , runNpmPublish } from './npm/npm-client' ;
10+ import {
11+ isNpmAuthenticated ,
12+ npmLogout ,
13+ npmLoginInteractive ,
14+ npmPublish ,
15+ } from './npm/npm-client' ;
1116import { promptForNpmDistTag } from './prompt/npm-dist-tag-prompt' ;
1217import { promptForUpstreamRemote } from './prompt/upstream-remote-prompt' ;
1318import { releasePackages } from './release-output/release-packages' ;
@@ -125,6 +130,12 @@ class PublishReleaseTask extends BaseReleaseTask {
125130
126131 console . log ( ) ;
127132 console . info ( green ( bold ( ` ✓ Published all packages successfully` ) ) ) ;
133+
134+ // Always log out of npm after releasing to prevent unintentional changes to
135+ // any packages.
136+ npmLogout ( ) ;
137+ console . info ( green ( bold ( ` ✓ Logged out of npm` ) ) ) ;
138+
128139 console . info ( yellow ( ` ⚠ Please draft a new release of the version on Github.` ) ) ;
129140 console . info ( yellow ( ` ${ newReleaseUrl } ` ) ) ;
130141 }
@@ -194,7 +205,7 @@ class PublishReleaseTask extends BaseReleaseTask {
194205 console . log ( yellow ( ` ⚠ NPM is currently not authenticated. Running "npm login"..` ) ) ;
195206
196207 for ( let i = 0 ; i < MAX_NPM_LOGIN_TRIES ; i ++ ) {
197- if ( runInteractiveNpmLogin ( ) ) {
208+ if ( npmLoginInteractive ( ) ) {
198209 // In case the user was able to login properly, we want to exit the loop as we
199210 // don't need to ask for authentication again.
200211 break ;
@@ -217,7 +228,7 @@ class PublishReleaseTask extends BaseReleaseTask {
217228 private publishPackageToNpm ( packageName : string , npmDistTag : string ) {
218229 console . info ( green ( ` ⭮ Publishing "${ packageName } "..` ) ) ;
219230
220- const errorOutput = runNpmPublish ( join ( this . releaseOutputPath , packageName ) , npmDistTag ) ;
231+ const errorOutput = npmPublish ( join ( this . releaseOutputPath , packageName ) , npmDistTag ) ;
221232
222233 if ( errorOutput ) {
223234 console . error ( red ( ` ✘ An error occurred while publishing "${ packageName } ".` ) ) ;
0 commit comments