Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 96d2a16

Browse files
Charles Lydingfilipesilva
Charles Lyding
authored andcommitted
refactor(@angular/cli): simplify command registration
1 parent 572351d commit 96d2a16

File tree

7 files changed

+31
-303
lines changed

7 files changed

+31
-303
lines changed

‎package.json‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@
100100
"webpack-merge": "^2.4.0",
101101
"zone.js": "^0.8.4"
102102
},
103-
"ember-addon": {
104-
"paths": [
105-
"./packages/@angular/cli/lib/addon"
106-
]
107-
},
108103
"devDependencies": {
109104
"@angular/compiler": "^4.0.0",
110105
"@angular/compiler-cli": "^4.0.0",

‎packages/@angular/cli/addon/index.js‎

Lines changed: 0 additions & 38 deletions
This file was deleted.

‎packages/@angular/cli/ember-cli/lib/cli/index.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ module.exports = function(options) {
3838
var project = Project.projectOrnullProject(ui, cli);
3939

4040
var environment = {
41-
tasks: {},
41+
tasks: options.tasks||{},
4242
cliArgs: options.cliArgs,
43-
commands: {},
43+
commands: options.commands||{},
4444
project: project,
4545
settings: defaultUpdateCheckerOptions
4646
};

‎packages/@angular/cli/ember-cli/lib/models/addon.js‎

Lines changed: 0 additions & 239 deletions
This file was deleted.

‎packages/@angular/cli/ember-cli/lib/models/project.js‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -260,17 +260,6 @@ Project.prototype.initializeAddons = function() {
260260
this._addonsInitialized = true;
261261

262262
debug('initializeAddons for: %s', this.name());
263-
264-
const cliPkg = require(path.resolve(__dirname, '../../../package.json'));
265-
const Addon = require('../models/addon');
266-
const Constructor = Addon.lookup({
267-
name: '@angular/cli',
268-
path: path.join(__dirname, '../../../'),
269-
pkg: cliPkg,
270-
});
271-
272-
const addon = new Constructor(this.addonParent, this);
273-
this.addons = [addon];
274263
};
275264

276265
/**
@@ -334,7 +323,7 @@ Project.prototype.eachAddonCommand = function(callback) {
334323
@return {String} Path to blueprints
335324
*/
336325
Project.prototype.localBlueprintLookupPath = function() {
337-
return path.join(this.root, 'blueprints');
326+
return path.join(this.cli.root, 'blueprints');
338327
};
339328

340329
/**
@@ -345,7 +334,7 @@ Project.prototype.localBlueprintLookupPath = function() {
345334
@return {Array} List of paths
346335
*/
347336
Project.prototype.blueprintLookupPaths = function() {
348-
return this.addonBlueprintLookupPaths();
337+
return [this.localBlueprintLookupPath()];
349338
};
350339

351340
/**

‎packages/@angular/cli/lib/cli/index.js‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,31 @@ const cli = require('../../ember-cli/lib/cli');
1010
const UI = require('../../ember-cli/lib/ui');
1111
const path = require('path');
1212

13+
function loadCommands() {
14+
return {
15+
'build': require('../../commands/build').default,
16+
'serve': require('../../commands/serve').default,
17+
'eject': require('../../commands/eject').default,
18+
'new': require('../../commands/new').default,
19+
'generate': require('../../commands/generate').default,
20+
'destroy': require('../../commands/destroy').default,
21+
'test': require('../../commands/test').default,
22+
'e2e': require('../../commands/e2e').default,
23+
'help': require('../../commands/help').default,
24+
'lint': require('../../commands/lint').default,
25+
'version': require('../../commands/version').default,
26+
'completion': require('../../commands/completion').default,
27+
'doc': require('../../commands/doc').default,
28+
'xi18n': require('../../commands/xi18n').default,
29+
30+
// Easter eggs.
31+
'make-this-awesome': require('../../commands/easter-egg').default,
32+
33+
// Configuration.
34+
'set': require('../../commands/set').default,
35+
'get': require('../../commands/get').default
36+
};
37+
}
1338

1439
module.exports = function(options) {
1540

@@ -22,6 +47,8 @@ module.exports = function(options) {
2247
npmPackage: '@angular/cli'
2348
};
2449

50+
options.commands = loadCommands();
51+
2552
// ensure the environemnt variable for dynamic paths
2653
process.env.PWD = path.normalize(process.env.PWD || process.cwd());
2754
process.env.CLI_ROOT = process.env.CLI_ROOT || path.resolve(__dirname, '..', '..');

‎packages/@angular/cli/package.json‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,5 @@
8787
},
8888
"optionalDependencies": {
8989
"node-sass": "^4.3.0"
90-
},
91-
"ember-addon": {
92-
"paths": [
93-
"./"
94-
],
95-
"main": "./addon/index.js"
9690
}
9791
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /