-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathvtex.ts
1013 lines (1011 loc) · 28.8 KB
/
vtex.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
const commonOptions: Fig.Option[] = [
{
name: ["--help", "-h"],
description: "Show help for command",
priority: 1,
},
];
const completion: Fig.Spec = {
name: "vtex",
description:
"Fig autocomplete for VTEX IO's CLI - VTEX IO's CLI allows you to perform any action necessary to your development process, such as linking local files to the VTEX platform, managing workspaces, and releasing new app versions",
subcommands: [
{
name: "add",
description: "Adds the specified app(s) to the manifest's dependencies",
args: [
{
name: "APPID",
description:
"Name and version ({vendor}.{appname}@{x.x.x}) of the dependency to include in the manifest.json file",
},
{
name: "ITHAPPID",
description:
"Names and versions ({vendor}.{appname}@{x.x.x}) of the multiple dependencies to include in the manifest.json file",
isOptional: true,
},
],
options: [...commonOptions],
},
{
name: "autoupdate",
description: "Automatically updates VTEX IO's CLI",
args: {
name: "CHANNEL",
description: "Channel to automatically updates",
isOptional: true,
},
options: [...commonOptions],
},
{
name: "browse",
description:
"Opens the URL relative to your current workspace and account in a new browser window",
args: {
name: "PATH",
description:
"Relative path from https://{workspace}--{account}.myvtex.com/",
isOptional: true,
},
options: [
...commonOptions,
{
name: ["--qr", "-q"],
description: "Prints a QR Code on the terminal",
priority: 1,
},
],
},
{
name: "config",
description: "Env Configuration",
options: [...commonOptions],
subcommands: [
{
name: "get",
description: "Prints the value of the requested configuration key",
args: {
name: "CONFIGNAME",
description: "Configuration to retrieve the value from",
},
options: [...commonOptions],
},
{
name: "reset",
description:
"Resets the specified configuration to its default value",
args: {
name: "CONFIGNAME",
description: "Name of the configuration to reset",
},
options: [...commonOptions],
},
{
name: "set",
description: "Sets the value of a configuration key",
args: [
{
name: "CONFIGNAME",
description: "Name of the configuration to reset",
},
{
name: "VALUE",
description: "New value of the specified configuration",
},
],
options: [...commonOptions],
},
],
},
{
name: "debug dotnet",
description: "Debug .NET applications (IDEs only)",
args: {
name: "DEBUGINST",
description: "Name of the .NET application to debug",
},
options: [...commonOptions],
},
{
name: "deploy",
description:
"Publishes an app as a stable version. Only works for apps previously published as a release candidate version [see vtex publish --help]",
args: {
name: "APPID",
description: "Name and version of the app you want to deploy",
isOptional: true,
},
options: [
...commonOptions,
{
name: ["--yes", "-y"],
description: "Answers yes to all prompts",
priority: 1,
},
{
name: ["--force", "-f"],
isDangerous: true,
description:
"(Use with caution.) Ignores the testing period of 7 minutes after publishing an app",
priority: 2,
},
],
},
{
name: "deprecate",
description:
"Deprecates the specified app, uninstalling and downgrading it to the latest stable version in every VTEX account",
args: [
{
name: "APPID",
description:
"Name and version of the app ({vendor}.{appname}@{x.x.x}) to deprecate",
isOptional: true,
},
{
name: "ITHAPPID",
description:
"Names and versions of the multiple apps ({vendor}.{appname}@{x.x.x}) to deprecate",
isOptional: true,
},
],
options: [
...commonOptions,
{
name: ["--yes", "-y"],
description: "Answers yes to all prompts",
priority: 1,
},
],
},
{
name: "deps",
description:
"Displays the differences between the dependencies of two distinct workspaces. If a single parameter is passed, the specified workspace's dependencies are compared with the master's. If no parameter is passed, the diff is made between the current workspace and master",
subcommands: [
{
name: "diff",
description:
"Displays the differences between the dependencies of two distinct workspaces. If a single parameter is passed, the specified workspace's dependencies are compared with the master's. If no parameter is passed, the diff is made between the current workspace and master",
args: [
{
name: "WORKSPACE1",
description: "First workspace for comparison",
isOptional: true,
},
{
name: "WORKSPACE2",
description: "[default: master] Second workspace for comparison",
isOptional: true,
},
],
options: [...commonOptions],
},
{
name: "list",
description:
"Displays the complete dependency tree of the current workspace",
options: [
...commonOptions,
{
name: ["--keys", "-k"],
description: "Shows only key dependencies",
priority: 1,
},
{
name: ["--npm", "-n"],
description: "Includes dependencies from the npm registry",
priority: 2,
},
],
},
{
name: "update",
description:
"Updates a dependency of the current workspace. If not specified which dependency, it updates all of them",
args: [
{
name: "APPID",
description:
"Name and version of the app ({vendor}.{appname}@{x.x.x}) to update",
isOptional: true,
},
{
name: "ITHAPPID",
description:
"Names and versions of the multiple apps ({vendor}.{appname}@{x.x.x}) to update",
isOptional: true,
},
],
options: [...commonOptions],
},
],
},
{
name: "edition",
description:
"Displays the Edition App version installed on the current account",
subcommands: [
{
name: "get",
description:
"Displays the Edition App version installed on the current account",
options: [...commonOptions],
},
{
name: "set",
description: "Sets the Edition App version for the current account",
args: {
name: "EDITION",
description: "Name of the Edition App to install",
},
options: [...commonOptions],
},
],
options: [...commonOptions],
},
{
name: "help",
description: "Displays help for VTEX CLI commands",
args: {
name: "COMMAND",
description: "Command to show help about",
isOptional: true,
},
options: [
...commonOptions,
{
name: "--all",
description: "Displays all commands available in the CLI",
priority: 1,
},
],
},
{
name: "infra",
description: "Infra service",
subcommands: [
{
name: "install",
description: "Installs an infra service",
args: {
name: "SERVICEID",
description:
"Name and version of the service ({vendor}.{servicename}@{x.x.x}) to install",
},
options: [...commonOptions],
},
{
name: "list",
description: "Lists installed infra services",
args: {
name: "NAME",
description: "Service name",
isOptional: true,
},
options: [
...commonOptions,
{
name: ["--available", "-a"],
description: "Lists services that are available to install",
priority: 1,
},
{
name: ["--filter=filter", "-f"],
description: "Lists services that contain the specified word",
priority: 2,
},
],
},
{
name: "update",
description: "Updates all installed infra services",
options: [...commonOptions],
},
],
options: [...commonOptions],
},
{
name: "init",
description:
"Copies starting files and folders from VTEX boilerplates into your local directories",
options: [...commonOptions],
},
{
name: "install",
description:
"Installs an app on the current workspace. If not specified which one, it defaults to the app in the current directory",
args: [
{
name: "APPID",
description:
"Name and version of the app ({vendor}.{appname}@{x.x.x}) to install",
isOptional: true,
},
{
name: "ITHAPPID",
description:
"Names and versions of the multiple apps ({vendor}.{appname}@{x.x.x}) to install",
isOptional: true,
},
],
options: [
...commonOptions,
{
name: ["--force", "-f"],
isDangerous: true,
description:
"Installs the specified app without checking for route conflicts",
priority: 1,
},
],
},
{
name: "lighthouse",
description: "Runs a Lighthouse audit over the specified URL",
subcommands: [
{
name: "audit",
description: "Runs a Lighthouse audit over the specified URL",
args: {
name: "URL",
description: "URL to audit",
},
options: [
...commonOptions,
{
name: ["--json", "-j"],
description: "Returns the report as a json on stdout",
priority: 1,
},
],
},
{
name: "show",
description:
"Shows a previous audit report, filtering by app and/or URL",
options: [
...commonOptions,
{
name: ["--app=app", "-a"],
description: "Filters by app name",
priority: 1,
},
{
name: ["--url=url", "-u"],
description: "Filters by URL",
priority: 2,
},
],
},
],
options: [...commonOptions],
},
{
name: "lh",
description: "Runs a Lighthouse audit over the specified URL",
subcommands: [
{
name: "audit",
description: "Runs a Lighthouse audit over the specified URL",
args: {
name: "URL",
description: "URL to audit",
},
options: [
...commonOptions,
{
name: ["--json", "-j"],
description: "Returns the report as a json on stdout",
priority: 1,
},
],
},
{
name: "show",
description:
"Shows a previous audit report, filtering by app and/or URL",
options: [
...commonOptions,
{
name: ["--app=app", "-a"],
description: "Filters by app name",
priority: 1,
},
{
name: ["--url=url", "-u"],
description: "Filters by URL",
priority: 2,
},
],
},
],
options: [...commonOptions],
},
{
name: "link",
description:
"Syncs the app in the current directory with the development workspace in use",
options: [
...commonOptions,
{
name: ["--account=account", "-a"],
description:
"Starts a development session in the specified account. Must be paired with the '--workspace' flag",
priority: 1,
},
{
name: ["--clean", "-c"],
description: "Cleans builder cache",
priority: 2,
},
{
name: ["--setup", "-s"],
description:
"Sets up typing definitions before linking the app [see vtex setup --help]",
priority: 3,
},
{
name: ["--unsafe", "-u"],
description: "Allows linking the app despite Typescript errors",
priority: 4,
},
{
name: ["--workspace=workspace", "-w"],
description:
"Starts a development session in the specified workspace. Can be paired with the '--account' flag to switch from the current account and workspace",
priority: 5,
},
{
name: "--no-watch",
description: "Doesn't watch for file changes after the initial link",
priority: 6,
},
],
},
{
name: "list",
description:
"Lists the apps installed on the current workspace and account",
options: [...commonOptions],
},
{
name: "local token",
description:
"Prints the user's auth token and copies it to the clipboard",
options: [...commonOptions],
},
{
name: "login",
description: "Login to a VTEX account",
args: {
name: "ACCOUNT",
description: "Account name to log in",
isOptional: true,
},
options: [
...commonOptions,
{
name: ["--workspace=workspace", "-w"],
description: "Logs in the specified workspace",
priority: 1,
},
],
},
{
name: "logout",
description: "Logs out of the current VTEX account",
options: [...commonOptions],
},
{
name: "logs",
description: "Shows logs of an app. (Only apps in production.)",
args: {
name: "APP",
description: "Name of the app to show logs",
isOptional: true,
},
options: [
...commonOptions,
{
name: ["--all", "-a"],
description:
"Shows logs of every app installed on the current account",
priority: 1,
},
{
name: ["--past", "-p"],
description: "Shows previous logs of the specified app",
priority: 2,
},
],
},
{
name: "publish",
description:
"Publishes the app in the current directory as a release candidate version",
options: [
...commonOptions,
{
name: ["--force", "-f"],
isDangerous: true,
description: "Publishes the app independently of SemVer rules",
priority: 1,
},
{
name: ["--tag=tag", "-t"],
description: "Adds the specified tag to the release",
priority: 2,
},
{
name: ["--workspace=workspace", "-w"],
description: "Uses the specified workspace in the app registry",
priority: 3,
},
{
name: ["--yes", "-y"],
description: "Answers yes to all prompts",
priority: 4,
},
],
},
{
name: "redirects",
description: "Redirects from the current account and workspace",
subcommands: [
{
name: "delete",
description:
"Deletes redirects from the current account and workspace",
args: {
name: "CSVPATH",
description: "CSV file containing the URL paths to be deleted",
},
options: [...commonOptions],
},
{
name: "export",
description:
"Exports all redirects defined in the current account and workspace to a CSV file",
args: {
name: "CSVPATH",
description: "Name of the CSV file",
},
options: [...commonOptions],
},
{
name: "import",
description:
"Imports redirects from a CSV file to the current account and workspace",
options: [
...commonOptions,
{
name: ["--reset", "-r"],
description: "Removes all redirects previously defined",
priority: 1,
},
],
},
],
options: [...commonOptions],
},
{
name: "release",
description:
"(Only for git users.) Bumps the app version, commits, and pushes to remote the app in the current directory",
args: [
{
name: "RELEASETYPE",
description: "Release type (major, minor, or patch)",
isOptional: true,
},
{
name: "TAGNAME",
description: "Tag name (e.g., stable, beta)",
isOptional: true,
},
],
options: [...commonOptions],
},
{
name: "settings",
description: "VTEX CLI Settings",
subcommands: [
{
name: "get",
description: "",
args: [
{
name: "APNAME",
description: "Name of the app to check the available settings",
},
{
name: "FIELD",
description: "Name of the setting",
isOptional: true,
},
],
options: [...commonOptions],
},
{
name: "set",
description: "Sets value to the specified setting of an app",
args: [
{
name: "APPNAME",
description: "Name of the app",
},
{
name: "FIELD",
description: "Name of the setting",
},
{
name: "VALUE",
description: "Value of the setting",
},
],
options: [...commonOptions],
},
{
name: "unset",
description: "Disables the specified setting of an app",
args: [
{
name: "APPNAME",
description: "Name of the app",
},
{
name: "FIELD",
description: "Name of the setting",
},
],
options: [...commonOptions],
},
],
options: [...commonOptions],
},
{
name: "setup",
description:
"Sets up typings and tools for the current development environment",
options: [
...commonOptions,
{
name: ["--ignore-linked", "-i"],
description:
"Sets up types from published apps, and ignores types from linked apps",
priority: 1,
},
{
name: "--all",
description: "Sets up all available typings, configs, and tools",
priority: 2,
},
{
name: "--tooling",
description: "Sets up Prettier, Husky, and ESLint",
priority: 3,
},
{
name: "--tsconfig",
description: "Sets up React and Node TSconfig, if applicable",
priority: 4,
},
{
name: "--typings",
description: "Sets up GraphQL and React typings",
priority: 5,
},
],
},
{
name: "submit",
description:
"Submits the current app, or an specified one, to validation from VTEX App Store team",
args: {
name: "APPID",
description: "Name of the app to be validated",
isOptional: true,
},
options: [...commonOptions],
},
{
name: "support",
description: "Logs in as support to another VTEX account",
args: {
name: "ACCOUNT",
description: "Name of the account to give support",
},
options: [...commonOptions],
},
{
name: "switch",
description: "Switches to another VTEX account",
args: {
name: "ACCOUNT",
description: "Account name to log in",
},
options: [
...commonOptions,
{
name: ["--workspace=workspace", "-w"],
description: "Moves to the specified workspace",
priority: 1,
},
],
},
{
name: "test",
description: "Runs unit tests for the app in the current directory",
subcommands: [
{
name: "e2e",
description:
"Runs E2E integration tests for the app in the current directory",
options: [
...commonOptions,
{
name: ["--report=report", "-r"],
description:
"Displays the results and state of the specified test ID",
priority: 1,
},
{
name: ["--token", "-t"],
description:
"(Not recommended.) Sends your personal authorization token to your testing session, making it available during the tests. It can be dangerous since it exposes your token via the 'authToken' environment variable",
priority: 2,
},
{
name: ["--workspace", "-w"],
description:
"Runs tests for the apps installed on the specified workspace",
priority: 3,
},
],
},
{
name: "unit",
description: "Runs unit tests for the app in the current directory",
options: [
...commonOptions,
{
name: ["--unsafe", "-u"],
description: "Ignores Typescript errors",
priority: 1,
},
],
},
],
options: [...commonOptions],
},
{
name: "undeprecate",
description:
"Reestablishes a deprecated version of an app as a stable version",
args: [
{
name: "APPID",
description:
"Name and version of the app ({vendor}.{appname}@{x.x.x}) to undeprecate",
isOptional: true,
},
{
name: "ITHAPPID",
description:
"Names and versions of the multiple apps ({vendor}.{appname}@{x.x.x}) to undeprecate",
isOptional: true,
},
],
options: [
...commonOptions,
{
name: ["--yes", "-y"],
description: "Answers yes to all prompts",
priority: 1,
},
],
},
{
name: "uninstall",
description:
"Uninstalls an app from the current workspace. If not specified which app to uninstall, it defaults to the app in the current directory",
args: [
{
name: "APPNAME",
description:
"Name and version of the app ({vendor}.{appname}@{x.x.x}) to uninstall",
isOptional: true,
},
{
name: "ITHAPPNAME",
description:
"Names and versions of the multiple apps ({vendor}.{appname}@{x.x.x}) to uninstall",
isOptional: true,
},
],
options: [
...commonOptions,
{
name: ["--yes", "-y"],
description: "Answers yes to all prompts",
priority: 1,
},
],
},
{
name: "unlink",
description:
"Unlinks an app from the current workspace. If not specified which app to unlink, it defaults to the app in the current directory",
args: [
{
name: "APPID",
description:
"Name and version of the app ({vendor}.{appname}@{x.x.x}) to unlink",
isOptional: true,
},
{
name: "ITHAPPID",
description:
"Names and versions of the multiple apps ({vendor}.{appname}@{x.x.x}) to unlink",
isOptional: true,
},
],
options: [
...commonOptions,
{
name: ["--all", "-a"],
description: "Unlinks all apps",
priority: 1,
},
],
},
{
name: "update",
description:
"Updates all installed apps to the latest (minor or patch) version. Does not upgrade to another major version",
options: [...commonOptions],
},
{
name: "url",
description: "Prints base URL for the current account and workspace",
options: [...commonOptions],
},
{
name: "whoami",
description:
"Prints the current account, workspace, environment, and login details",
options: [...commonOptions],
},
{
name: "workspace",
description: "Workspace from the current account",
subcommands: [
{
name: "abtest",
description: "A/B tests from running on the current account",
subcommands: [
{
name: "finish",
description:
"Stops all A/B tests from running on the current account",
options: [...commonOptions],
},
{
name: "start",
description: "Starts a new A/B test on the current workspace",
options: [...commonOptions],
},
{
name: "status",
description: "Displays the results of the active A/B tests",
options: [...commonOptions],
},
],
options: [...commonOptions],
},
{
name: "delete",
description:
"Deletes one or many workspaces from the current account",
args: [
{
name: "WORKSPACE1",
description: "Name of the workspace to delete",
},
{
name: "ITHWORKSPACE",
description: "Name of the multiple workspaces to delete",
isOptional: true,
},
],
options: [
...commonOptions,
{
name: ["--force", "-f"],
isDangerous: true,
description:
"Deletes the specified workspace even if it is currently in use",
priority: 1,
},
{
name: ["--yes", "-y"],
description: "Answers yes to all prompts",
priority: 2,
},
],
},
{
name: "list",
description: "Lists all workspaces of the current account",
options: [...commonOptions],
},
{
name: "promote",
description:
"Promotes the current workspace to master. Only works for production workspaces",
options: [...commonOptions],
},
{
name: "reset",
description:
"Cleans all configurations of the specified workspace and recreates it with the configurations from master",
args: {
name: "WORKSPACENAME",
description: "Name of the workspace to reset",
isOptional: true,
},
options: [
...commonOptions,
{
name: ["--production", "-p"],
description: "Recreates the workspace as a production one",
priority: 1,
},
{
name: ["--yes", "-y"],
description: "Answers yes to all prompts",
priority: 2,
},
],
},
{
name: "status",
description: "Displays information about the specified workspace",
args: {
name: "WORKSPACENAME",
description: "Name of the workspace",
isOptional: true,
},
options: [...commonOptions],
},
{
name: "use",
description:
"Creates and switches to a new workspace or simply switches to an existing one",
args: {
name: "WORKSPACE",
description: "Name of the workspace to use",
},
options: [
...commonOptions,
{
name: ["--production", "-p"],
description: "Creates and/or switches to a production workspace",
priority: 1,
},
{
name: ["--reset", "-r"],