Skip to content

Commit f3d399f

Browse files
committed
chore(commands): override ng destroy
It's common for users to try and do `ng destroy component name` and have it only partially work. Since we don't support the command, it's better to not have it do any partial operations.
1 parent b250cb6 commit f3d399f

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

packages/angular-cli/addon/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ module.exports = {
2222
'serve': require('../commands/serve').default,
2323
'new': require('../commands/new').default,
2424
'generate': require('../commands/generate').default,
25+
'destroy': require('../commands/destroy').default,
2526
'init': require('../commands/init').default,
2627
'test': require('../commands/test').default,
2728
'e2e': require('../commands/e2e').default,
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const Command = require('ember-cli/lib/models/command');
2+
const SilentError = require('silent-error');
3+
4+
5+
const DestroyCommand = Command.extend({
6+
name: 'destroy',
7+
aliases: ['d'],
8+
works: 'insideProject',
9+
10+
anonymousOptions: [
11+
'<blueprint>'
12+
],
13+
14+
run: function() {
15+
return Promise.reject(new SilentError('The destroy command is not supported by Angular-CLI.'));
16+
}
17+
});
18+
19+
export default DestroyCommand;
20+
DestroyCommand.overrideCore = true;

packages/angular-cli/commands/help.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const lookupCommand = require('ember-cli/lib/cli/lookup-command');
77

88
const commandsToIgnore = [
99
'easter-egg',
10+
'destroy',
1011
'github-pages-deploy' // errors because there is no base github-pages command
1112
];
1213

0 commit comments

Comments
 (0)