Skip to content

Commit

Permalink
fix(@angular/cli): include deprecated option in JSON help
Browse files Browse the repository at this point in the history
This option is used to mark deprecated options as such in AIO.

(cherry picked from commit a09a2e4)
  • Loading branch information
alan-agius4 committed Oct 20, 2020
1 parent 372ceab commit 3f0e5cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/angular/cli/models/interface.ts
Expand Up @@ -153,6 +153,12 @@ export interface Option {
* If this is falsey, do not report this option.
*/
userAnalytics?: number;

/**
* Deprecation. If this flag is not false a warning will be shown on the console. Either `true`
* or a string to show the user as a notice.
*/
deprecated?: boolean | string;
}

/**
Expand Down
6 changes: 6 additions & 0 deletions packages/angular/cli/utilities/json-schema.ts
Expand Up @@ -251,6 +251,11 @@ export async function parseJsonSchemaToOptions(
const xUserAnalytics = current['x-user-analytics'];
const userAnalytics = typeof xUserAnalytics == 'number' ? xUserAnalytics : undefined;

// Deprecated is set only if it's true or a string.
const xDeprecated = current['x-deprecated'];
const deprecated = (xDeprecated === true || typeof xDeprecated === 'string')
? xDeprecated : undefined;

const option: Option = {
name,
description: '' + (current.description === undefined ? '' : current.description),
Expand All @@ -262,6 +267,7 @@ export async function parseJsonSchemaToOptions(
...format !== undefined ? { format } : {},
hidden,
...userAnalytics ? { userAnalytics } : {},
...deprecated !== undefined ? { deprecated } : {},
...positional !== undefined ? { positional } : {},
};

Expand Down

0 comments on commit 3f0e5cb

Please sign in to comment.