@@ -6,14 +6,14 @@ export default async function runExecutor(options: BuildBuilderSchema, context:
66 return new Promise ( ( resolve , reject ) => {
77 const projectConfig = context . workspace . projects [ context . projectName ] ;
88 // determine if running or building only
9- const isBuild = process . argv . find ( ( a ) => a === 'build' || a . endsWith ( " :build" ) ) ;
9+ const isBuild = process . argv . find ( ( a ) => a === 'build' || a . endsWith ( ' :build' ) ) ;
1010 if ( isBuild ) {
1111 // allow build options to override run target options
1212 const buildTarget = projectConfig . targets [ 'build' ] ;
1313 if ( buildTarget && buildTarget . options ) {
1414 options = {
1515 ...options ,
16- ...buildTarget . options
16+ ...buildTarget . options ,
1717 } ;
1818 }
1919 }
@@ -26,18 +26,13 @@ export default async function runExecutor(options: BuildBuilderSchema, context:
2626
2727 let targetConfigName = '' ;
2828 if ( context . configurationName && context . configurationName !== 'build' ) {
29- targetConfigName = context . configurationName ;
29+ targetConfigName = context . configurationName ;
3030 }
3131
3232 // determine if any trailing args that need to be added to run/build command
3333 const configTarget = targetConfigName ? `:${ targetConfigName } ` : '' ;
3434 const projectTargetCmd = `${ context . projectName } :${ context . targetName } ${ configTarget } ` ;
35- const projectTargetCmdIndex = process . argv . findIndex ( c => c === projectTargetCmd ) ;
36- // const additionalCliFlagArgs = [];
37- // if (process.argv.length > projectTargetCmdIndex+1) {
38- // additionalCliFlagArgs.push(...process.argv.slice(projectTargetCmdIndex+1, process.argv.length));
39- // // console.log('additionalCliFlagArgs:', additionalCliFlagArgs);
40- // }
35+ const projectTargetCmdIndex = process . argv . findIndex ( ( c ) => c === projectTargetCmd ) ;
4136
4237 const fileReplacements : Array < string > = [ ] ;
4338 let configOptions ;
@@ -51,7 +46,7 @@ export default async function runExecutor(options: BuildBuilderSchema, context:
5146 if ( targetBuildConfig ) {
5247 options = {
5348 ...options ,
54- ...targetBuildConfig
49+ ...targetBuildConfig ,
5550 } ;
5651 }
5752 }
@@ -132,7 +127,7 @@ export default async function runExecutor(options: BuildBuilderSchema, context:
132127 nsOptions . push ( '--release' ) ;
133128 }
134129 if ( options . aab ) {
135- nsOptions . push ( '--aab' )
130+ nsOptions . push ( '--aab' ) ;
136131 }
137132 if ( options . keyStorePath ) {
138133 nsOptions . push ( '--key-store-path' ) ;
@@ -169,19 +164,25 @@ export default async function runExecutor(options: BuildBuilderSchema, context:
169164 nsOptions . push ( '--force' ) ;
170165 }
171166 }
172-
173- // additional args after -- should be passed through
174- const argSeparator = process . argv . findIndex ( arg => arg === '--' ) ;
175- let additionalArgs = [ ] ;
176- if ( argSeparator >= 0 ) {
177- additionalArgs = process . argv . slice ( argSeparator + 1 ) ;
167+
168+ // additional cli flags
169+ // console.log('projectTargetCmdIndex:', projectTargetCmdIndex)
170+ const additionalArgs = [ ] ;
171+ if ( process . argv . length > projectTargetCmdIndex + 1 ) {
172+ const extraFlags = process . argv . slice ( projectTargetCmdIndex + 1 , process . argv . length ) ;
173+ for ( const flag of extraFlags ) {
174+ if ( ! nsOptions . includes ( flag ) && ! additionalArgs . includes ( flag ) ) {
175+ additionalArgs . push ( flag ) ;
176+ }
177+ }
178+ // console.log('additionalArgs:', additionalArgs);
178179 }
179180
180- console . log ( '---' )
181+ console . log ( '---' ) ;
181182 console . log ( `Running NativeScript CLI within ${ projectCwd } ` ) ;
182- console . log ( ' ' )
183+ console . log ( ' ' ) ;
183184 console . log ( [ `ns` , ...nsOptions , ...additionalArgs ] . join ( ' ' ) ) ;
184- console . log ( '---' )
185+ console . log ( '---' ) ;
185186 // console.log('command:', [`ns`, ...nsOptions].join(' '));
186187 const child = childProcess . spawn ( / ^ w i n / . test ( process . platform ) ? 'ns.cmd' : 'ns' , [ ...nsOptions , ...additionalArgs ] , {
187188 cwd : projectCwd ,
0 commit comments