-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@angular/cli): use workspace for architect commands
- Loading branch information
1 parent
5716621
commit 41320bf
Showing
60 changed files
with
565 additions
and
937 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,32 @@ | ||
import { Command, Option } from '../models/command'; | ||
import { runTarget } from '../utilities/architect'; | ||
import { CommandScope, Option } from '../models/command'; | ||
import { ArchitectCommand } from '../models/architect-command'; | ||
|
||
export default class RunCommand extends Command { | ||
export interface RunOptions { | ||
target: string; | ||
} | ||
|
||
export default class RunCommand extends ArchitectCommand { | ||
public readonly name = 'run'; | ||
public readonly description = 'Runs an architect configuration.'; | ||
public readonly arguments: string[] = ['config']; | ||
public readonly options: Option[] = []; | ||
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: any) { | ||
const buildEvent = await runTarget(this.project.root, options.config, options) | ||
.toPromise(); | ||
if (!buildEvent.success) { | ||
throw new Error(''); | ||
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 | ||
}); | ||
} else { | ||
throw new Error('Invalid architect target.'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,28 @@ | ||
import { Command, CommandScope, Option } from '../models/command'; | ||
import { CommandScope, Option } from '../models/command'; | ||
import { ArchitectCommand } from '../models/architect-command'; | ||
|
||
export interface Xi18nOptions { | ||
outputPath?: string; | ||
verbose?: boolean; | ||
i18nFormat?: string; | ||
locale?: string; | ||
outFile?: string; | ||
export interface Options { | ||
project?: string; | ||
configuration?: string; | ||
} | ||
|
||
export default class Xi18nCommand extends Command { | ||
public readonly name = 'xi18n'; | ||
export default class Xi18nCommand extends ArchitectCommand { | ||
public readonly name = 'xi81n'; | ||
public readonly target = 'extract-i18n'; | ||
public readonly description = 'Extracts i18n messages from source code.'; | ||
public static aliases: string[] = []; | ||
public readonly scope = CommandScope.inProject; | ||
public readonly arguments: string[] = []; | ||
public readonly options: Option[] = []; | ||
public readonly options: Option[] = [ | ||
this.configurationOption | ||
]; | ||
|
||
public async run(options: any) { | ||
const {Extracti18nTask} = require('../tasks/extract-i18n'); | ||
|
||
const xi18nTask = new Extracti18nTask({ | ||
ui: this.ui, | ||
project: this.project | ||
public async run(options: Options) { | ||
const overrides = { ...options }; | ||
delete overrides.project; | ||
return this.runArchitectTarget({ | ||
project: options.project, | ||
target: this.target, | ||
configuration: options.configuration, | ||
overrides | ||
}); | ||
|
||
return await xi18nTask.run(options); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.