Skip to content
This repository has been archived by the owner on Apr 9, 2022. It is now read-only.

Commit

Permalink
feat(@schematics/update): support scoped package registries
Browse files Browse the repository at this point in the history
  • Loading branch information
clydin authored and hansl committed May 7, 2018
1 parent 6bb0c78 commit 598c538
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/schematics/update/update/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { logging } from '@angular-devkit/core';
import { exec } from 'child_process';
import { Observable, ReplaySubject, concat, of } from 'rxjs';
import { concatMap, first, map, toArray } from 'rxjs/operators';
import { concatMap, filter, first, map, toArray } from 'rxjs/operators';
import * as url from 'url';
import { NpmRepositoryPackageJson } from './npm-package-json';

Expand Down Expand Up @@ -54,8 +54,14 @@ export function getNpmPackageJson(
registryUrl: string | undefined,
logger: logging.LoggerApi,
): Observable<Partial<NpmRepositoryPackageJson>> {

return (registryUrl ? of(registryUrl) : getNpmConfigOption('registry')).pipe(
const scope = packageName.startsWith('@') ? packageName.split('/')[0] : null;

return concat(
of(registryUrl),
scope ? getNpmConfigOption(scope + ':registry') : of(undefined),
getNpmConfigOption('registry'),
).pipe(
filter(partialUrl => !!partialUrl),
first(),
map(partialUrl => {
if (!partialUrl) {
Expand Down

0 comments on commit 598c538

Please sign in to comment.