Skip to content

Commit 1b5b2a1

Browse files
committed
refactor: define shouldPublishOnNPM when needed
1 parent 0d5a951 commit 1b5b2a1

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

scripts/release.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ const filesList = files.split( ',' );
1212

1313
utils.log( `Releasing ${ process.env.CIRCLE_PROJECT_REPONAME }…` );
1414

15-
let shouldPublishOnNPM = Boolean( process.env.NPM_TOKEN );
16-
1715
const getConfig = ({ gitBranchName }) => {
1816
const branchType = gitBranchName.split("/")[0];
1917
const githubConfig = {
@@ -32,7 +30,7 @@ const getConfig = ({ gitBranchName }) => {
3230
}
3331

3432
// Only publish alpha and release branches to NPM.
35-
shouldPublishOnNPM = shouldPublishOnNPM && ["alpha", "release"].includes(branchType);
33+
const shouldPublishOnNPM = Boolean( process.env.NPM_TOKEN ) && ["alpha", "release"].includes(branchType);
3634
if ( shouldPublishOnNPM ) {
3735
utils.log( `Will publish to npm.` );
3836
}

0 commit comments

Comments
 (0)