@@ -135,45 +135,47 @@ export abstract class ArchitectCommand<
135135 return await this . runArchitectTarget ( options ) ;
136136 }
137137
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+
138161 protected async runArchitectTarget (
139162 options : ArchitectCommandOptions & Arguments ,
140163 ) : 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 [ '--' ] || [ ] ;
163165
164166 try {
165167 const targetSpec = this . _makeTargetSpecifier ( options ) ;
166168 if ( ! targetSpec . project && this . target ) {
167169 // This runs each target sequentially.
168170 // Running them in parallel would jumble the log messages.
169171 return await from ( this . getProjectNamesByTarget ( this . target ) ) . pipe (
170- concatMap ( project => from ( runSingleTarget ( { ...targetSpec , project } ) ) ) ,
172+ concatMap ( project => from ( this . runSingleTarget ( { ...targetSpec , project } , extra ) ) ) ,
171173 toArray ( ) ,
172174 map ( results => results . every ( res => res === 0 ) ? 0 : 1 ) ,
173175 )
174176 . toPromise ( ) ;
175177 } else {
176- return await runSingleTarget ( targetSpec ) ;
178+ return await this . runSingleTarget ( targetSpec , extra ) ;
177179 }
178180 } catch ( e ) {
179181 if ( e instanceof schema . SchemaValidationException ) {
0 commit comments