Skip to content

Commit f2b8f43

Browse files
mansonakategengler
authored andcommitted
fixing npm@5 and npm@6 by only running npm prune on npm@4
1 parent 58a0a3b commit f2b8f43

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

  • lib/dependency-manager-adapters

lib/dependency-manager-adapters/npm.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,15 @@ module.exports = CoreObject.extend({
104104

105105
return this.run(cmd, [].concat(['install'], mgrOptions), { cwd: this.cwd }).then(() => {
106106
if (!adapter.useYarnCommand) {
107-
return adapter.run(adapter.configKey, ['prune'], { cwd: adapter.cwd });
107+
return adapter.run('npm', ['--version'], { cwd: this.cwd, stdio: 'pipe' }).then((res) => {
108+
let version = res.stdout;
109+
if (version.match(/^4./)) {
110+
debug('Running npm prune because version is %s', version);
111+
return adapter.run(adapter.configKey, ['prune'], { cwd: adapter.cwd });
112+
}
113+
114+
debug('Not running npm prune because version is %s', version);
115+
})
108116
}
109117
});
110118
},

0 commit comments

Comments
 (0)