Skip to content

Commit 24dc26c

Browse files
committed
revert: "fix(@schematics/update): use rc to find and read npm config"
This reverts commit 7662b8d.
1 parent 3fca66d commit 24dc26c

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@
113113
"postcss-url": "^7.3.2",
114114
"protractor": "~5.4.0",
115115
"raw-loader": "^0.5.1",
116-
"rc": "^1.2.8",
117116
"rxjs": "^6.0.0",
118117
"sass-loader": "~6.0.7",
119118
"semver": "^5.3.0",

packages/schematics/update/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"npm-registry-client": "^8.5.1",
1919
"semver": "^5.3.0",
2020
"semver-intersect": "^1.1.2",
21-
"rc": "^1.2.8",
2221
"rxjs": "^6.0.0"
2322
}
2423
}

packages/schematics/update/update/npm.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,18 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88
import { logging } from '@angular-devkit/core';
9+
import { exec } from 'child_process';
910
import { readFileSync } from 'fs';
1011
import { Observable, ReplaySubject, concat, of } from 'rxjs';
1112
import { concatMap, defaultIfEmpty, filter, first, map, toArray } from 'rxjs/operators';
1213
import * as url from 'url';
1314
import { NpmRepositoryPackageJson } from './npm-package-json';
1415

1516
const RegistryClient = require('npm-registry-client');
16-
const rc = require('rc');
1717

1818
const npmPackageJsonCache = new Map<string, Observable<NpmRepositoryPackageJson>>();
1919
const npmConfigOptionCache = new Map<string, Observable<string | undefined>>();
2020

21-
22-
const npmConfig = rc('npm', {}, {});
23-
2421
function getNpmConfigOption(
2522
option: string,
2623
scope?: string,
@@ -46,15 +43,26 @@ function getNpmConfigOption(
4643

4744
const subject = new ReplaySubject<string | undefined>(1);
4845

49-
const optionValue = npmConfig && npmConfig[fullOption];
50-
if (optionValue == undefined || optionValue == null) {
46+
try {
47+
exec(`npm get ${fullOption}`, (error, data) => {
48+
if (error) {
49+
subject.next();
50+
} else {
51+
data = data.trim();
52+
if (!data || data === 'undefined' || data === 'null') {
53+
subject.next();
54+
} else {
55+
subject.next(data);
56+
}
57+
}
58+
59+
subject.complete();
60+
});
61+
} catch {
5162
subject.next();
52-
} else {
53-
subject.next(optionValue);
63+
subject.complete();
5464
}
5565

56-
subject.complete();
57-
5866
value = subject.asObservable();
5967
npmConfigOptionCache.set(fullOption, value);
6068

0 commit comments

Comments
 (0)