Skip to content

Commit 7a39162

Browse files
authored
fix(init): fix link and npm install (#2086)
1 parent c73f53b commit 7a39162

File tree

9 files changed

+44
-139
lines changed

9 files changed

+44
-139
lines changed

.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ test_script:
1414
- node --version
1515
- npm --version
1616
- npm test
17-
- npm run test:e2e
17+
- node tests\e2e_runner.js
1818

1919
build: off

.travis.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ env:
1313
matrix:
1414
- SCRIPT=lint
1515
- SCRIPT=build
16-
- SCRIPT=e2e
17-
- SCRIPT=e2e:nightly
1816
- SCRIPT=test
17+
- NODE_SCRIPT=tests/e2e_runner.js
18+
- NODE_SCRIPT="tests/e2e_runner.js --nightly"
1919
# - TARGET=mobile SCRIPT=mobile_test
2020
matrix:
2121
fast_finish: true
2222
allow_failures:
2323
- os: osx
24-
- env: SCRIPT=e2e:nightly
24+
- env: NODE_SCRIPT="tests/e2e_runner.js --nightly"
2525
exclude:
2626
- node_js: "6"
2727
env: SCRIPT=lint
2828
- os: osx
29-
env: SCRIPT=e2e:nightly
29+
env: NODE_SCRIPT="tests/e2e_runner.js --nightly"
3030
- node_js: "6"
31-
env: SCRIPT=e2e:nightly
31+
env: NODE_SCRIPT="tests/e2e_runner.js --nightly"
3232
- os: osx
3333
node_js: "5"
3434
env: SCRIPT=lint
@@ -57,4 +57,5 @@ install:
5757
- npm install --no-optional
5858

5959
script:
60-
- npm run-script $SCRIPT
60+
- if [[ "$SCRIPT" ]]; then npm run-script $SCRIPT; fi
61+
- if [[ "$NODE_SCRIPT" ]]; then node $NODE_SCRIPT; fi

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: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
10+
return new Promise(function(resolve, reject) {
11+
ui.writeLine(chalk.green('Installing packages for tooling via npm.'));
12+
exec('npm install',
13+
(err: NodeJS.ErrnoException, stdout: string, stderr: string) => {
14+
if (err) {
15+
ui.writeLine(stderr);
16+
ui.writeLine(chalk.red('Package install failed, see above.'));
17+
reject();
18+
} else {
19+
ui.writeLine(chalk.green('Installed packages for tooling via npm.'));
20+
resolve();
21+
}
22+
});
23+
});
24+
}
25+
});

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)