Skip to content

Commit 3f0e5cb

Browse files
committed
fix(@angular/cli): include deprecated option in JSON help
This option is used to mark deprecated options as such in AIO. (cherry picked from commit a09a2e4)
1 parent 372ceab commit 3f0e5cb

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

packages/angular/cli/models/interface.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ export interface Option {
153153
* If this is falsey, do not report this option.
154154
*/
155155
userAnalytics?: number;
156+
157+
/**
158+
* Deprecation. If this flag is not false a warning will be shown on the console. Either `true`
159+
* or a string to show the user as a notice.
160+
*/
161+
deprecated?: boolean | string;
156162
}
157163

158164
/**

packages/angular/cli/utilities/json-schema.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,11 @@ export async function parseJsonSchemaToOptions(
251251
const xUserAnalytics = current['x-user-analytics'];
252252
const userAnalytics = typeof xUserAnalytics == 'number' ? xUserAnalytics : undefined;
253253

254+
// Deprecated is set only if it's true or a string.
255+
const xDeprecated = current['x-deprecated'];
256+
const deprecated = (xDeprecated === true || typeof xDeprecated === 'string')
257+
? xDeprecated : undefined;
258+
254259
const option: Option = {
255260
name,
256261
description: '' + (current.description === undefined ? '' : current.description),
@@ -262,6 +267,7 @@ export async function parseJsonSchemaToOptions(
262267
...format !== undefined ? { format } : {},
263268
hidden,
264269
...userAnalytics ? { userAnalytics } : {},
270+
...deprecated !== undefined ? { deprecated } : {},
265271
...positional !== undefined ? { positional } : {},
266272
};
267273

0 commit comments

Comments
 (0)