12
12
import { logging } from '@angular-devkit/core' ;
13
13
import { execSync } from 'child_process' ;
14
14
import { packages , stableToExperimentalVersion } from '../lib/packages' ;
15
+ import { wombat } from '../lib/registries' ;
15
16
16
17
interface DistTagOptions {
17
18
/**
@@ -24,10 +25,15 @@ interface DistTagOptions {
24
25
* experimental packages.
25
26
*/
26
27
version : string ;
28
+
27
29
/**
28
30
* Tag is usually "latest" or "next", but could also be "v10-lts" for example.
29
31
*/
30
32
tag : string ;
33
+
34
+ /** The package registry to tag. */
35
+ registry : string ;
36
+
31
37
/**
32
38
* If true, prints the help message.
33
39
*/
50
56
51
57
return ;
52
58
}
53
- const { version, tag} = args ;
59
+ const { version, tag, registry : registryArg } = args ;
54
60
if ( ! version || version . startsWith ( 'v' ) ) {
55
61
throw new Error ( 'Version must be specified in format d+.d+.d+' ) ;
56
62
}
@@ -60,11 +66,12 @@ Usage:
60
66
if ( ! tag ) {
61
67
throw new Error ( 'Tag must be non-empty, for example: latest, next, v10-lts, etc' ) ;
62
68
}
69
+ const registry = registryArg ?? wombat ;
63
70
const publicPackages = Object . values ( packages ) . filter ( p => ! p . private ) ;
64
71
for ( const { name, experimental} of publicPackages ) {
65
72
const actualVersion = experimental ? stableToExperimentalVersion ( version ) : version ;
66
73
// See https://docs.npmjs.com/cli/dist-tag for documentation
67
- const cmd = `npm dist-tag add '${ name } @${ actualVersion } ' '${ tag } '` ;
74
+ const cmd = `npm dist-tag add '${ name } @${ actualVersion } ' '${ tag } ' --registry ' ${ registry } ' ` ;
68
75
logger . debug ( cmd ) ; // print debug output by specifying --verbose
69
76
const output = execSync ( cmd , { encoding : 'utf8' } ) ;
70
77
logger . info ( output . trim ( ) ) ;
0 commit comments