Skip to content

Commit

Permalink
fix(init): fix link and npm install (#2086)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipesilva authored Sep 13, 2016
1 parent c73f53b commit 7a39162
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 139 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ test_script:
- node --version
- npm --version
- npm test
- npm run test:e2e
- node tests\e2e_runner.js

build: off
13 changes: 7 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ env:
matrix:
- SCRIPT=lint
- SCRIPT=build
- SCRIPT=e2e
- SCRIPT=e2e:nightly
- SCRIPT=test
- NODE_SCRIPT=tests/e2e_runner.js
- NODE_SCRIPT="tests/e2e_runner.js --nightly"
# - TARGET=mobile SCRIPT=mobile_test
matrix:
fast_finish: true
allow_failures:
- os: osx
- env: SCRIPT=e2e:nightly
- env: NODE_SCRIPT="tests/e2e_runner.js --nightly"
exclude:
- node_js: "6"
env: SCRIPT=lint
- os: osx
env: SCRIPT=e2e:nightly
env: NODE_SCRIPT="tests/e2e_runner.js --nightly"
- node_js: "6"
env: SCRIPT=e2e:nightly
env: NODE_SCRIPT="tests/e2e_runner.js --nightly"
- os: osx
node_js: "5"
env: SCRIPT=lint
Expand Down Expand Up @@ -57,4 +57,5 @@ install:
- npm install --no-optional

script:
- npm run-script $SCRIPT
- if [[ "$SCRIPT" ]]; then npm run-script $SCRIPT; fi
- if [[ "$NODE_SCRIPT" ]]; then node $NODE_SCRIPT; fi
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
"less-loader": "^2.2.3",
"lodash": "^4.11.1",
"node-sass": "^3.7.0",
"npm": "3.10.2",
"npm-run-all": "^3.0.0",
"offline-plugin": "^3.4.1",
"opn": "4.0.1",
Expand Down
28 changes: 11 additions & 17 deletions packages/angular-cli/commands/init.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import LinkCli from '../tasks/link-cli';
import NpmInstall from '../tasks/npm-install';

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


const InitCommand: any = Command.extend({
Expand Down Expand Up @@ -57,18 +57,18 @@ const InitCommand: any = Command.extend({
});
}

let linkCli: any;
if (commandOptions.linkCli) {
linkCli = new LinkCli({
let npmInstall: any;
if (!commandOptions.skipNpm) {
npmInstall = new NpmInstall({
ui: this.ui,
analytics: this.analytics,
project: this.project
});
}

let npmInstall: any;
if (!commandOptions.skipNpm) {
npmInstall = new NpmInstall({
let linkCli: any;
if (commandOptions.linkCli) {
linkCli = new LinkCli({
ui: this.ui,
analytics: this.analytics,
project: this.project
Expand Down Expand Up @@ -121,19 +121,13 @@ const InitCommand: any = Command.extend({
}
}.bind(this))
.then(function () {
if (commandOptions.linkCli) {
return linkCli.run({
verbose: commandOptions.verbose,
optional: false
});
if (!commandOptions.skipNpm) {
return npmInstall.run();
}
})
.then(function () {
if (!commandOptions.skipNpm) {
return npmInstall.run({
verbose: commandOptions.verbose,
optional: false
});
if (commandOptions.linkCli) {
return linkCli.run();
}
})
.then(function () {
Expand Down
1 change: 0 additions & 1 deletion packages/angular-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"less-loader": "^2.2.3",
"lodash": "^4.11.1",
"node-sass": "^3.7.0",
"npm": "3.10.2",
"npm-run-all": "^3.0.0",
"offline-plugin": "^3.4.1",
"opn": "4.0.1",
Expand Down
11 changes: 0 additions & 11 deletions packages/angular-cli/tasks/npm-install.js

This file was deleted.

25 changes: 25 additions & 0 deletions packages/angular-cli/tasks/npm-install.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const Task = require('ember-cli/lib/models/task');
import * as chalk from 'chalk';
import {exec} from 'child_process';


export default Task.extend({
run: function() {
const ui = this.ui;

return new Promise(function(resolve, reject) {
ui.writeLine(chalk.green('Installing packages for tooling via npm.'));
exec('npm install',
(err: NodeJS.ErrnoException, stdout: string, stderr: string) => {
if (err) {
ui.writeLine(stderr);
ui.writeLine(chalk.red('Package install failed, see above.'));
reject();
} else {
ui.writeLine(chalk.green('Installed packages for tooling via npm.'));
resolve();
}
});
});
}
});
64 changes: 0 additions & 64 deletions packages/angular-cli/tasks/npm-task.js

This file was deleted.

38 changes: 0 additions & 38 deletions packages/angular-cli/utilities/npm.js

This file was deleted.

0 comments on commit 7a39162

Please sign in to comment.