Skip to content

Commit

Permalink
fix(@angular/cli): show deprecated workspace config options in IDE
Browse files Browse the repository at this point in the history
With this change deprecated options in angular.json will be visible in the IDE.

(cherry picked from commit 93ba050)
  • Loading branch information
alan-agius4 authored and clydin committed Jun 30, 2022
1 parent 6969c02 commit e5e07ff
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions tools/ng_cli_schema_generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ function generate(inPath, outPath) {
throw new Error(`Error while resolving $ref ${value} in ${nestedSchemaPath}.`);
}
case '$id':
case '$id':
case '$schema':
case 'id':
case '$schema':
case 'required':
case 'x-prompt':
case 'x-user-analytics':
return undefined;
default:
return value;
Expand All @@ -69,7 +70,22 @@ function generate(inPath, outPath) {
outPath = resolve(buildWorkspaceDirectory, outPath);

mkdirSync(dirname(outPath), { recursive: true });
writeFileSync(outPath, JSON.stringify(schemaParsed, undefined, 2));
writeFileSync(
outPath,
JSON.stringify(
schemaParsed,
(key, value) => {
if (key === 'x-deprecated') {
// Needed for IDEs, and will be replaced to 'deprecated' later on. This must be a boolean.
// https://json-schema.org/draft/2020-12/json-schema-validation.html#name-deprecated
return !!value;
}

return value;
},
2,
).replace(/"x-deprecated"/g, '"deprecated"'),
);
}

if (require.main === module) {
Expand Down

0 comments on commit e5e07ff

Please sign in to comment.