Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit fd2afa8

Browse files
clydinhansl
authored andcommitted
fix(@schematics/update): support scoped package registries
1 parent b75a591 commit fd2afa8

File tree

1 file changed

+9
-3
lines changed
  • packages/schematics/update/update

1 file changed

+9
-3
lines changed

packages/schematics/update/update/npm.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import { logging } from '@angular-devkit/core';
99
import { exec } from 'child_process';
1010
import { Observable, ReplaySubject, concat, of } from 'rxjs';
11-
import { concatMap, first, map, toArray } from 'rxjs/operators';
11+
import { concatMap, filter, first, map, toArray } from 'rxjs/operators';
1212
import * as url from 'url';
1313
import { NpmRepositoryPackageJson } from './npm-package-json';
1414

@@ -54,8 +54,14 @@ export function getNpmPackageJson(
5454
registryUrl: string | undefined,
5555
logger: logging.LoggerApi,
5656
): Observable<Partial<NpmRepositoryPackageJson>> {
57-
58-
return (registryUrl ? of(registryUrl) : getNpmConfigOption('registry')).pipe(
57+
const scope = packageName.startsWith('@') ? packageName.split('/')[0] : null;
58+
59+
return concat(
60+
of(registryUrl),
61+
scope ? getNpmConfigOption(scope + ':registry') : of(undefined),
62+
getNpmConfigOption('registry'),
63+
).pipe(
64+
filter(partialUrl => !!partialUrl),
5965
first(),
6066
map(partialUrl => {
6167
if (!partialUrl) {

0 commit comments

Comments
 (0)