File tree 2 files changed +14
-3
lines changed
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { ArchitectCommand } from '../models/architect-command' ;
2
2
import { Option , CommandScope } from '../models/command' ;
3
3
import { Version } from '../upgrade/version' ;
4
+ import { experimental } from '@angular-devkit/core' ;
4
5
5
6
export interface Options {
6
7
project ?: string ;
7
8
configuration ?: string ;
9
+ projectType ?: string ;
8
10
prod : boolean ;
9
11
}
10
12
13
+
11
14
export default class BuildCommand extends ArchitectCommand {
12
15
public readonly name = 'build' ;
13
16
public readonly target = 'build' ;
@@ -38,9 +41,13 @@ export default class BuildCommand extends ArchitectCommand {
38
41
delete overrides . configuration ;
39
42
delete overrides . prod ;
40
43
44
+ const filter : experimental . workspace . projectFilter = options . projectType
45
+ && ( ( project ) => project . projectType === options . projectType ) ;
46
+
41
47
return this . runArchitectTarget ( {
42
48
project : options . project ,
43
49
target : this . target ,
50
+ projectFilter : filter ,
44
51
configuration,
45
52
overrides
46
53
} , options ) ;
Original file line number Diff line number Diff line change @@ -164,7 +164,9 @@ export abstract class ArchitectCommand<T = any> extends Command<T> {
164
164
if ( ! targetSpec . project && this . target ) {
165
165
// This runs each target sequentially.
166
166
// Running them in parallel would jumble the log messages.
167
- return await from ( this . getAllProjectsForTargetName ( this . target ) ) . pipe (
167
+ return await from (
168
+ this . getAllProjectsForTargetName ( this . target , targetSpec . projectFilter )
169
+ ) . pipe (
168
170
concatMap ( project => runSingleTarget ( { ...targetSpec , project } ) ) ,
169
171
toArray ( ) ,
170
172
) . toPromise ( ) . then ( results => results . every ( res => res === 0 ) ? 0 : 1 ) ;
@@ -197,8 +199,10 @@ export abstract class ArchitectCommand<T = any> extends Command<T> {
197
199
}
198
200
}
199
201
200
- private getAllProjectsForTargetName ( targetName : string ) {
201
- return this . _workspace . listProjectNames ( ) . map ( projectName =>
202
+ private getAllProjectsForTargetName (
203
+ targetName : string , filter ?: experimental . workspace . projectFilter
204
+ ) {
205
+ return this . _workspace . listProjectNames ( filter ) . map ( projectName =>
202
206
this . _architect . listProjectTargets ( projectName ) . includes ( targetName ) ? projectName : null
203
207
) . filter ( x => ! ! x ) ;
204
208
}
You can’t perform that action at this time.
0 commit comments