-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathns.ts
1274 lines (1223 loc) · 35.2 KB
/
ns.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Common options used throughout the CLI
*/
const cleanOption: Fig.Option = {
name: "--clean",
description: "Forces rebuilding the native application",
};
const timeoutOption: Fig.Option = {
name: "--timeout",
description:
"Sets the number of seconds that the NativeScript CLI will wait for the debugger to boot. If not set, the default timeout is 90 seconds",
args: {
name: "seconds",
},
};
const emulatorOption: Fig.Option = {
name: "--emulator",
description: "Specifies that you want to debug the app in an emulator",
};
const deviceOption: Fig.Option = {
name: "--device",
description: "Specifies a connected device/emulator to start and run the app",
args: {
name: "device id",
// TODO: create a generator of ns device <platform> --available-devices
// generators: {
// script: ["ns", "devices", "--json"],
// postProcess: (output) => {
// return [{
// name: "test1",
// description: "Test 1"
// }]
// },
// },
},
};
const forceOption: Fig.Option = {
name: "--force",
description:
"Skips the application compatibility checks and forces npm i to ensure all dependencies are installed",
};
const noHmrOption: Fig.Option = {
name: "--no-hmr",
description: "Disables Hot Module Replacement (HMR)",
};
const frameworkPathOption: Fig.Option = {
name: "--framework-path",
description:
"Sets the path to a NativeScript runtime for the specified platform that you want to use instead of the default runtime. <File Path> must point to a valid npm package",
args: {
name: "path",
template: "filepaths",
},
};
const jsonOption: Fig.Option = {
name: "--json",
description: "Show the output of the command in JSON format",
};
const justLaunchOption: Fig.Option = {
name: "--justlaunch",
description: "Does not print the application output in the console",
};
const releaseOption: Fig.Option = {
name: "--release",
description:
"Produces a release build by running webpack in production mode and native build in release mode. Otherwise, produces a debug build",
};
const bundleOption: Fig.Option = {
name: "--bundle",
description: "Bundle the application",
};
const helpOption = (label: string): Fig.Option => {
return {
name: ["--help", "-h"],
description: `Show help for the ${label} subcommand`,
priority: 0,
};
};
/**
* Platform options used across many commands of the CLI
*/
const androidGeneralOptions: Fig.Option[] = [
{
name: "--aab",
description:
"Specifies that the command will produce and deploy an Android App Bundle",
},
{
name: "--env.snapshot",
description:
"Creates a V8 Snapshot decreasing the app start time (only for release builds for Android)",
dependsOn: ["--release"],
},
{
name: "--env.compileSnapshot",
description:
"Compiles the static assets produced by --env.snapshot into .so files allowing the native build to split them per architecture. This will reduce the app size when using the --aab option",
dependsOn: ["--env.snapshot", "--aab"],
},
{
name: "--env.appComponents",
description: "Allows passing additional App Components for android",
},
];
const androidKeyOptions: Fig.Option[] = [
{
name: "--key-store-path",
description:
"Specifies the file path to the keystore file (P12) which you want to use to code sign your APK",
args: {
name: "path",
template: "filepaths",
},
dependsOn: ["--release"],
},
{
name: "--key-store-password",
description:
"Provides the password for the keystore file specified with --key-store-path",
args: {
name: "password",
},
dependsOn: ["--release"],
},
{
name: "--key-store-alias",
description:
"Provides the alias for the keystore file specified with --key-store-path",
args: {
name: "alias",
},
dependsOn: ["--release"],
},
{
name: "--key-store-alias-password",
description:
"Provides the password for the alias specified with --key-store-alias-password",
args: {
name: "alias password",
},
dependsOn: ["--release"],
},
];
const platformEnvOptions: Fig.Option[] = [
{
name: "--env.aot",
description: "Creates an Ahead-Of-Time build (Angular only)",
},
{
name: "--env.uglify",
description: "Provides basic obfuscation and smaller app size",
},
{
name: "--env.report",
description:
"Creates a Webpack report inside a /report folder in the root folder",
},
{
name: "--env.sourceMap",
description: "Creates inline source maps",
},
{
name: "--env.hiddenSourceMap",
description:
"Creates sources maps in the root folder (useful for Crashlytics usage with bundled app in release)",
},
{
name: "--env.verbose",
description: "Prints verbose logs and the internal config before building",
},
{
name: "--env.production",
description: "Enable production mode (will minify the code)",
},
{
name: "--env.replace=from:to",
description:
"Add file replacement rules. For source files (.js and .ts) this will add a new alias to the config, for everything else, this will add a new copy rule",
insertValue: "--env.replace={cursor}:",
requiresSeparator: true,
},
];
const platformGeneralOptions: Fig.Option[] = [
...platformEnvOptions,
noHmrOption,
forceOption,
deviceOption,
cleanOption,
emulatorOption,
timeoutOption,
];
/**
* Defined a map of shared options for various commands
* Some commands have slightly varied options.
*/
const platformOptions = {
// NOTE: used like so:
// ...platformOption.<command>.both
// ...platformOption.<command>.ios
run: {
both: [
...platformGeneralOptions,
justLaunchOption,
releaseOption,
bundleOption,
],
ios: [
{
name: "--sdk",
description: "Specifies the target simulator's sdk",
args: {
name: "sdk",
},
},
],
android: [...androidGeneralOptions, ...androidKeyOptions],
},
debug: {
both: [
...platformGeneralOptions,
{
name: "--debug-brk",
description:
"Prepares, builds and deploys the application package on a device or in an emulator, and stops at the first JavaScript line until either the debugger frontend connects or a 30 seconds timeout elapses",
},
{
name: "--start",
description: "Attaches the debug tools to a deployed and running app",
},
{
name: "--no-watch",
description: "Changes in your code will not be livesynced",
},
],
ios: [
{
name: "--no-client",
description:
"The NativeScript CLI attaches the debug tools but does not launch the developer tools in Safari. Could be used on already started Safari Web Inspector",
},
{
name: "--inspector",
description:
"The developer tools in the Safari Web Inspector are used for debugging the application",
},
],
android: androidGeneralOptions,
},
test: {
both: [
{
name: "--watch",
description:
"When you save changes to the project, changes are automatically synchronized to the connected device and tests are re-run",
},
{
name: "--debug-brk",
description:
"Runs the tests under the debugger. The debugger will break just before your tests are executed, so you have a chance to place breakpoints",
},
justLaunchOption,
forceOption,
deviceOption,
emulatorOption,
],
ios: [],
android: androidGeneralOptions,
},
build: {
both: [
...platformEnvOptions,
releaseOption,
{
name: "--copy-to",
description:
"Specifies the file path where the built .ipa|.apk will be copied. If it points to a non-existent directory path, it will be created. If the specified value is existing directory, the original file name will be used",
args: {
name: "path",
template: "folders" as Fig.Template,
},
},
{
name: "--path",
description:
"Specifies the directory where you want to create the project, if different from the current directory",
args: {
name: "directory",
template: "folders" as Fig.Template,
},
},
forceOption,
cleanOption,
deviceOption,
],
android: [
...androidGeneralOptions,
{
name: "--compileSdk",
description:
"Sets the Android SDK that will be used to build the project",
args: {
name: "api level",
},
},
...androidKeyOptions,
],
ios: [
{
name: "--for-device",
description:
"Produces an application package that you can deploy on device. Otherwise, produces a build that you can run only in the native iOS Simulator",
},
{
name: "--i-cloud-container-environment",
description:
"Adds the passed iCloudContainerEnvironment when exporting an application package with the --for-device option",
dependsOn: ["--for-device"],
},
{
name: "--team-id",
description:
"If used without parameter, lists all team names and ids. If used with team name or id, it will switch to automatic signing mode and configure the .xcodeproj file of your app. In this case .xcconfig should not contain any provisioning/team id flags",
args: {
name: "team id",
isOptional: true,
},
},
{
name: "--provision",
description:
"If used without parameter, lists all eligible provisioning profiles. If used with UUID or name of your provisioning profile, it will switch to manual signing mode and configure the .xcodeproj file of your app",
args: {
name: "uuid",
isOptional: true,
},
},
],
},
deploy: {
both: [
deviceOption,
cleanOption,
forceOption,
releaseOption,
...platformEnvOptions,
],
ios: [],
android: [...androidGeneralOptions, ...androidKeyOptions],
},
};
// General Commands
const helpCommand: Fig.Subcommand = {
name: "help",
description: "Open the CLI's documentation in your web browser",
options: [helpOption("help")],
};
const infoCommand: Fig.Subcommand = {
name: "info",
description:
"Displays version information about the NativeScript CLI, core modules, and runtimes",
options: [helpOption("info")],
};
const updateCommand: Fig.Subcommand = {
name: "update",
description:
"Updates the project with the latest versions of platform runtimes, cross-platform modules and webpack",
isDangerous: true,
subcommands: [
{
name: "next",
description: "The latest development release",
},
],
args: {
name: "version",
description: "The version to update the project to",
isOptional: true,
},
options: [helpOption("update")],
};
const packageManagerCommand: Fig.Subcommand = {
name: "package-manager",
description: "Prints the value of the current package manager",
subcommands: [
{
name: "get",
description: "Prints the value of the current package manager",
},
{
name: "set",
description:
"Enables the specified package manager for the NativeScript CLI. Supported values are npm, yarn and pnpm",
},
],
options: [helpOption("package-manager")],
};
const doctorCommand: Fig.Subcommand = {
name: "doctor",
description:
"Checks your system for configuration problems which might prevent the NativeScript CLI from working properly for the specified platform, if configured",
subcommands: [
{
name: "android",
description: "Check your system configuration for android",
},
{
name: "ios",
description: "Check your system configuration for ios",
},
],
options: [helpOption("doctor")],
};
const migrateCommand: Fig.Subcommand = {
name: "migrate",
description:
"Migrates the app dependencies to a form compatible with NativeScript 6.0",
isDangerous: true,
options: [helpOption("migrate")],
};
const proxyCommand: Fig.Subcommand = {
name: "proxy",
description: "Displays the current proxy settings of the NativeScript CLI",
subcommands: [
{
name: "clear",
description:
"Clears the currently configured proxy settings of the NativeScript CLI",
},
{
name: "set",
description: "Sets the proxy settings of the NativeScript CLI",
args: [
{
name: "proxy url",
description:
"Full url of the proxy. For example, http://127.0.0.1:8888. If you do not provide the url when running the command, the NativeScript CLI will prompt you to provide it",
},
{
name: "username",
description: "Credentials for the proxy",
isOptional: true,
},
{
name: "password",
description: "Credentials for the proxy",
isOptional: true,
},
],
options: [
{
name: "--insecure",
description:
"Allows insecure SSL connections and transfers to be performed. In case your proxy doesn't have a CA certificate or has an invalid one you need to use this flag",
},
],
},
],
options: [helpOption("proxy")],
};
const usageReportingCommand: Fig.Subcommand = {
name: "usage-reporting",
description:
"Configures anonymous usage reporting for the NativeScript CLI. All data gathered is used strictly for improving the product and will never be used to identify or contact you",
subcommands: [
{
name: "status",
description:
"Shows the current configuration for anonymous usage reporting for the NativeScript CLI",
},
{
name: "enable",
description: "Enables anonymous usage reporting",
},
{
name: "disable",
description: "Disables anonymous usage reporting",
},
],
options: [helpOption("usage-reporting")],
priority: 1,
};
const errorReportingCommand: Fig.Subcommand = {
name: "error-reporting",
description:
"Configures anonymous error reporting for the NativeScript CLI. All data gathered is used strictly for improving the product and will never be used to identify or contact you",
subcommands: [
{
name: "status",
description:
"Shows the current configuration for anonymous error reporting for the NativeScript CLI",
},
{
name: "enable",
description: "Enables anonymous error reporting",
},
{
name: "disable",
description: "Disables anonymous error reporting",
},
],
options: [helpOption("error-reporting")],
priority: 1,
};
// Project Development Commands
const createCommand: Fig.Subcommand = {
name: "create",
description:
"Create a new Nativescript project. Press Enter for an interactive walkthrough",
args: {
name: "application name",
description: "The name of the Nativescript project",
isOptional: true,
},
options: [
{
name: "--template",
description: "Create a project using a predefined template",
args: {
name: "template",
generators: {
script: [
"curl",
"-sfL",
"https://api.github.com/repos/NativeScript/nativescript-app-templates/contents/packages",
],
cache: {
ttl: 100 * 24 * 60 * 60 * 1000, // 100days
},
postProcess: (output) => {
return JSON.parse(output).map((branch) => {
const template = branch?.name;
return {
name: `@nativescript/${template}`,
description: `Template ${template}`,
} as Fig.Suggestion;
});
},
},
},
},
{
name: ["--angular", "--ng"],
description: "Create a project using the Angular template",
},
{
name: "--react",
description: "Create a project using the React template",
},
{
name: ["--vue", "--vuejs"],
description: "Create a project using the Vue template",
},
{
name: "--svelte",
description: "Create a project using the Svelte template",
},
{
name: ["--typescript", "--tsc", "--ts"],
description: "Create a project using plain TypeScript",
},
{
name: ["--javascript", "--js"],
description: "Create a project using plain JavaScript",
},
{
name: "--path",
description:
"Specifies the directory where you want to create the project, if different from the current directory. <directory> is the absolute path to an empty directory in which you want to create the project",
priority: 10,
args: {
name: "directory",
template: "folders",
},
},
{
name: "--appid",
description:
"Sets the application identifier of your project. <appid> is the value of the application identifier and it must meet the specific requirements of each platform that you want to target. If not specified, the application identifier is set to org.nativescript.<Project Name>. The application identifier must be a domain name in reverse",
args: {
name: "identifier",
},
},
helpOption("create"),
],
};
const cleanCommand: Fig.Subcommand = {
name: "clean",
description: "Clean your Nativescript project",
options: [helpOption("clean")],
};
const previewCommand: Fig.Subcommand = {
name: "preview",
description:
"Produces a QR code which can be used to preview the app on a device",
options: [forceOption, noHmrOption, helpOption("preview")],
};
const platformCommand: Fig.Subcommand = {
name: "platform",
description:
"Lists all platforms that the project currently targets. You can build and deploy your project only for these target platforms",
subcommands: [
{
name: "list",
description:
"Lists all platforms that the project currently targets. You can build and deploy your project only for these target platforms",
},
{
name: "add",
description:
"Configures the current project to target the selected platform",
subcommands: [
{
name: "android",
description: "The latest android platform",
options: [frameworkPathOption],
},
{
name: "android@[Version]",
insertValue: "android@{cursor}",
description: "The defined android platform eg. 1.0.0",
options: [frameworkPathOption],
},
{
name: "ios",
description: "The latest ios platform",
options: [frameworkPathOption],
},
{
name: "ios@[Version]",
insertValue: "ios@{cursor}",
description: "The defined ios platform eg. 1.0.0",
options: [frameworkPathOption],
},
],
},
{
name: "remove",
description:
"Removes the selected platform from the platforms that the project currently targets",
subcommands: [
{
name: "android",
description: "The latest android platform",
},
{
name: "ios",
description: "The latest ios platform",
},
],
},
{
name: "update",
description:
"Updates the NativeScript runtime for the specified platform",
subcommands: [
{
name: "android",
description: "The latest android platform",
},
{
name: "ios",
description: "The latest ios platform",
},
],
},
],
options: [helpOption("platform")],
};
const runCommand: Fig.Subcommand = {
name: "run",
description:
"Runs your project on all connected devices or in native emulators for the selected platform",
subcommands: [
{
name: "android",
description: "The latest android platform",
options: [...platformOptions.run.both, ...platformOptions.run.android],
priority: 90,
},
{
name: "ios",
description: "The latest ios platform",
options: [...platformOptions.run.both, ...platformOptions.run.ios],
priority: 90,
},
],
options: [...platformOptions.run.both, helpOption("run")],
};
const debugCommand: Fig.Subcommand = {
name: "debug",
description:
"Initiates a debugging session for your project on a connected device or native emulator",
subcommands: [
{
name: "android",
description:
"Start a debugging session for your project on a connected Android device or Android emulator",
options: [
...platformOptions.debug.both,
...platformOptions.debug.android,
],
priority: 90,
},
{
name: "ios",
description:
"Start a debugging session for your project on a connected iOS device or in the native iOS simulator",
options: [...platformOptions.debug.both, ...platformOptions.debug.ios],
priority: 90,
},
],
options: [helpOption("debug")],
};
const testCommand: Fig.Subcommand = {
name: "test",
description: "Runs unit tests on the selected mobile platform",
subcommands: [
{
name: "init",
description: "Configure your project for unit testing",
options: [
{
name: "--framework",
description: "Sets the unit testing framework to install",
args: {
name: "framework",
suggestions: ["mocha", "jasmine", "qunit"],
},
},
],
},
{
name: "android",
description:
"Run unit tests on all connected android devices or native emulators",
options: [...platformOptions.test.both, ...platformOptions.test.android],
priority: 90,
},
{
name: "ios",
description:
"Run unit tests on all connected ios devices or native emulators",
options: [...platformOptions.test.both, ...platformOptions.test.ios],
priority: 90,
},
],
options: [helpOption("test")],
};
const pluginCommand: Fig.Subcommand = {
name: "plugin",
description: "Manage the plugins for your project",
subcommands: [
{
name: "add",
description: "Installs the specified plugin and its dependencies",
args: {
name: "plugin",
description: "A valid Nativescript plugin",
},
},
{
name: "remove",
description: "Uninstalls the specified plugin and its dependencies",
args: {
name: "plugin",
description: "A valid Nativescript plugin",
},
},
{
name: "update",
description:
"Uninstalls and installs the specified plugin(s) and its dependencies",
args: {
name: "plugin(s)",
description: "A valid Nativescript plugin",
},
},
{
name: "build",
description: "Builds the Android parts of a NativeScript plugin",
},
{
name: "create",
description: "Creates a project for building a new NativeScript plugin",
args: {
name: "plugin repository name",
description: "A valid Nativescript plugin repository",
},
options: [
{
name: "--path",
description:
"Specifies the directory where you want to create the project, if different from the current directory",
args: {
name: "directory",
description:
"Specifies the directory where you want to create the project, if different from the current directory",
template: "folders",
},
},
{
name: "--username",
description:
"Specifies the GitHub username, which will be used to build the URLs in the plugin's package.json file",
args: {
name: "username",
description: "GitHub username",
},
},
{
name: "--pluginName",
description:
"Used to set the default file and class names in the plugin source",
args: {
name: "name",
},
},
{
name: "--includeTypeScriptDemo",
description: "Specifies if a TypeScript demo should be created",
},
{
name: "--includeTypeScriptDemo=n",
description: "Specifies if TypeScript demo should NOT be created",
},
{
name: "--includeAngularDemo",
description: "Specifies if an Angular demo should be created",
},
{
name: "--includeAngularDemo=n",
description: "Specifies if Angular demo should NOT be created",
},
{
name: "--template",
description:
"Specifies the custom seed archive, which you want to use to create your plugin",
args: {
name: "template",
description: "Specifies the template for the plugin",
},
},
],
},
],
options: [helpOption("plugin")],
};
const resourcesCommand: Fig.Subcommand = {
name: "resources",
description: "Manage the plugins for your project",
subcommands: [
{
name: "update",
description:
"Updates the App_Resources's internal folder structure to conform to that of an Android Studio project",
},
{
name: "generate",
subcommands: [
{
name: "splashes",
args: {
name: "image path",
description:
"Path to an image that will be used to generate all splashscreens",
template: "filepaths",
},
options: [
{
name: "--background",
description: "Sets the background color of the splashscreen",
args: {
name: "color",
default: "white",
},
},
],
},
{
name: "icons",
args: {
name: "image path",
description:
"Path to an image that will be used to generate all splashscreens",
template: "filepaths",
},
},
],
},
],
options: [helpOption("plugin")],
};
const prepareCommand: Fig.Subcommand = {
name: "prepare",
description:
"Starts a Webpack compilation and prepares the app's App_Resources and the plugins platforms directories",
subcommands: [
{
name: "android",
description: "Prepares your project for an Android build",
options: [
{
name: "--hmr",
description: "Enables the hot module replacement (HMR) feature",
},
forceOption,
],
},
{
name: "ios",
description: "Prepares your project for an iOS build",
options: [
{
name: "--hmr",
description: "Enables the hot module replacement (HMR) feature",
},
forceOption,
],
},
],
options: [
{
name: "--hmr",
description: "Enables the hot module replacement (HMR) feature",
},
forceOption,
helpOption("prepare"),
],
};
const buildCommand: Fig.Subcommand = {
name: "build",
description:
"Builds the project for iOS and produces an APP or IPA that you can manually deploy in the iOS Simulator or on a device",
subcommands: [
{
name: "android",
options: [
...platformOptions.build.both,
...platformOptions.build.android,
],
priority: 90,
},
{
name: "ios",
options: [...platformOptions.build.both, ...platformOptions.build.ios],
priority: 90,
},
],
options: [
...platformOptions.build.both,
{
name: "--hmr",
description: "Enables the hot module replacement (HMR) feature",
},
justLaunchOption,
helpOption("build"),
],
};
const deployCommand: Fig.Subcommand = {
name: "deploy",
description:
"Prepares, builds and deploys the project to a connected device or native emulator. You must specify the target platform on which you want to deploy. It will deploy the app on all connected devices targeting the selected platform",