|
2 | 2 |
|
3 | 3 | // This file hooks up on require calls to transpile TypeScript.
|
4 | 4 | const cli = require('ember-cli/lib/cli');
|
| 5 | +const UI = require('ember-cli/lib/ui'); |
5 | 6 | const path = require('path');
|
6 | 7 |
|
7 | 8 | Error.stackTraceLimit = Infinity;
|
8 | 9 |
|
9 | 10 | module.exports = function(options) {
|
10 |
| - const oldStdoutWrite = process.stdout.write; |
11 |
| - process.stdout.write = function (line) { |
12 |
| - line = line.toString(); |
13 |
| - if (line.match(/version:|WARNING:/)) { |
14 |
| - return; |
15 |
| - } |
16 |
| - if (line.match(/ember-cli-(inject-)?live-reload/)) { |
17 |
| - // don't replace 'ember-cli-live-reload' on ng init diffs |
18 |
| - return oldStdoutWrite.apply(process.stdout, arguments); |
19 |
| - } |
20 |
| - line = line.replace(/ember-cli(?!.com)/g, 'angular-cli') |
21 |
| - .replace(/\bember\b(?!-cli.com)/g, 'ng'); |
22 |
| - return oldStdoutWrite.apply(process.stdout, arguments); |
23 |
| - }; |
24 | 11 |
|
25 |
| - const oldStderrWrite = process.stderr.write; |
26 |
| - process.stderr.write = function (line) { |
27 |
| - line = line.toString() |
28 |
| - .replace(/ember-cli(?!.com)/g, 'angular-cli') |
29 |
| - .replace(/\bember\b(?!-cli.com)/g, 'ng'); |
30 |
| - return oldStderrWrite.apply(process.stdout, arguments); |
| 12 | + // patch UI to assume DEFAULT_WRITE_LEVEL='ERROR' |
| 13 | + // this will remove most Ember-CLI specific warnings (which don't apply to Angular-CLI) |
| 14 | + UI.prototype.writeLevelVisible = function(writeLevel) { |
| 15 | + var levels = this.WRITE_LEVELS; |
| 16 | + writeLevel = writeLevel || 'ERROR'; |
| 17 | + return levels[writeLevel] >= levels['ERROR']; |
31 | 18 | };
|
32 | 19 |
|
33 | 20 | options.cli = {
|
34 | 21 | name: 'ng',
|
35 | 22 | root: path.join(__dirname, '..', '..'),
|
36 |
| - npmPackage: 'angular-cli' |
| 23 | + npmPackage: 'angular-cli', |
| 24 | + ui: UI |
37 | 25 | };
|
38 | 26 |
|
39 | 27 | // ensure the environemnt variable for dynamic paths
|
40 | 28 | process.env.PWD = process.env.PWD || process.cwd();
|
41 |
| - |
42 |
| - |
43 | 29 | process.env.CLI_ROOT = process.env.CLI_ROOT || path.resolve(__dirname, '..', '..');
|
44 | 30 |
|
45 | 31 | return cli(options);
|
|
0 commit comments