@loopress/cli 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +169 -56
  2. package/dist/commands/acf/list.d.ts +2 -2
  3. package/dist/commands/acf/list.js +2 -5
  4. package/dist/commands/acf/pull.js +9 -22
  5. package/dist/commands/acf/push.js +3 -6
  6. package/dist/commands/api/list.js +2 -1
  7. package/dist/commands/api/publish.js +6 -22
  8. package/dist/commands/api/pull.js +12 -17
  9. package/dist/commands/api/push.js +7 -10
  10. package/dist/commands/dev.js +1 -1
  11. package/dist/commands/doctor.js +2 -1
  12. package/dist/commands/form/list.d.ts +2 -4
  13. package/dist/commands/form/list.js +3 -10
  14. package/dist/commands/form/pull.js +15 -24
  15. package/dist/commands/form/push.js +17 -42
  16. package/dist/commands/login.js +6 -2
  17. package/dist/commands/logout.js +2 -1
  18. package/dist/commands/page/pull.js +17 -28
  19. package/dist/commands/page/push.js +27 -52
  20. package/dist/commands/plugin/pull.d.ts +1 -0
  21. package/dist/commands/plugin/pull.js +8 -10
  22. package/dist/commands/plugin/push.d.ts +3 -0
  23. package/dist/commands/plugin/push.js +32 -22
  24. package/dist/commands/project/config.js +4 -1
  25. package/dist/commands/project/list.d.ts +16 -1
  26. package/dist/commands/project/list.js +22 -16
  27. package/dist/commands/project/pull.js +3 -2
  28. package/dist/commands/project/push.d.ts +5 -0
  29. package/dist/commands/project/push.js +79 -58
  30. package/dist/commands/promote.d.ts +18 -0
  31. package/dist/commands/promote.js +90 -0
  32. package/dist/commands/pull.d.ts +12 -0
  33. package/dist/commands/pull.js +51 -0
  34. package/dist/commands/push.d.ts +13 -0
  35. package/dist/commands/push.js +57 -0
  36. package/dist/commands/seo/list.d.ts +9 -2
  37. package/dist/commands/seo/list.js +9 -11
  38. package/dist/commands/seo/pull.js +14 -37
  39. package/dist/commands/seo/push.js +24 -48
  40. package/dist/commands/snippet/list.js +2 -1
  41. package/dist/commands/snippet/publish.js +5 -21
  42. package/dist/commands/snippet/pull.js +15 -20
  43. package/dist/commands/snippet/push.js +21 -30
  44. package/dist/commands/validate.d.ts +8 -0
  45. package/dist/commands/validate.js +24 -0
  46. package/dist/lib/base.d.ts +9 -0
  47. package/dist/lib/base.js +51 -22
  48. package/dist/lib/guard-production-push.d.ts +12 -0
  49. package/dist/lib/guard-production-push.js +20 -0
  50. package/dist/lib/load-snippets.js +65 -60
  51. package/dist/lib/local-callback-server.js +9 -4
  52. package/dist/lib/push-command.d.ts +3 -0
  53. package/dist/lib/push-command.js +22 -15
  54. package/dist/lib/put-or-create.d.ts +13 -0
  55. package/dist/lib/put-or-create.js +19 -0
  56. package/dist/lib/readdir-tolerant.d.ts +5 -0
  57. package/dist/lib/readdir-tolerant.js +11 -0
  58. package/dist/lib/resolve-linked-project.d.ts +8 -0
  59. package/dist/lib/resolve-linked-project.js +27 -0
  60. package/dist/lib/validate-local.d.ts +10 -0
  61. package/dist/lib/validate-local.js +183 -0
  62. package/dist/utils/pluralize.d.ts +1 -0
  63. package/dist/utils/pluralize.js +5 -0
  64. package/oclif.manifest.json +242 -27
  65. package/package.json +16 -15
package/README.md CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @loopress/cli
21
21
  $ lps COMMAND
22
22
  running command...
23
23
  $ lps (--version)
24
- @loopress/cli/0.21.0 linux-x64 node-v24.18.0
24
+ @loopress/cli/0.22.0 linux-x64 node-v24.19.0
25
25
  $ lps --help [COMMAND]
26
26
  USAGE
27
27
  $ lps COMMAND
@@ -79,6 +79,9 @@ report.
79
79
  * [`lps project remove`](#lps-project-remove)
80
80
  * [`lps project rotate`](#lps-project-rotate)
81
81
  * [`lps project switch`](#lps-project-switch)
82
+ * [`lps promote FROM TO`](#lps-promote-from-to)
83
+ * [`lps pull`](#lps-pull)
84
+ * [`lps push`](#lps-push)
82
85
  * [`lps seo list`](#lps-seo-list)
83
86
  * [`lps seo pull [PATH]`](#lps-seo-pull-path)
84
87
  * [`lps seo push [PATH]`](#lps-seo-push-path)
@@ -89,6 +92,7 @@ report.
89
92
  * [`lps status`](#lps-status)
90
93
  * [`lps telemetry disable`](#lps-telemetry-disable)
91
94
  * [`lps telemetry enable`](#lps-telemetry-enable)
95
+ * [`lps validate`](#lps-validate)
92
96
 
93
97
  ## `lps acf list`
94
98
 
@@ -96,13 +100,15 @@ List ACF field groups, post types, taxonomies, and options pages from WordPress
96
100
 
97
101
  ```
98
102
  USAGE
99
- $ lps acf list [--env <value>] [-j] [--type field-groups|post-types|taxonomies|options-pages...]
103
+ $ lps acf list [--json] [--env <value>] [--type field-groups|post-types|taxonomies|options-pages...]
100
104
 
101
105
  FLAGS
102
- -j, --json Output in JSON format
103
- --env=<value> Target environment by name, overriding the globally active one (lps project switch)
104
- --type=<option>... Limit to specific ACF object types
105
- <options: field-groups|post-types|taxonomies|options-pages>
106
+ --env=<value> Target environment by name, overriding the globally active one (lps project switch)
107
+ --type=<option>... Limit to specific ACF object types
108
+ <options: field-groups|post-types|taxonomies|options-pages>
109
+
110
+ GLOBAL FLAGS
111
+ --json Format output as json.
106
112
 
107
113
  DESCRIPTION
108
114
  List ACF field groups, post types, taxonomies, and options pages from WordPress
@@ -113,7 +119,7 @@ EXAMPLES
113
119
  $ lps acf list --type field-groups
114
120
  ```
115
121
 
116
- _See code: [src/commands/acf/list.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/acf/list.ts)_
122
+ _See code: [src/commands/acf/list.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/acf/list.ts)_
117
123
 
118
124
  ## `lps acf pull [PATH]`
119
125
 
@@ -142,7 +148,7 @@ EXAMPLES
142
148
  $ lps acf pull --type field-groups
143
149
  ```
144
150
 
145
- _See code: [src/commands/acf/pull.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/acf/pull.ts)_
151
+ _See code: [src/commands/acf/pull.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/acf/pull.ts)_
146
152
 
147
153
  ## `lps acf push [PATH]`
148
154
 
@@ -171,7 +177,7 @@ EXAMPLES
171
177
  $ lps acf push --type field-groups
172
178
  ```
173
179
 
174
- _See code: [src/commands/acf/push.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/acf/push.ts)_
180
+ _See code: [src/commands/acf/push.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/acf/push.ts)_
175
181
 
176
182
  ## `lps api list`
177
183
 
@@ -194,7 +200,7 @@ EXAMPLES
194
200
  $ lps api list
195
201
  ```
196
202
 
197
- _See code: [src/commands/api/list.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/api/list.ts)_
203
+ _See code: [src/commands/api/list.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/api/list.ts)_
198
204
 
199
205
  ## `lps api publish [PATH]`
200
206
 
@@ -217,7 +223,7 @@ EXAMPLES
217
223
  $ lps api publish --path ./api
218
224
  ```
219
225
 
220
- _See code: [src/commands/api/publish.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/api/publish.ts)_
226
+ _See code: [src/commands/api/publish.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/api/publish.ts)_
221
227
 
222
228
  ## `lps api pull [PATH]`
223
229
 
@@ -247,7 +253,7 @@ EXAMPLES
247
253
  $ lps api pull --path ./api
248
254
  ```
249
255
 
250
- _See code: [src/commands/api/pull.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/api/pull.ts)_
256
+ _See code: [src/commands/api/pull.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/api/pull.ts)_
251
257
 
252
258
  ## `lps api push [PATH]`
253
259
 
@@ -277,7 +283,7 @@ EXAMPLES
277
283
  $ lps api push --path ./api
278
284
  ```
279
285
 
280
- _See code: [src/commands/api/push.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/api/push.ts)_
286
+ _See code: [src/commands/api/push.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/api/push.ts)_
281
287
 
282
288
  ## `lps composer init`
283
289
 
@@ -300,7 +306,7 @@ EXAMPLES
300
306
  $ lps composer init --dry-run
301
307
  ```
302
308
 
303
- _See code: [src/commands/composer/init.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/composer/init.ts)_
309
+ _See code: [src/commands/composer/init.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/composer/init.ts)_
304
310
 
305
311
  ## `lps composer pull`
306
312
 
@@ -326,7 +332,7 @@ EXAMPLES
326
332
  $ lps composer pull --dry-run
327
333
  ```
328
334
 
329
- _See code: [src/commands/composer/pull.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/composer/pull.ts)_
335
+ _See code: [src/commands/composer/pull.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/composer/pull.ts)_
330
336
 
331
337
  ## `lps composer push`
332
338
 
@@ -353,7 +359,7 @@ EXAMPLES
353
359
  $ lps composer push --dry-run
354
360
  ```
355
361
 
356
- _See code: [src/commands/composer/push.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/composer/push.ts)_
362
+ _See code: [src/commands/composer/push.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/composer/push.ts)_
357
363
 
358
364
  ## `lps dev`
359
365
 
@@ -379,7 +385,7 @@ EXAMPLES
379
385
  $ lps dev --skip=plugins
380
386
  ```
381
387
 
382
- _See code: [src/commands/dev.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/dev.ts)_
388
+ _See code: [src/commands/dev.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/dev.ts)_
383
389
 
384
390
  ## `lps doctor`
385
391
 
@@ -401,7 +407,7 @@ EXAMPLES
401
407
  $ lps doctor --env production
402
408
  ```
403
409
 
404
- _See code: [src/commands/doctor.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/doctor.ts)_
410
+ _See code: [src/commands/doctor.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/doctor.ts)_
405
411
 
406
412
  ## `lps form list`
407
413
 
@@ -409,11 +415,13 @@ List forms from WordPress
409
415
 
410
416
  ```
411
417
  USAGE
412
- $ lps form list [--env <value>] [-j]
418
+ $ lps form list [--json] [--env <value>]
413
419
 
414
420
  FLAGS
415
- -j, --json Output in JSON format
416
- --env=<value> Target environment by name, overriding the globally active one (lps project switch)
421
+ --env=<value> Target environment by name, overriding the globally active one (lps project switch)
422
+
423
+ GLOBAL FLAGS
424
+ --json Format output as json.
417
425
 
418
426
  DESCRIPTION
419
427
  List forms from WordPress
@@ -422,7 +430,7 @@ EXAMPLES
422
430
  $ lps form list
423
431
  ```
424
432
 
425
- _See code: [src/commands/form/list.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/form/list.ts)_
433
+ _See code: [src/commands/form/list.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/form/list.ts)_
426
434
 
427
435
  ## `lps form pull [PATH]`
428
436
 
@@ -447,7 +455,7 @@ EXAMPLES
447
455
  $ lps form pull
448
456
  ```
449
457
 
450
- _See code: [src/commands/form/pull.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/form/pull.ts)_
458
+ _See code: [src/commands/form/pull.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/form/pull.ts)_
451
459
 
452
460
  ## `lps form push [PATH]`
453
461
 
@@ -473,7 +481,7 @@ EXAMPLES
473
481
  $ lps form push
474
482
  ```
475
483
 
476
- _See code: [src/commands/form/push.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/form/push.ts)_
484
+ _See code: [src/commands/form/push.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/form/push.ts)_
477
485
 
478
486
  ## `lps help [COMMAND]`
479
487
 
@@ -493,7 +501,7 @@ DESCRIPTION
493
501
  Display help for lps.
494
502
  ```
495
503
 
496
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.56/src/commands/help.ts)_
504
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.3.0/src/commands/help.ts)_
497
505
 
498
506
  ## `lps init`
499
507
 
@@ -510,7 +518,7 @@ EXAMPLES
510
518
  $ lps init
511
519
  ```
512
520
 
513
- _See code: [src/commands/init.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/init.ts)_
521
+ _See code: [src/commands/init.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/init.ts)_
514
522
 
515
523
  ## `lps login`
516
524
 
@@ -527,7 +535,7 @@ EXAMPLES
527
535
  $ lps login
528
536
  ```
529
537
 
530
- _See code: [src/commands/login.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/login.ts)_
538
+ _See code: [src/commands/login.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/login.ts)_
531
539
 
532
540
  ## `lps logout`
533
541
 
@@ -544,7 +552,7 @@ EXAMPLES
544
552
  $ lps logout
545
553
  ```
546
554
 
547
- _See code: [src/commands/logout.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/logout.ts)_
555
+ _See code: [src/commands/logout.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/logout.ts)_
548
556
 
549
557
  ## `lps page list`
550
558
 
@@ -567,7 +575,7 @@ EXAMPLES
567
575
  $ lps page list
568
576
  ```
569
577
 
570
- _See code: [src/commands/page/list.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/page/list.ts)_
578
+ _See code: [src/commands/page/list.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/page/list.ts)_
571
579
 
572
580
  ## `lps page pull [PATH]`
573
581
 
@@ -595,7 +603,7 @@ EXAMPLES
595
603
  $ lps page pull
596
604
  ```
597
605
 
598
- _See code: [src/commands/page/pull.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/page/pull.ts)_
606
+ _See code: [src/commands/page/pull.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/page/pull.ts)_
599
607
 
600
608
  ## `lps page push [PATH]`
601
609
 
@@ -623,7 +631,7 @@ EXAMPLES
623
631
  $ lps page push
624
632
  ```
625
633
 
626
- _See code: [src/commands/page/push.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/page/push.ts)_
634
+ _See code: [src/commands/page/push.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/page/push.ts)_
627
635
 
628
636
  ## `lps plugin add SLUG`
629
637
 
@@ -649,7 +657,7 @@ EXAMPLES
649
657
  $ lps plugin add contact-form-7 --dry-run
650
658
  ```
651
659
 
652
- _See code: [src/commands/plugin/add.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/plugin/add.ts)_
660
+ _See code: [src/commands/plugin/add.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/plugin/add.ts)_
653
661
 
654
662
  ## `lps plugin pull`
655
663
 
@@ -675,7 +683,7 @@ EXAMPLES
675
683
  $ lps plugin pull --dry-run
676
684
  ```
677
685
 
678
- _See code: [src/commands/plugin/pull.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/plugin/pull.ts)_
686
+ _See code: [src/commands/plugin/pull.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/plugin/pull.ts)_
679
687
 
680
688
  ## `lps plugin push`
681
689
 
@@ -702,7 +710,7 @@ EXAMPLES
702
710
  $ lps plugin push --dry-run
703
711
  ```
704
712
 
705
- _See code: [src/commands/plugin/push.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/plugin/push.ts)_
713
+ _See code: [src/commands/plugin/push.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/plugin/push.ts)_
706
714
 
707
715
  ## `lps project config`
708
716
 
@@ -720,7 +728,7 @@ EXAMPLES
720
728
  $ lps project config
721
729
  ```
722
730
 
723
- _See code: [src/commands/project/config.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/project/config.ts)_
731
+ _See code: [src/commands/project/config.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/project/config.ts)_
724
732
 
725
733
  ## `lps project list`
726
734
 
@@ -728,7 +736,10 @@ List configured WordPress projects
728
736
 
729
737
  ```
730
738
  USAGE
731
- $ lps project list
739
+ $ lps project list [--json]
740
+
741
+ GLOBAL FLAGS
742
+ --json Format output as json.
732
743
 
733
744
  DESCRIPTION
734
745
  List configured WordPress projects
@@ -737,7 +748,7 @@ EXAMPLES
737
748
  $ lps project list
738
749
  ```
739
750
 
740
- _See code: [src/commands/project/list.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/project/list.ts)_
751
+ _See code: [src/commands/project/list.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/project/list.ts)_
741
752
 
742
753
  ## `lps project pull`
743
754
 
@@ -754,7 +765,7 @@ EXAMPLES
754
765
  $ lps project pull
755
766
  ```
756
767
 
757
- _See code: [src/commands/project/pull.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/project/pull.ts)_
768
+ _See code: [src/commands/project/pull.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/project/pull.ts)_
758
769
 
759
770
  ## `lps project push`
760
771
 
@@ -774,7 +785,7 @@ EXAMPLES
774
785
  $ lps project push
775
786
  ```
776
787
 
777
- _See code: [src/commands/project/push.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/project/push.ts)_
788
+ _See code: [src/commands/project/push.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/project/push.ts)_
778
789
 
779
790
  ## `lps project remove`
780
791
 
@@ -791,7 +802,7 @@ EXAMPLES
791
802
  $ lps project remove
792
803
  ```
793
804
 
794
- _See code: [src/commands/project/remove.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/project/remove.ts)_
805
+ _See code: [src/commands/project/remove.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/project/remove.ts)_
795
806
 
796
807
  ## `lps project rotate`
797
808
 
@@ -813,7 +824,7 @@ EXAMPLES
813
824
  $ lps project rotate --env staging
814
825
  ```
815
826
 
816
- _See code: [src/commands/project/rotate.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/project/rotate.ts)_
827
+ _See code: [src/commands/project/rotate.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/project/rotate.ts)_
817
828
 
818
829
  ## `lps project switch`
819
830
 
@@ -830,7 +841,87 @@ EXAMPLES
830
841
  $ lps project switch
831
842
  ```
832
843
 
833
- _See code: [src/commands/project/switch.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/project/switch.ts)_
844
+ _See code: [src/commands/project/switch.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/project/switch.ts)_
845
+
846
+ ## `lps promote FROM TO`
847
+
848
+ Copy every tracked resource from one environment to another by pulling from <from> then pushing to <to>. Local tracked files are overwritten with <from> in the process.
849
+
850
+ ```
851
+ USAGE
852
+ $ lps promote FROM TO [-d] [-y]
853
+
854
+ ARGUMENTS
855
+ FROM Environment to copy the configuration from
856
+ TO Environment to copy the configuration to
857
+
858
+ FLAGS
859
+ -d, --dry-run Show what would change without making changes
860
+ -y, --yes Answer yes to confirmation prompts
861
+
862
+ DESCRIPTION
863
+ Copy every tracked resource from one environment to another by pulling from <from> then pushing to <to>. Local tracked
864
+ files are overwritten with <from> in the process.
865
+
866
+ EXAMPLES
867
+ $ lps promote staging production
868
+
869
+ $ lps promote production staging --dry-run
870
+ ```
871
+
872
+ _See code: [src/commands/promote.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/promote.ts)_
873
+
874
+ ## `lps pull`
875
+
876
+ Pull all content, plugins, composer dependencies, ACF, API routes, forms, pages, SEO, and snippets, from WordPress
877
+
878
+ ```
879
+ USAGE
880
+ $ lps pull [--env <value>] [-d] [-y]
881
+
882
+ FLAGS
883
+ -d, --dry-run Show what would change without making changes
884
+ -y, --yes Answer yes to confirmation prompts
885
+ --env=<value> Target environment by name, overriding the globally active one (lps project switch)
886
+
887
+ DESCRIPTION
888
+ Pull all content, plugins, composer dependencies, ACF, API routes, forms, pages, SEO, and snippets, from WordPress
889
+
890
+ EXAMPLES
891
+ $ lps pull
892
+
893
+ $ lps pull --env staging
894
+
895
+ $ lps pull --dry-run
896
+ ```
897
+
898
+ _See code: [src/commands/pull.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/pull.ts)_
899
+
900
+ ## `lps push`
901
+
902
+ Push all local content, plugins, composer dependencies, ACF, API routes, forms, pages, SEO, and snippets, to WordPress
903
+
904
+ ```
905
+ USAGE
906
+ $ lps push [--env <value>] [-d] [-y]
907
+
908
+ FLAGS
909
+ -d, --dry-run Show what would change without making changes
910
+ -y, --yes Answer yes to confirmation prompts
911
+ --env=<value> Target environment by name, overriding the globally active one (lps project switch)
912
+
913
+ DESCRIPTION
914
+ Push all local content, plugins, composer dependencies, ACF, API routes, forms, pages, SEO, and snippets, to WordPress
915
+
916
+ EXAMPLES
917
+ $ lps push
918
+
919
+ $ lps push --env staging
920
+
921
+ $ lps push --dry-run
922
+ ```
923
+
924
+ _See code: [src/commands/push.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/push.ts)_
834
925
 
835
926
  ## `lps seo list`
836
927
 
@@ -838,12 +929,14 @@ List posts with SEO meta, and redirects if supported by the active SEO plugin, o
838
929
 
839
930
  ```
840
931
  USAGE
841
- $ lps seo list [--env <value>] [-j] [--post-type <value>...]
932
+ $ lps seo list [--json] [--env <value>] [--post-type <value>...]
842
933
 
843
934
  FLAGS
844
- -j, --json Output in JSON format
845
- --env=<value> Target environment by name, overriding the globally active one (lps project switch)
846
- --post-type=<value>... Limit to specific post types
935
+ --env=<value> Target environment by name, overriding the globally active one (lps project switch)
936
+ --post-type=<value>... Limit to specific post types
937
+
938
+ GLOBAL FLAGS
939
+ --json Format output as json.
847
940
 
848
941
  DESCRIPTION
849
942
  List posts with SEO meta, and redirects if supported by the active SEO plugin, on WordPress
@@ -854,7 +947,7 @@ EXAMPLES
854
947
  $ lps seo list --post-type post
855
948
  ```
856
949
 
857
- _See code: [src/commands/seo/list.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/seo/list.ts)_
950
+ _See code: [src/commands/seo/list.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/seo/list.ts)_
858
951
 
859
952
  ## `lps seo pull [PATH]`
860
953
 
@@ -882,7 +975,7 @@ EXAMPLES
882
975
  $ lps seo pull --post-type post --post-type page
883
976
  ```
884
977
 
885
- _See code: [src/commands/seo/pull.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/seo/pull.ts)_
978
+ _See code: [src/commands/seo/pull.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/seo/pull.ts)_
886
979
 
887
980
  ## `lps seo push [PATH]`
888
981
 
@@ -908,7 +1001,7 @@ EXAMPLES
908
1001
  $ lps seo push
909
1002
  ```
910
1003
 
911
- _See code: [src/commands/seo/push.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/seo/push.ts)_
1004
+ _See code: [src/commands/seo/push.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/seo/push.ts)_
912
1005
 
913
1006
  ## `lps snippet list`
914
1007
 
@@ -931,7 +1024,7 @@ EXAMPLES
931
1024
  $ lps snippet list
932
1025
  ```
933
1026
 
934
- _See code: [src/commands/snippet/list.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/snippet/list.ts)_
1027
+ _See code: [src/commands/snippet/list.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/snippet/list.ts)_
935
1028
 
936
1029
  ## `lps snippet publish [PATH]`
937
1030
 
@@ -954,7 +1047,7 @@ EXAMPLES
954
1047
  $ lps snippet publish --path ./snippets
955
1048
  ```
956
1049
 
957
- _See code: [src/commands/snippet/publish.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/snippet/publish.ts)_
1050
+ _See code: [src/commands/snippet/publish.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/snippet/publish.ts)_
958
1051
 
959
1052
  ## `lps snippet pull [PATH]`
960
1053
 
@@ -984,7 +1077,7 @@ EXAMPLES
984
1077
  $ lps snippet pull --path ./snippets
985
1078
  ```
986
1079
 
987
- _See code: [src/commands/snippet/pull.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/snippet/pull.ts)_
1080
+ _See code: [src/commands/snippet/pull.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/snippet/pull.ts)_
988
1081
 
989
1082
  ## `lps snippet push [PATH]`
990
1083
 
@@ -1015,7 +1108,7 @@ EXAMPLES
1015
1108
  $ lps snippet push --path ./snippets
1016
1109
  ```
1017
1110
 
1018
- _See code: [src/commands/snippet/push.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/snippet/push.ts)_
1111
+ _See code: [src/commands/snippet/push.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/snippet/push.ts)_
1019
1112
 
1020
1113
  ## `lps status`
1021
1114
 
@@ -1040,7 +1133,7 @@ EXAMPLES
1040
1133
  $ lps status --env staging
1041
1134
  ```
1042
1135
 
1043
- _See code: [src/commands/status.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/status.ts)_
1136
+ _See code: [src/commands/status.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/status.ts)_
1044
1137
 
1045
1138
  ## `lps telemetry disable`
1046
1139
 
@@ -1057,7 +1150,7 @@ EXAMPLES
1057
1150
  $ lps telemetry disable
1058
1151
  ```
1059
1152
 
1060
- _See code: [src/commands/telemetry/disable.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/telemetry/disable.ts)_
1153
+ _See code: [src/commands/telemetry/disable.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/telemetry/disable.ts)_
1061
1154
 
1062
1155
  ## `lps telemetry enable`
1063
1156
 
@@ -1074,5 +1167,25 @@ EXAMPLES
1074
1167
  $ lps telemetry enable
1075
1168
  ```
1076
1169
 
1077
- _See code: [src/commands/telemetry/enable.ts](https://github.com/loopress/loopress/blob/v0.21.0/src/commands/telemetry/enable.ts)_
1170
+ _See code: [src/commands/telemetry/enable.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/telemetry/enable.ts)_
1171
+
1172
+ ## `lps validate`
1173
+
1174
+ Check local tracked files are well formed and push-ready, without contacting WordPress
1175
+
1176
+ ```
1177
+ USAGE
1178
+ $ lps validate [--json]
1179
+
1180
+ GLOBAL FLAGS
1181
+ --json Format output as json.
1182
+
1183
+ DESCRIPTION
1184
+ Check local tracked files are well formed and push-ready, without contacting WordPress
1185
+
1186
+ EXAMPLES
1187
+ $ lps validate
1188
+ ```
1189
+
1190
+ _See code: [src/commands/validate.ts](https://github.com/loopress/loopress/blob/v0.22.0/src/commands/validate.ts)_
1078
1191
  <!-- commandsstop -->
@@ -1,10 +1,10 @@
1
1
  import { LoopressCommand } from '../../lib/base.js';
2
2
  export default class List extends LoopressCommand {
3
3
  static description: string;
4
+ static enableJsonFlag: boolean;
4
5
  static examples: string[];
5
6
  static flags: {
6
- json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
7
  type: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
8
  };
9
- run(): Promise<void>;
9
+ run(): Promise<Record<string, Array<Record<string, unknown>>>>;
10
10
  }
@@ -3,9 +3,9 @@ import { LoopressCommand } from '../../lib/base.js';
3
3
  import { ACF_OBJECT_TYPES, acfEndpoint, getAcfKey } from '../../utils/acf-format.js';
4
4
  export default class List extends LoopressCommand {
5
5
  static description = 'List ACF field groups, post types, taxonomies, and options pages from WordPress';
6
+ static enableJsonFlag = true;
6
7
  static examples = ['$ lps acf list', '$ lps acf list --type field-groups'];
7
8
  static flags = {
8
- json: Flags.boolean({ char: 'j', description: 'Output in JSON format' }),
9
9
  type: Flags.string({ description: 'Limit to specific ACF object types', multiple: true, options: ACF_OBJECT_TYPES }),
10
10
  };
11
11
  async run() {
@@ -15,10 +15,6 @@ export default class List extends LoopressCommand {
15
15
  for (const type of types) {
16
16
  byType[type] = await this.wp.get(acfEndpoint(type));
17
17
  }
18
- if (flags.json) {
19
- this.log(JSON.stringify(byType, null, 2));
20
- return;
21
- }
22
18
  for (const type of types) {
23
19
  const objects = byType[type];
24
20
  this.log(`${type} (${objects.length}):`);
@@ -33,5 +29,6 @@ export default class List extends LoopressCommand {
33
29
  }
34
30
  this.log('');
35
31
  }
32
+ return byType;
36
33
  }
37
34
  }
@@ -1,6 +1,5 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
- import { Listr } from 'listr2';
3
- import { mkdir, writeFile } from 'node:fs/promises';
2
+ import { writeFile } from 'node:fs/promises';
4
3
  import { join } from 'node:path';
5
4
  import { LoopressCommand } from '../../lib/base.js';
6
5
  import { basenameKey, findOrphanedFiles } from '../../lib/find-orphaned-files.js';
@@ -39,27 +38,15 @@ export default class Pull extends LoopressCommand {
39
38
  extensions: ['.json'],
40
39
  key: basenameKey,
41
40
  });
42
- if (this.dryRun) {
43
- this.log(`[dry-run] Would pull ${withKey.length} ${type} to ${dir}`);
44
- if (orphans.length > 0) {
45
- this.log(`[dry-run] Would remove ${orphans.length} local file${orphans.length === 1 ? '' : 's'} in ${dir} no longer present on WordPress: ${orphans.join(', ')}`);
46
- }
41
+ await this.pullDirectory(dir, withKey, orphans, {
42
+ dryRunMessage: `Would pull ${withKey.length} ${type} to ${dir}`,
43
+ orphanReason: `in ${dir} no longer present on WordPress`,
44
+ pulledMessage: `Pulled ${withKey.length} ${type} to ${dir}`,
45
+ title: (object) => getAcfKey(object),
46
+ write: async (object, writeDir) => writeFile(join(writeDir, `${getAcfKey(object)}.json`), JSON.stringify(object, null, 2) + '\n'),
47
+ });
48
+ if (this.dryRun)
47
49
  return;
48
- }
49
- if (withKey.length > 0)
50
- await mkdir(dir, { recursive: true });
51
- await new Listr(withKey.map((object) => {
52
- const key = getAcfKey(object);
53
- return {
54
- async task(_ctx, task) {
55
- await writeFile(join(dir, `${key}.json`), JSON.stringify(object, null, 2) + '\n');
56
- task.output = `Pulled: ${key}`;
57
- },
58
- title: `Pull ${key}`,
59
- };
60
- })).run();
61
- await this.removeOrphanedFiles(dir, orphans, `in ${dir} no longer present on WordPress`);
62
- this.log(`Pulled ${withKey.length} ${type} to ${dir}`);
63
50
  if (skipped > 0) {
64
51
  this.warn(`${skipped} ${type} skipped because they have no key`);
65
52
  }
@@ -1,9 +1,9 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
- import { Listr } from 'listr2';
3
2
  import { join } from 'node:path';
4
3
  import { loadFiles } from '../../lib/load-files.js';
5
4
  import { PushCommand } from '../../lib/push-command.js';
6
5
  import { ACF_OBJECT_TYPES, acfEndpoint, getAcfKey } from '../../utils/acf-format.js';
6
+ import { pluralize } from '../../utils/pluralize.js';
7
7
  export default class Push extends PushCommand {
8
8
  static args = {
9
9
  path: Args.string({ description: 'Path to ACF directory (overrides project config)' }),
@@ -26,7 +26,7 @@ export default class Push extends PushCommand {
26
26
  await this.pushType(type, path);
27
27
  }
28
28
  if (this.failedCount > 0) {
29
- this.error(`${this.failedCount} ACF object${this.failedCount === 1 ? '' : 's'} failed to push.`);
29
+ this.error(`${pluralize(this.failedCount, 'ACF object')} failed to push.`);
30
30
  }
31
31
  if (this.dryRun)
32
32
  return;
@@ -71,9 +71,6 @@ export default class Push extends PushCommand {
71
71
  if (objects.length === 0)
72
72
  return;
73
73
  this.log(`Found ${objects.length} ${type} to push`);
74
- await new Listr(objects.map((object) => ({
75
- task: async (_ctx, task) => this.pushObject(type, object, task),
76
- title: `Push ${getAcfKey(object) ?? '(unknown)'}`,
77
- })), { concurrent: false, exitOnError: false }).run();
74
+ await this.runPushTasks(objects, (object) => getAcfKey(object) ?? '(unknown)', async (object, task) => this.pushObject(type, object, task));
78
75
  }
79
76
  }