mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-16 02:24:10 +08:00
refactor: add allowAdditionalArgs
to be able to bypass extra params validations (#13556)
This commit is contained in:
parent
95dee5a649
commit
71c6cc506e
@ -25,6 +25,7 @@ const npa = require('npm-package-arg');
|
||||
|
||||
export class AddCommand extends SchematicCommand<AddCommandSchema> {
|
||||
readonly allowPrivateSchematics = true;
|
||||
readonly allowAdditionalArgs = true;
|
||||
readonly packageManager = getPackageManager(this.workspace.root);
|
||||
|
||||
async run(options: AddCommandSchema & Arguments) {
|
||||
|
@ -77,6 +77,7 @@ export abstract class SchematicCommand<
|
||||
T extends (BaseSchematicSchema & BaseCommandOptions),
|
||||
> extends Command<T> {
|
||||
readonly allowPrivateSchematics: boolean = false;
|
||||
readonly allowAdditionalArgs: boolean = false;
|
||||
private _host = new NodeJsSyncHost();
|
||||
private _workspace: experimental.workspace.Workspace;
|
||||
private readonly _engine: Engine<FileSystemCollectionDesc, FileSystemSchematicDesc>;
|
||||
@ -438,7 +439,7 @@ export abstract class SchematicCommand<
|
||||
}
|
||||
|
||||
// ng-add is special because we don't know all possible options at this point
|
||||
if (args['--'] && schematicName !== 'ng-add') {
|
||||
if (args['--'] && !this.allowAdditionalArgs) {
|
||||
args['--'].forEach(additional => {
|
||||
this.logger.fatal(`Unknown option: '${additional.split(/=/)[0]}'`);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user