Skip to content

Commit d3649d5

Browse files
committed
fix: Only look for blueprints on generate from our blueprint directory.
Fixes angular#266
1 parent 19774b9 commit d3649d5

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

addon/ng2/commands/generate.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import * as EmberGenerateCommand from 'ember-cli/lib/commands/generate';
2+
import * as fs from 'fs';
3+
import * as path from 'path';
4+
import * as SilentError from 'silent-error';
5+
6+
7+
const GenerateCommand = EmberGenerateCommand.extend({
8+
name: 'generate',
9+
10+
beforeRun: function(rawArgs) {
11+
if (!rawArgs.length) {
12+
return;
13+
}
14+
15+
if (!fs.existsSync(path.join(__dirname, '..', 'blueprints', rawArgs[0]))) {
16+
SilentError.debugOrThrow('angular-cli/commands/generate', `Invalid blueprint: ${rawArgs[0]}`);
17+
}
18+
19+
return EmberGenerateCommand.prototype.beforeRun.apply(this, arguments);
20+
}
21+
});
22+
23+
24+
module.exports = GenerateCommand;
25+
module.exports.overrideCore = true;

addon/ng2/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = {
66
includedCommands: function() {
77
return {
88
'new' : require('./commands/new'),
9+
'generate' : require('./commands/generate'),
910
'init' : require('./commands/init'),
1011
'test' : require('./commands/test'),
1112
'e2e' : require('./commands/e2e'),

0 commit comments

Comments
 (0)