Skip to content

Commit 41bea1b

Browse files
authored
Registry should not be hard-coded when auth token is provided. (microsoft#127)
1 parent c3bd143 commit 41bea1b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

rush/rush/src/actions/PublishAction.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,15 @@ export default class PublishAction extends CommandLineAction {
337337
const args: string[] = ['publish'];
338338

339339
if (this._rushConfiguration.projectsByName.get(packageName).shouldPublish) {
340+
let registry: string = '//registry.npmjs.org/';
340341
if (this._registryUrl.value) {
341-
env['npm_config_registry'] = this._registryUrl.value; // tslint:disable-line:no-string-literal
342+
const registryUrl: string = this._registryUrl.value;
343+
env['npm_config_registry'] = registryUrl; // tslint:disable-line:no-string-literal
344+
registry = registryUrl.substring(registryUrl.indexOf('//'));
342345
}
343346

344347
if (this._npmAuthToken.value) {
345-
args.push(`--//registry.npmjs.org/:_authToken=${this._npmAuthToken.value}`);
348+
args.push(`--${registry}:_authToken=${this._npmAuthToken.value}`);
346349
}
347350

348351
if (this._force.value) {

0 commit comments

Comments
 (0)