Skip to content

Commit 3d61a48

Browse files
author
eruan
committed
chore(new): by default, use cnpm if installed
1 parent 4ee90cd commit 3d61a48

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/angular-cli/ember-cli/lib/tasks/npm-task.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,17 @@ module.exports = Task.extend({
3838
// npm otherwise is otherwise noisy, already submitted PR for npm to fix
3939
// misplaced console.log
4040
this.disableLogger();
41-
return spawn('npm', [this.command].concat(packages, npmOptions)).
41+
42+
// by default, use cnpm if installed
43+
var strNPM = 'cnpm';
44+
try {
45+
console.log(require.resolve("cnpm"));
46+
} catch(e) {
47+
console.error("Cnpm is not found");
48+
strNPM = 'npm';
49+
}
50+
51+
return spawn(strNPM, [this.command].concat(packages, npmOptions)).
4252
// return npm(this.command, packages, npmOptions, this.npm).
4353
finally(this.finally.bind(this)).
4454
then(this.announceCompletion.bind(this));

0 commit comments

Comments
 (0)