forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.ts
59 lines (47 loc) · 2.07 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// TODO: remove this commented AJV require.
// We don't actually require AJV, but there is a bug with NPM and peer dependencies that is
// whose workaround is to depend on AJV.
// See https://github.com/angular/angular-cli/issues/9691#issuecomment-367322703 for details.
// We need to add a require here to satisfy the dependency checker.
// require('ajv');
import * as path from 'path';
const cli = require('../../ember-cli/lib/cli');
const UI = require('../../ember-cli/lib/ui');
function loadCommands() {
return {
'build': require('../../commands/build').default,
'serve': require('../../commands/serve').default,
'eject': require('../../commands/eject').default,
'new': require('../../commands/new').default,
'generate': require('../../commands/generate').default,
'destroy': require('../../commands/destroy').default,
'test': require('../../commands/test').default,
'e2e': require('../../commands/e2e').default,
'help': require('../../commands/help').default,
'lint': require('../../commands/lint').default,
'version': require('../../commands/version').default,
'completion': require('../../commands/completion').default,
'doc': require('../../commands/doc').default,
'xi18n': require('../../commands/xi18n').default,
'update': require('../../commands/update').default,
// Easter eggs.
'make-this-awesome': require('../../commands/easter-egg').default,
// Configuration.
'set': require('../../commands/set').default,
'get': require('../../commands/get').default
};
}
export default function(options: any) {
// patch UI to not print Ember-CLI warnings (which don't apply to Angular CLI)
UI.prototype.writeWarnLine = function () { };
options.cli = {
name: 'ng',
root: path.join(__dirname, '..', '..'),
npmPackage: '@angular/cli'
};
options.commands = loadCommands();
// ensure the environemnt variable for dynamic paths
process.env.PWD = path.normalize(process.env.PWD || process.cwd());
process.env.CLI_ROOT = process.env.CLI_ROOT || path.resolve(__dirname, '..', '..');
return cli(options);
}