@@ -11,10 +11,12 @@ const {execRead, execUnlessDry, logPromise} = require('../utils');
11
11
const push = async ( { cwd, dry, otp, packages, version, tag} ) => {
12
12
const errors = [ ] ;
13
13
const isPrerelease = semver . prerelease ( version ) ;
14
+
15
+ let resolvedTag = tag ;
14
16
if ( tag === undefined ) {
15
17
// No tag was provided. Default to `latest` for stable releases and `next`
16
18
// for prereleases
17
- tag = isPrerelease ? 'next' : 'latest' ;
19
+ resolvedTag = isPrerelease ? 'next' : 'latest' ;
18
20
} else if ( tag === 'latest' && isPrerelease ) {
19
21
throw new Error ( 'The tag `latest` can only be used for stable versions.' ) ;
20
22
}
@@ -26,7 +28,7 @@ const push = async ({cwd, dry, otp, packages, version, tag}) => {
26
28
const publishProject = async project => {
27
29
try {
28
30
const path = join ( cwd , 'build' , 'node_modules' , project ) ;
29
- await execUnlessDry ( `npm publish --tag ${ tag } ${ twoFactorAuth } ` , {
31
+ await execUnlessDry ( `npm publish --tag ${ resolvedTag } ${ twoFactorAuth } ` , {
30
32
cwd : path ,
31
33
dry,
32
34
} ) ;
@@ -49,7 +51,7 @@ const push = async ({cwd, dry, otp, packages, version, tag}) => {
49
51
const status = JSON . parse (
50
52
await execRead ( `npm info ${ project } dist-tags --json` )
51
53
) ;
52
- const remoteVersion = status [ tag ] ;
54
+ const remoteVersion = status [ resolvedTag ] ;
53
55
54
56
// Compare remote version to package.json version,
55
57
// To better handle the case of pre-release versions.
@@ -62,7 +64,9 @@ const push = async ({cwd, dry, otp, packages, version, tag}) => {
62
64
63
65
// If we've just published a stable release,
64
66
// Update the @next tag to also point to it (so @next doesn't lag behind).
65
- if ( ! isPrerelease ) {
67
+ // Skip this step if we have a manually specified tag.
68
+ // This is an escape hatch for us to interleave alpha and stable releases.
69
+ if ( tag === undefined && ! isPrerelease ) {
66
70
await execUnlessDry (
67
71
`npm dist-tag add ${ project } @${ packageVersion } next ${ twoFactorAuth } ` ,
68
72
{ cwd : path , dry}
0 commit comments