1212import { logging } from '@angular-devkit/core' ;
1313import { execSync } from 'child_process' ;
1414import { packages , stableToExperimentalVersion } from '../lib/packages' ;
15+ import { wombat } from '../lib/registries' ;
1516
1617interface DistTagOptions {
1718 /**
@@ -24,10 +25,15 @@ interface DistTagOptions {
2425 * experimental packages.
2526 */
2627 version : string ;
28+
2729 /**
2830 * Tag is usually "latest" or "next", but could also be "v10-lts" for example.
2931 */
3032 tag : string ;
33+
34+ /** The package registry to tag. */
35+ registry : string ;
36+
3137 /**
3238 * If true, prints the help message.
3339 */
5056
5157 return ;
5258 }
53- const { version, tag} = args ;
59+ const { version, tag, registry : registryArg } = args ;
5460 if ( ! version || version . startsWith ( 'v' ) ) {
5561 throw new Error ( 'Version must be specified in format d+.d+.d+' ) ;
5662 }
@@ -60,11 +66,12 @@ Usage:
6066 if ( ! tag ) {
6167 throw new Error ( 'Tag must be non-empty, for example: latest, next, v10-lts, etc' ) ;
6268 }
69+ const registry = registryArg ?? wombat ;
6370 const publicPackages = Object . values ( packages ) . filter ( p => ! p . private ) ;
6471 for ( const { name, experimental} of publicPackages ) {
6572 const actualVersion = experimental ? stableToExperimentalVersion ( version ) : version ;
6673 // 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 } ' ` ;
6875 logger . debug ( cmd ) ; // print debug output by specifying --verbose
6976 const output = execSync ( cmd , { encoding : 'utf8' } ) ;
7077 logger . info ( output . trim ( ) ) ;
0 commit comments