Skip to content

Commit ebc9cc3

Browse files
committed
refactor: load npm config lazily and add the --global flag
the `--global` flag makes this work in workspaces where NPM would otherwise print an error that it's not supported.
1 parent db47ffc commit ebc9cc3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/services/npm-config-service.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,16 @@ import { cache } from "../common/decorators";
77
export class NpmConfigService implements INpmConfigService {
88
private config: IDictionary<any> = {};
99

10-
constructor() {
10+
public getConfig(): IDictionary<any> {
1111
this.readConfig();
12-
}
1312

14-
public getConfig(): IDictionary<any> {
1513
return this.config;
1614
}
1715

1816
@cache()
1917
private readConfig(): void {
2018
try {
21-
const res = execSync("npm config list --json");
19+
const res = execSync("npm config list --json --global");
2220
// const data: any = npmconfig.read();
2321
const data: Record<string, any> = JSON.parse(res.toString());
2422

0 commit comments

Comments
 (0)