Skip to content

Commit d64a7ef

Browse files
committed
fix(init): fix link and npm install
1 parent 9d255ca commit d64a7ef

File tree

7 files changed

+37
-132
lines changed

7 files changed

+37
-132
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
"less-loader": "^2.2.3",
7979
"lodash": "^4.11.1",
8080
"node-sass": "^3.7.0",
81-
"npm": "3.10.2",
8281
"npm-run-all": "^3.0.0",
8382
"offline-plugin": "^3.4.1",
8483
"opn": "4.0.1",

packages/angular-cli/commands/init.ts

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import LinkCli from '../tasks/link-cli';
2+
import NpmInstall from '../tasks/npm-install';
23

34
const Command = require('ember-cli/lib/models/command');
45
const Promise = require('ember-cli/lib/ext/promise');
56
const SilentError = require('silent-error');
67
const validProjectName = require('ember-cli/lib/utilities/valid-project-name');
78
const normalizeBlueprint = require('ember-cli/lib/utilities/normalize-blueprint-option');
89
const GitInit = require('../tasks/git-init');
9-
const NpmInstall = require('../tasks/npm-install');
1010

1111

1212
const InitCommand: any = Command.extend({
@@ -57,18 +57,18 @@ const InitCommand: any = Command.extend({
5757
});
5858
}
5959

60-
let linkCli: any;
61-
if (commandOptions.linkCli) {
62-
linkCli = new LinkCli({
60+
let npmInstall: any;
61+
if (!commandOptions.skipNpm) {
62+
npmInstall = new NpmInstall({
6363
ui: this.ui,
6464
analytics: this.analytics,
6565
project: this.project
6666
});
6767
}
6868

69-
let npmInstall: any;
70-
if (!commandOptions.skipNpm) {
71-
npmInstall = new NpmInstall({
69+
let linkCli: any;
70+
if (commandOptions.linkCli) {
71+
linkCli = new LinkCli({
7272
ui: this.ui,
7373
analytics: this.analytics,
7474
project: this.project
@@ -121,19 +121,13 @@ const InitCommand: any = Command.extend({
121121
}
122122
}.bind(this))
123123
.then(function () {
124-
if (commandOptions.linkCli) {
125-
return linkCli.run({
126-
verbose: commandOptions.verbose,
127-
optional: false
128-
});
124+
if (!commandOptions.skipNpm) {
125+
return npmInstall.run();
129126
}
130127
})
131128
.then(function () {
132-
if (!commandOptions.skipNpm) {
133-
return npmInstall.run({
134-
verbose: commandOptions.verbose,
135-
optional: false
136-
});
129+
if (commandOptions.linkCli) {
130+
return linkCli.run();
137131
}
138132
})
139133
.then(function () {

packages/angular-cli/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
"less-loader": "^2.2.3",
6060
"lodash": "^4.11.1",
6161
"node-sass": "^3.7.0",
62-
"npm": "3.10.2",
6362
"npm-run-all": "^3.0.0",
6463
"offline-plugin": "^3.4.1",
6564
"opn": "4.0.1",

packages/angular-cli/tasks/npm-install.js

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const Task = require('ember-cli/lib/models/task');
2+
import * as chalk from 'chalk';
3+
import {exec} from 'child_process';
4+
5+
6+
export default Task.extend({
7+
run: function () {
8+
const ui = this.ui;
9+
let exitCode = 0;
10+
11+
return new Promise((resolve) => {
12+
ui.writeLine(chalk.green('Installing packages for tooling via npm.'));
13+
exec(`npm install`,
14+
(err: NodeJS.ErrnoException, stdout: string, stderr: string) => {
15+
if (err) {
16+
ui.writeLine(stderr);
17+
ui.writeLine(chalk.red('Package install failed, see above.'));
18+
exitCode = 1;
19+
} else {
20+
ui.writeLine(chalk.green('Installed packages for tooling via npm.'));
21+
}
22+
resolve(exitCode);
23+
});
24+
});
25+
}
26+
});

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

Lines changed: 0 additions & 64 deletions
This file was deleted.

packages/angular-cli/utilities/npm.js

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)