Skip to content

Commit 70c82a1

Browse files
dgp1130alan-agius4
authored andcommitted
ci: add --registry flag to dist-tag command
This includes a new `--registry` flag to the `dist-tag` command and defaults it to Wombat. This way NPM commands will explicitly use the correct registry.
1 parent 07802c9 commit 70c82a1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

scripts/dist-tag.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import { logging } from '@angular-devkit/core';
1313
import { execSync } from 'child_process';
1414
import { packages, stableToExperimentalVersion } from '../lib/packages';
15+
import { wombat } from '../lib/registries';
1516

1617
interface 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
*/
@@ -50,7 +56,7 @@ Usage:
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

Comments
 (0)