Skip to content

Commit

Permalink
refactor(@angular/cli): use direct schematic workflow option transfor…
Browse files Browse the repository at this point in the history
…m option

(cherry picked from commit aad3bbf)
  • Loading branch information
clydin committed Nov 16, 2020
1 parent 3839f35 commit fb0be7d
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions packages/angular/cli/models/schematic-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit fb0be7d

Please sign in to comment.