Skip to content

Commit dd97a7f

Browse files
Broccohansl
authored andcommitted
fix(@angular/cli): Show deprecation warning for get/set commands
fixes #10558
1 parent c139233 commit dd97a7f

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Command, Option } from '../models/command';
2+
3+
export interface Options {
4+
keyword: string;
5+
search?: boolean;
6+
}
7+
8+
export default class GetSetCommand extends Command {
9+
public readonly name = 'getset';
10+
public readonly description = 'Deprecated in favor of config command.';
11+
public readonly arguments: string[] = [];
12+
public readonly options: Option[] = [];
13+
14+
public async run(_options: Options) {
15+
this.logger.warn('get/set have been deprecated in favor of the config command.');
16+
}
17+
}

packages/@angular/cli/lib/cli/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ function loadCommands() {
3333
'help': require('../../commands/help').default,
3434
'version': require('../../commands/version').default,
3535
'doc': require('../../commands/doc').default,
36+
37+
// deprecated
38+
'get': require('../../commands/getset').default,
39+
'set': require('../../commands/getset').default,
3640
};
3741
}
3842

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import {ng} from '../../../utils/process';
2+
3+
4+
export default function() {
5+
const depRegEx = /get\/set have been deprecated in favor of the config command\./;
6+
return Promise.resolve()
7+
.then(() => ng('get'))
8+
.then(({ stdout }) => {
9+
if (!stdout.match(depRegEx)) {
10+
throw new Error(`Expected deprecation warning.`);
11+
}
12+
})
13+
.then(() => ng('set'))
14+
.then(({ stdout }) => {
15+
if (!stdout.match(depRegEx)) {
16+
throw new Error(`Expected deprecation warning.`);
17+
}
18+
});
19+
}

0 commit comments

Comments
 (0)