Skip to content

Commit 71c6cc5

Browse files
alan-agius4vikerman
authored andcommitted
refactor: add allowAdditionalArgs to be able to bypass extra params validations (angular#13556)
1 parent 95dee5a commit 71c6cc5

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

packages/angular/cli/commands/add-impl.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const npa = require('npm-package-arg');
2525

2626
export class AddCommand extends SchematicCommand<AddCommandSchema> {
2727
readonly allowPrivateSchematics = true;
28+
readonly allowAdditionalArgs = true;
2829
readonly packageManager = getPackageManager(this.workspace.root);
2930

3031
async run(options: AddCommandSchema & Arguments) {

packages/angular/cli/models/schematic-command.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export abstract class SchematicCommand<
7777
T extends (BaseSchematicSchema & BaseCommandOptions),
7878
> extends Command<T> {
7979
readonly allowPrivateSchematics: boolean = false;
80+
readonly allowAdditionalArgs: boolean = false;
8081
private _host = new NodeJsSyncHost();
8182
private _workspace: experimental.workspace.Workspace;
8283
private readonly _engine: Engine<FileSystemCollectionDesc, FileSystemSchematicDesc>;
@@ -438,7 +439,7 @@ export abstract class SchematicCommand<
438439
}
439440

440441
// ng-add is special because we don't know all possible options at this point
441-
if (args['--'] && schematicName !== 'ng-add') {
442+
if (args['--'] && !this.allowAdditionalArgs) {
442443
args['--'].forEach(additional => {
443444
this.logger.fatal(`Unknown option: '${additional.split(/=/)[0]}'`);
444445
});

0 commit comments

Comments
 (0)