mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-18 11:44:05 +08:00
33 lines
923 B
TypeScript
33 lines
923 B
TypeScript
import { CommandScope, Option } from '../models/command';
|
|
import { ArchitectCommand } from '../models/architect-command';
|
|
|
|
export interface RunOptions {
|
|
target: string;
|
|
}
|
|
|
|
export default class RunCommand extends ArchitectCommand {
|
|
public readonly name = 'run';
|
|
public readonly description = 'Runs Architect targets.';
|
|
public readonly scope = CommandScope.inProject;
|
|
public readonly arguments: string[] = ['target'];
|
|
public readonly options: Option[] = [
|
|
this.configurationOption
|
|
];
|
|
|
|
public async run(options: RunOptions) {
|
|
if (options.target) {
|
|
const [project, target, configuration] = options.target.split(':');
|
|
const overrides = { ...options };
|
|
delete overrides.target;
|
|
return this.runArchitectTarget({
|
|
project,
|
|
target,
|
|
configuration,
|
|
overrides
|
|
}, options);
|
|
} else {
|
|
throw new Error('Invalid architect target.');
|
|
}
|
|
}
|
|
}
|