@@ -246,13 +246,27 @@ Here's an example app config:
246246 "executor" : " @nativescript/nx:build" ,
247247 "options" : {
248248 "noHmr" : true ,
249- "production" : true ,
250249 "uglify" : true ,
250+ "forDevice" : true ,
251251 "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+ }
253262 },
254263 "configurations" : {
255- "prod" : {
264+ "production" : {
265+ "production" : true ,
266+ "release" : true ,
267+ "android" : {
268+ "keyStorePassword" : " productionpw"
269+ },
256270 "fileReplacements" : [
257271 {
258272 "replace" : " ./src/environments/environment.ts" ,
@@ -262,56 +276,69 @@ Here's an example app config:
262276 }
263277 }
264278 },
265- "ios " : {
266- "executor" : " @nativescript/nx:build " ,
279+ "debug " : {
280+ "executor" : " @nativescript/nx:debug " ,
267281 "options" : {
268- "platform" : " ios"
282+ "noHmr" : true ,
283+ "uglify" : false ,
284+ "release" : false ,
285+ "forDevice" : false ,
286+ "prepare" : false
269287 },
270288 "configurations" : {
271- "build" : {
272- "provision" : " AppStore Profile" ,
273- "copyTo" : " ./dist/build.ipa"
274- },
275289 "prod" : {
276- "combineWithConfig" : " build:prod"
290+ "fileReplacements" : [
291+ {
292+ "replace" : " ./src/environments/environment.ts" ,
293+ "with" : " ./src/environments/environment.prod.ts"
294+ }
295+ ]
277296 }
278297 }
279298 },
280- "android " : {
281- "executor" : " @nativescript/nx:build " ,
299+ "prepare " : {
300+ "executor" : " @nativescript/nx:prepare " ,
282301 "options" : {
283- "platform" : " android"
302+ "noHmr" : true ,
303+ "production" : true ,
304+ "uglify" : true ,
305+ "release" : true ,
306+ "forDevice" : true ,
307+ "prepare" : true
284308 },
285309 "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- },
294310 "prod" : {
295- "combineWithConfig" : " build:prod"
311+ "fileReplacements" : [
312+ {
313+ "replace" : " ./src/environments/environment.ts" ,
314+ "with" : " ./src/environments/environment.prod.ts"
315+ }
316+ ]
296317 }
297318 }
298319 },
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" ,
302326 "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+ ]
308331 }
309332 },
310- "clean" : {
311- "executor" : " @nativescript/nx:build" ,
333+ "test" : {
334+ "executor" : " @nativescript/nx:test" ,
335+ "outputs" : [
336+ " coverage/apps/nativescript-app"
337+ ],
312338 "options" : {
313- "clean" : true
314- }
339+ "coverage" : true
340+ },
341+ "configurations" : {}
315342 }
316343 }
317344}
@@ -322,33 +349,33 @@ Here's an example app config:
322349** Android:**
323350
324351``` sh
325- npx nx run < app-name> : android: prod
352+ npx nx debug < app-name> android -c= prod
326353```
327354
328355** iOS:** (Mac only)
329356
330357``` sh
331- npx nx run < app-name> : ios: prod
358+ npx nx debug < app-name> ios -c= prod
332359```
333360
334361#### Run tests
335362
336363** Android:**
337364
338365``` sh
339- npx nx run < app-name> :test: android
366+ npx nx test < app-name> android
340367```
341368
342369** iOS:** (Mac only)
343370
344371``` sh
345- npx nx run < app-name> :test: ios
372+ npx nx test < app-name> ios
346373```
347374
348375You can generate coverage reports by using the flag with iOS or Android, for example:
349376
350377``` sh
351- npx nx run < app-name> :test: ios --coverage
378+ npx nx test < app-name> ios --coverage
352379```
353380
354381You can also set this option in the config, for example:
@@ -380,15 +407,15 @@ Build with an environment configuration enabled (for example, with `prod`):
380407** Android:**
381408
382409``` sh
383- npx nx run < app-name> :build:prod --platform=android
410+ npx nx build < app-name> android --c=prod
384411```
385412
386413You can pass additional NativeScript CLI options as flags on the end of you build command.
387414
388415* example of building AAB bundle for upload to Google Play:
389416
390417```
391- npx nx run <app-name>:build:prod --platform=android \
418+ npx nx build <app-name> android --c=prod \
392419 --aab \
393420 --key-store-path=<path-to-your-keystore> \
394421 --key-store-password=<your-key-store-password> \
@@ -400,15 +427,15 @@ npx nx run <app-name>:build:prod --platform=android \
400427** iOS:** (Mac only)
401428
402429``` sh
403- npx nx run < app-name> :build:prod --platform=ios
430+ npx nx build < app-name> iod --c=prod
404431```
405432
406433As mentioned, you can pass any additional NativeScript CLI options as flags on the end of your nx build command:
407434
408435* example of building IPA for upload to iOS TestFlight:
409436
410437```
411- npx nx run <app-name>:build:prod --platform=ios \
438+ npx nx build <app-name> ios --c=prod \
412439 --provision <provisioning-profile-name> \
413440 --copy-to ./dist/build.ipa
414441```
@@ -418,7 +445,7 @@ npx nx run <app-name>:build:prod --platform=ios \
418445It 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.
419446
420447``` sh
421- npx nx run < app-name> :clean
448+ npx nx clean < app-name>
422449```
423450
424451## Create NativeScript library
0 commit comments