added function to determine bad npm versions
This commit is contained in:
parent
b5501e6127
commit
f39481ab98
1 changed files with 17 additions and 0 deletions
17
src/npm.ts
17
src/npm.ts
|
@ -15,3 +15,20 @@ export function getDependencies(cwd: string): Promise<string[]> {
|
|||
);
|
||||
});
|
||||
}
|
||||
|
||||
const versionCmd = 'npm -v';
|
||||
|
||||
const badNpmVersions = [
|
||||
/3.7.[0123]/
|
||||
];
|
||||
|
||||
export function isBadNpmVersion(): Promise<boolean> {
|
||||
return new Promise<boolean>((c, e) => {
|
||||
cp.exec(versionCmd, (err, stdout, stderr) => {
|
||||
if (err) return e(err);
|
||||
|
||||
let version = stdout.toString('utf8').trim();
|
||||
c(badNpmVersions.some((regex) => regex.test(version)));
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Add table
Reference in a new issue