@@ -12,6 +12,9 @@ if (!process.env.npm_config_argv) {
12
12
throwError ( { message : "No flags provided." } ) ;
13
13
}
14
14
15
+ const escape = arg => `"${ arg } "` ;
16
+ const isTnsCommand = flag => flag . endsWith ( "--app" ) ;
17
+
15
18
const npmArgs = JSON . parse ( process . env . npm_config_argv ) . original ;
16
19
const tnsArgs = getTnsArgs ( npmArgs ) . map ( escape ) ;
17
20
const flags = npmArgs . filter ( a => a . startsWith ( "--" ) ) . map ( a => a . substring ( 2 ) ) ;
@@ -23,17 +26,11 @@ function getTnsArgs(args) {
23
26
"ns-bundle" ,
24
27
"--android" ,
25
28
"--ios" ,
26
- "--build-app" ,
27
- "--start-app" ,
28
29
"--uglify" ,
29
30
"--nobundle" ,
30
31
] ;
31
32
32
- return args . filter ( a => ! other . includes ( a ) ) ;
33
- }
34
-
35
- function escape ( arg ) {
36
- return `"${ arg } "` ;
33
+ return args . filter ( a => ! other . includes ( a ) && ! isTnsCommand ( a ) ) ;
37
34
}
38
35
39
36
execute ( options ) ;
@@ -179,15 +176,13 @@ function getPlatform(flags) {
179
176
}
180
177
181
178
function getCommand ( flags ) {
182
- if ( flags . includes ( "start-app" ) && flags . includes ( "build-app" ) ) {
183
- throwError ( { message : "You cannot use both --start-app and --build-app flags!" } ) ;
179
+ const commands = flags . filter ( isTnsCommand ) ;
180
+ if ( commands . length > 1 ) {
181
+ throwError ( { message : `You can't use ${ commands . join ( ", " ) } together!` } ) ;
184
182
}
185
183
186
- if ( flags . includes ( "start-app" ) ) {
187
- return "run" ;
188
- } else if ( flags . includes ( "build-app" ) ) {
189
- return "build" ;
190
- }
184
+ // remove '-app' suffix
185
+ return commands [ 0 ] . replace ( / - a p p / , "" ) ;
191
186
}
192
187
193
188
function spawnChildProcess ( command , ...args ) {
0 commit comments