@@ -6,14 +6,14 @@ export default async function runExecutor(options: BuildBuilderSchema, context:
6
6
return new Promise ( ( resolve , reject ) => {
7
7
const projectConfig = context . workspace . projects [ context . projectName ] ;
8
8
// 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' ) ) ;
10
10
if ( isBuild ) {
11
11
// allow build options to override run target options
12
12
const buildTarget = projectConfig . targets [ 'build' ] ;
13
13
if ( buildTarget && buildTarget . options ) {
14
14
options = {
15
15
...options ,
16
- ...buildTarget . options
16
+ ...buildTarget . options ,
17
17
} ;
18
18
}
19
19
}
@@ -26,18 +26,13 @@ export default async function runExecutor(options: BuildBuilderSchema, context:
26
26
27
27
let targetConfigName = '' ;
28
28
if ( context . configurationName && context . configurationName !== 'build' ) {
29
- targetConfigName = context . configurationName ;
29
+ targetConfigName = context . configurationName ;
30
30
}
31
31
32
32
// determine if any trailing args that need to be added to run/build command
33
33
const configTarget = targetConfigName ? `:${ targetConfigName } ` : '' ;
34
34
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 ) ;
41
36
42
37
const fileReplacements : Array < string > = [ ] ;
43
38
let configOptions ;
@@ -51,7 +46,7 @@ export default async function runExecutor(options: BuildBuilderSchema, context:
51
46
if ( targetBuildConfig ) {
52
47
options = {
53
48
...options ,
54
- ...targetBuildConfig
49
+ ...targetBuildConfig ,
55
50
} ;
56
51
}
57
52
}
@@ -132,7 +127,7 @@ export default async function runExecutor(options: BuildBuilderSchema, context:
132
127
nsOptions . push ( '--release' ) ;
133
128
}
134
129
if ( options . aab ) {
135
- nsOptions . push ( '--aab' )
130
+ nsOptions . push ( '--aab' ) ;
136
131
}
137
132
if ( options . keyStorePath ) {
138
133
nsOptions . push ( '--key-store-path' ) ;
@@ -169,19 +164,25 @@ export default async function runExecutor(options: BuildBuilderSchema, context:
169
164
nsOptions . push ( '--force' ) ;
170
165
}
171
166
}
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);
178
179
}
179
180
180
- console . log ( '---' )
181
+ console . log ( '---' ) ;
181
182
console . log ( `Running NativeScript CLI within ${ projectCwd } ` ) ;
182
- console . log ( ' ' )
183
+ console . log ( ' ' ) ;
183
184
console . log ( [ `ns` , ...nsOptions , ...additionalArgs ] . join ( ' ' ) ) ;
184
- console . log ( '---' )
185
+ console . log ( '---' ) ;
185
186
// console.log('command:', [`ns`, ...nsOptions].join(' '));
186
187
const child = childProcess . spawn ( / ^ w i n / . test ( process . platform ) ? 'ns.cmd' : 'ns' , [ ...nsOptions , ...additionalArgs ] , {
187
188
cwd : projectCwd ,
0 commit comments