@@ -246,13 +246,27 @@ Here's an example app config:
246
246
"executor" : " @nativescript/nx:build" ,
247
247
"options" : {
248
248
"noHmr" : true ,
249
- "production" : true ,
250
249
"uglify" : true ,
250
+ "forDevice" : true ,
251
251
"release" : true ,
252
- "forDevice" : true
252
+ "android" : {
253
+ "copyTo" : " ./dist/app.apk" ,
254
+ "keyStorePath" : " /path/to/android.keystore" ,
255
+ "keyStoreAlias" : " app" ,
256
+ "keyStorePassword" : " pass" ,
257
+ "keyStoreAliasPassword" : " pass"
258
+ },
259
+ "ios" : {
260
+ "copyTo" : " ./dist/app.ipa"
261
+ }
253
262
},
254
263
"configurations" : {
255
- "prod" : {
264
+ "production" : {
265
+ "production" : true ,
266
+ "release" : true ,
267
+ "android" : {
268
+ "keyStorePassword" : " productionpw"
269
+ },
256
270
"fileReplacements" : [
257
271
{
258
272
"replace" : " ./src/environments/environment.ts" ,
@@ -262,56 +276,69 @@ Here's an example app config:
262
276
}
263
277
}
264
278
},
265
- "ios " : {
266
- "executor" : " @nativescript/nx:build " ,
279
+ "debug " : {
280
+ "executor" : " @nativescript/nx:debug " ,
267
281
"options" : {
268
- "platform" : " ios"
282
+ "noHmr" : true ,
283
+ "uglify" : false ,
284
+ "release" : false ,
285
+ "forDevice" : false ,
286
+ "prepare" : false
269
287
},
270
288
"configurations" : {
271
- "build" : {
272
- "provision" : " AppStore Profile" ,
273
- "copyTo" : " ./dist/build.ipa"
274
- },
275
289
"prod" : {
276
- "combineWithConfig" : " build:prod"
290
+ "fileReplacements" : [
291
+ {
292
+ "replace" : " ./src/environments/environment.ts" ,
293
+ "with" : " ./src/environments/environment.prod.ts"
294
+ }
295
+ ]
277
296
}
278
297
}
279
298
},
280
- "android " : {
281
- "executor" : " @nativescript/nx:build " ,
299
+ "prepare " : {
300
+ "executor" : " @nativescript/nx:prepare " ,
282
301
"options" : {
283
- "platform" : " android"
302
+ "noHmr" : true ,
303
+ "production" : true ,
304
+ "uglify" : true ,
305
+ "release" : true ,
306
+ "forDevice" : true ,
307
+ "prepare" : true
284
308
},
285
309
"configurations" : {
286
- "build" : {
287
- "aab" : true ,
288
- "keyStorePath" : " ./tools/keystore.jks" ,
289
- "keyStorePassword" : " your-password" ,
290
- "keyStoreAlias" : " keystore-alias" ,
291
- "keyStoreAliasPassword" : " keystore-alias-password" ,
292
- "copyTo" : " ./dist/build.aab"
293
- },
294
310
"prod" : {
295
- "combineWithConfig" : " build:prod"
311
+ "fileReplacements" : [
312
+ {
313
+ "replace" : " ./src/environments/environment.ts" ,
314
+ "with" : " ./src/environments/environment.prod.ts"
315
+ }
316
+ ]
296
317
}
297
318
}
298
319
},
299
- "test" : {
300
- "executor" : " @nativescript/nx:test" ,
301
- "outputs" : [" coverage/apps/nativescript-mobile" ],
320
+ "clean" : {
321
+ "executor" : " @nativescript/nx:clean" ,
322
+ "options" : {}
323
+ },
324
+ "lint" : {
325
+ "executor" : " @nx/linter:eslint" ,
302
326
"options" : {
303
- "coverage" : false
304
- },
305
- "configurations" : {
306
- "android" : {},
307
- "ios" : {}
327
+ "lintFilePatterns" : [
328
+ " apps/nativescript-app/**/*.ts" ,
329
+ " apps/nativescript-app/src/**/*.html"
330
+ ]
308
331
}
309
332
},
310
- "clean" : {
311
- "executor" : " @nativescript/nx:build" ,
333
+ "test" : {
334
+ "executor" : " @nativescript/nx:test" ,
335
+ "outputs" : [
336
+ " coverage/apps/nativescript-app"
337
+ ],
312
338
"options" : {
313
- "clean" : true
314
- }
339
+ "coverage" : true
340
+ },
341
+ "configurations" : {}
315
342
}
316
343
}
317
344
}
@@ -322,33 +349,33 @@ Here's an example app config:
322
349
** Android:**
323
350
324
351
``` sh
325
- npx nx run < app-name> : android: prod
352
+ npx nx debug < app-name> android -c= prod
326
353
```
327
354
328
355
** iOS:** (Mac only)
329
356
330
357
``` sh
331
- npx nx run < app-name> : ios: prod
358
+ npx nx debug < app-name> ios -c= prod
332
359
```
333
360
334
361
#### Run tests
335
362
336
363
** Android:**
337
364
338
365
``` sh
339
- npx nx run < app-name> :test: android
366
+ npx nx test < app-name> android
340
367
```
341
368
342
369
** iOS:** (Mac only)
343
370
344
371
``` sh
345
- npx nx run < app-name> :test: ios
372
+ npx nx test < app-name> ios
346
373
```
347
374
348
375
You can generate coverage reports by using the flag with iOS or Android, for example:
349
376
350
377
``` sh
351
- npx nx run < app-name> :test: ios --coverage
378
+ npx nx test < app-name> ios --coverage
352
379
```
353
380
354
381
You can also set this option in the config, for example:
@@ -380,15 +407,15 @@ Build with an environment configuration enabled (for example, with `prod`):
380
407
** Android:**
381
408
382
409
``` sh
383
- npx nx run < app-name> :build:prod --platform=android
410
+ npx nx build < app-name> android --c=prod
384
411
```
385
412
386
413
You can pass additional NativeScript CLI options as flags on the end of you build command.
387
414
388
415
* example of building AAB bundle for upload to Google Play:
389
416
390
417
```
391
- npx nx run <app-name>:build:prod --platform=android \
418
+ npx nx build <app-name> android --c=prod \
392
419
--aab \
393
420
--key-store-path=<path-to-your-keystore> \
394
421
--key-store-password=<your-key-store-password> \
@@ -400,15 +427,15 @@ npx nx run <app-name>:build:prod --platform=android \
400
427
** iOS:** (Mac only)
401
428
402
429
``` sh
403
- npx nx run < app-name> :build:prod --platform=ios
430
+ npx nx build < app-name> iod --c=prod
404
431
```
405
432
406
433
As mentioned, you can pass any additional NativeScript CLI options as flags on the end of your nx build command:
407
434
408
435
* example of building IPA for upload to iOS TestFlight:
409
436
410
437
```
411
- npx nx run <app-name>:build:prod --platform=ios \
438
+ npx nx build <app-name> ios --c=prod \
412
439
--provision <provisioning-profile-name> \
413
440
--copy-to ./dist/build.ipa
414
441
```
@@ -418,7 +445,7 @@ npx nx run <app-name>:build:prod --platform=ios \
418
445
It can be helpful to clean the app at times. This will clear out old dependencies plus iOS/Android platform files to give your app a nice reset.
419
446
420
447
``` sh
421
- npx nx run < app-name> :clean
448
+ npx nx clean < app-name>
422
449
```
423
450
424
451
## Create NativeScript library
0 commit comments