From fb0be7d304cd5ecec1c4c4cbc47b133193cdcd9b Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Fri, 13 Nov 2020 16:05:31 -0500 Subject: [PATCH] refactor(@angular/cli): use direct schematic workflow option transform option (cherry picked from commit aad3bbf0c11ed9b96d9097e6fc3478396ad02ced) --- .../angular/cli/models/schematic-command.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/angular/cli/models/schematic-command.ts b/packages/angular/cli/models/schematic-command.ts index 677362609e69..aa04c10dfb5f 100644 --- a/packages/angular/cli/models/schematic-command.ts +++ b/packages/angular/cli/models/schematic-command.ts @@ -257,6 +257,13 @@ export abstract class SchematicCommand< // Global : [__dirname, process.cwd()], schemaValidation: true, + optionTransforms: [ + // Add configuration file defaults + async (schematic, current) => ({ + ...(await getSchematicDefaults(schematic.collection.name, schematic.name, getProjectName())), + ...current, + }), + ], }); const getProjectName = () => { @@ -284,16 +291,6 @@ export abstract class SchematicCommand< return undefined; }; - const defaultOptionTransform = async ( - schematic: FileSystemSchematicDescription, - current: {}, - ) => ({ - ...(await getSchematicDefaults(schematic.collection.name, schematic.name, getProjectName())), - ...current, - }); - - workflow.engineHost.registerOptionsTransform(defaultOptionTransform); - workflow.registry.addPostTransform(schema.transforms.addUndefinedDefaults); workflow.registry.addSmartDefaultProvider('projectName', getProjectName); workflow.registry.useXDeprecatedProvider(msg => this.logger.warn(msg));