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
  • Loading branch information
clydin committed Nov 16, 2020
1 parent 9280d87 commit aad3bbf
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 @@ -251,6 +251,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 @@ -278,16 +285,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 aad3bbf

Please sign in to comment.