diff --git a/src/npm.ts b/src/npm.ts index abe14e9..f38770f 100644 --- a/src/npm.ts +++ b/src/npm.ts @@ -14,4 +14,21 @@ export function getDependencies(cwd: string): Promise { } ); }); +} + +const versionCmd = 'npm -v'; + +const badNpmVersions = [ + /3.7.[0123]/ +]; + +export function isBadNpmVersion(): Promise { + return new Promise((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))); + }); + }); } \ No newline at end of file