Thomas Kruse 07e93c0210 fix(@angular/cli): enforce loglevel warn for npm-install
The npm call uses the node exec() call which has a default limit
of 200kb after which the process is terminated.
When the user has set the info loglevel ng new terminates without
any helpful error message. When using --quiet the loglevel is
set to warning in any case resulting in a successful build.
This is especially important for users of docker since the current
node base image sets the loglevel to info.

Close #5010
2017-03-03 16:09:10 +00:00

30 lines
897 B
TypeScript

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;
let packageManager = this.packageManager;
if (packageManager === 'default') {
packageManager = 'npm';
}
return new Promise(function(resolve, reject) {
ui.writeLine(chalk.green(`Installing packages for tooling via ${packageManager}.`));
exec(`${packageManager} --quiet 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 ${packageManager}.`));
resolve();
}
});
});
}
});