@@ -135,45 +135,47 @@ export abstract class ArchitectCommand<
135
135
return await this . runArchitectTarget ( options ) ;
136
136
}
137
137
138
+ protected async runSingleTarget ( targetSpec : TargetSpecifier , options : string [ ] ) {
139
+ // We need to build the builderSpec twice because architect does not understand
140
+ // overrides separately (getting the configuration builds the whole project, including
141
+ // overrides).
142
+ const builderConf = this . _architect . getBuilderConfiguration ( targetSpec ) ;
143
+ const builderDesc = await this . _architect . getBuilderDescription ( builderConf ) . toPromise ( ) ;
144
+ const targetOptionArray = await parseJsonSchemaToOptions ( this . _registry , builderDesc . schema ) ;
145
+ const overrides = parseArguments ( options , targetOptionArray ) ;
146
+
147
+ if ( overrides [ '--' ] ) {
148
+ ( overrides [ '--' ] || [ ] ) . forEach ( additional => {
149
+ this . logger . warn ( `Unknown option: '${ additional . split ( / = / ) [ 0 ] } '` ) ;
150
+ } ) ;
151
+
152
+ return 1 ;
153
+ }
154
+ const realBuilderConf = this . _architect . getBuilderConfiguration ( { ...targetSpec , overrides } ) ;
155
+
156
+ return this . _architect . run ( realBuilderConf , { logger : this . _logger } ) . pipe (
157
+ map ( ( buildEvent : BuildEvent ) => buildEvent . success ? 0 : 1 ) ,
158
+ ) . toPromise ( ) ;
159
+ }
160
+
138
161
protected async runArchitectTarget (
139
162
options : ArchitectCommandOptions & Arguments ,
140
163
) : Promise < number > {
141
- const runSingleTarget = async ( targetSpec : TargetSpecifier ) => {
142
- // We need to build the builderSpec twice because architect does not understand
143
- // overrides separately (getting the configuration builds the whole project, including
144
- // overrides).
145
- const builderConf = this . _architect . getBuilderConfiguration ( targetSpec ) ;
146
- const builderDesc = await this . _architect . getBuilderDescription ( builderConf ) . toPromise ( ) ;
147
- const targetOptionArray = await parseJsonSchemaToOptions ( this . _registry , builderDesc . schema ) ;
148
- const overrides = parseArguments ( options [ '--' ] || [ ] , targetOptionArray ) ;
149
-
150
- if ( overrides [ '--' ] ) {
151
- ( overrides [ '--' ] || [ ] ) . forEach ( additional => {
152
- this . logger . warn ( `Unknown option: '${ additional . split ( / = / ) [ 0 ] } '` ) ;
153
- } ) ;
154
-
155
- return 1 ;
156
- }
157
- const realBuilderConf = this . _architect . getBuilderConfiguration ( { ...targetSpec , overrides } ) ;
158
-
159
- return this . _architect . run ( realBuilderConf , { logger : this . _logger } ) . pipe (
160
- map ( ( buildEvent : BuildEvent ) => buildEvent . success ? 0 : 1 ) ,
161
- ) . toPromise ( ) ;
162
- } ;
164
+ const extra = options [ '--' ] || [ ] ;
163
165
164
166
try {
165
167
const targetSpec = this . _makeTargetSpecifier ( options ) ;
166
168
if ( ! targetSpec . project && this . target ) {
167
169
// This runs each target sequentially.
168
170
// Running them in parallel would jumble the log messages.
169
171
return await from ( this . getProjectNamesByTarget ( this . target ) ) . pipe (
170
- concatMap ( project => from ( runSingleTarget ( { ...targetSpec , project } ) ) ) ,
172
+ concatMap ( project => from ( this . runSingleTarget ( { ...targetSpec , project } , extra ) ) ) ,
171
173
toArray ( ) ,
172
174
map ( results => results . every ( res => res === 0 ) ? 0 : 1 ) ,
173
175
)
174
176
. toPromise ( ) ;
175
177
} else {
176
- return await runSingleTarget ( targetSpec ) ;
178
+ return await this . runSingleTarget ( targetSpec , extra ) ;
177
179
}
178
180
} catch ( e ) {
179
181
if ( e instanceof schema . SchemaValidationException ) {
0 commit comments