@loopress/cli 0.2.0 → 0.4.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.
package/README.md CHANGED
@@ -1,58 +1,53 @@
1
- Loopress
2
- =================
1
+ # Loopress
3
2
 
4
3
  A new CLI generated with oclif
5
4
 
6
-
7
5
  [![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
8
6
  [![Version](https://img.shields.io/npm/v/mynewcli.svg)](https://npmjs.org/package/mynewcli)
9
7
  [![Downloads/week](https://img.shields.io/npm/dw/mynewcli.svg)](https://npmjs.org/package/mynewcli)
10
8
 
11
-
12
9
  <!-- toc -->
10
+ * [Loopress](#loopress)
13
11
  * [Usage](#usage)
14
12
  * [Commands](#commands)
15
13
  <!-- tocstop -->
14
+
16
15
  # Usage
16
+
17
17
  <!-- usage -->
18
18
  ```sh-session
19
19
  $ npm install -g @loopress/cli
20
20
  $ lps COMMAND
21
21
  running command...
22
22
  $ lps (--version)
23
- @loopress/cli/0.2.0 linux-x64 node-v24.16.0
23
+ @loopress/cli/0.4.0 linux-x64 node-v24.16.0
24
24
  $ lps --help [COMMAND]
25
25
  USAGE
26
26
  $ lps COMMAND
27
27
  ...
28
28
  ```
29
29
  <!-- usagestop -->
30
+
30
31
  # Commands
32
+
31
33
  <!-- commands -->
32
34
  * [`lps help [COMMAND]`](#lps-help-command)
33
35
  * [`lps login`](#lps-login)
34
36
  * [`lps logout`](#lps-logout)
35
- * [`lps plugins`](#lps-plugins)
36
- * [`lps plugins add PLUGIN`](#lps-plugins-add-plugin)
37
- * [`lps plugins:inspect PLUGIN...`](#lps-pluginsinspect-plugin)
38
- * [`lps plugins install PLUGIN`](#lps-plugins-install-plugin)
39
- * [`lps plugins link PATH`](#lps-plugins-link-path)
40
- * [`lps plugins remove [PLUGIN]`](#lps-plugins-remove-plugin)
41
- * [`lps plugins reset`](#lps-plugins-reset)
42
- * [`lps plugins uninstall [PLUGIN]`](#lps-plugins-uninstall-plugin)
43
- * [`lps plugins unlink [PLUGIN]`](#lps-plugins-unlink-plugin)
44
- * [`lps plugins update`](#lps-plugins-update)
37
+ * [`lps plugin pull`](#lps-plugin-pull)
38
+ * [`lps plugin push`](#lps-plugin-push)
39
+ * [`lps plugin require SLUG [VERSION]`](#lps-plugin-require-slug-version)
45
40
  * [`lps project config`](#lps-project-config)
46
41
  * [`lps project list`](#lps-project-list)
47
42
  * [`lps project remove`](#lps-project-remove)
48
43
  * [`lps project remove-env`](#lps-project-remove-env)
49
44
  * [`lps project switch`](#lps-project-switch)
50
45
  * [`lps project switch-env`](#lps-project-switch-env)
51
- * [`lps snippets list`](#lps-snippets-list)
52
- * [`lps snippets pull [PATH]`](#lps-snippets-pull-path)
53
- * [`lps snippets push [PATH]`](#lps-snippets-push-path)
54
- * [`lps styles pull`](#lps-styles-pull)
55
- * [`lps styles push`](#lps-styles-push)
46
+ * [`lps snippet list`](#lps-snippet-list)
47
+ * [`lps snippet pull [PATH]`](#lps-snippet-pull-path)
48
+ * [`lps snippet push [PATH]`](#lps-snippet-push-path)
49
+ * [`lps style pull`](#lps-style-pull)
50
+ * [`lps style push`](#lps-style-push)
56
51
 
57
52
  ## `lps help [COMMAND]`
58
53
 
@@ -89,7 +84,7 @@ EXAMPLES
89
84
  $ lps login
90
85
  ```
91
86
 
92
- _See code: [src/commands/login.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/login.ts)_
87
+ _See code: [src/commands/login.ts](https://github.com/loopress/loopress/blob/v0.4.0/src/commands/login.ts)_
93
88
 
94
89
  ## `lps logout`
95
90
 
@@ -106,297 +101,94 @@ EXAMPLES
106
101
  $ lps logout
107
102
  ```
108
103
 
109
- _See code: [src/commands/logout.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/logout.ts)_
104
+ _See code: [src/commands/logout.ts](https://github.com/loopress/loopress/blob/v0.4.0/src/commands/logout.ts)_
110
105
 
111
- ## `lps plugins`
106
+ ## `lps plugin pull`
112
107
 
113
- List installed plugins.
108
+ Pull installed plugins from WordPress into loopress.json
114
109
 
115
110
  ```
116
111
  USAGE
117
- $ lps plugins [--json] [--core]
112
+ $ lps plugin pull [--password <value>] [--url <value>] [--user <value>] [-d]
118
113
 
119
114
  FLAGS
120
- --core Show core plugins.
115
+ -d, --dry-run Show what would be written without making changes
121
116
 
122
117
  GLOBAL FLAGS
123
- --json Format output as json.
118
+ --password=<value> WordPress application password (fallback; prefer `lps project config`)
119
+ --url=<value> WordPress URL (fallback; prefer `lps project config`)
120
+ --user=<value> WordPress username (fallback; prefer `lps project config`)
124
121
 
125
122
  DESCRIPTION
126
- List installed plugins.
123
+ Pull installed plugins from WordPress into loopress.json
127
124
 
128
125
  EXAMPLES
129
- $ lps plugins
130
- ```
131
-
132
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.74/src/commands/plugins/index.ts)_
133
-
134
- ## `lps plugins add PLUGIN`
135
-
136
- Installs a plugin into lps.
126
+ $ lps plugins pull
137
127
 
128
+ $ lps plugins pull --dry-run
138
129
  ```
139
- USAGE
140
- $ lps plugins add PLUGIN... [--json] [-f] [-h] [-s | -v]
141
-
142
- ARGUMENTS
143
- PLUGIN... Plugin to install.
144
-
145
- FLAGS
146
- -f, --force Force npm to fetch remote resources even if a local copy exists on disk.
147
- -h, --help Show CLI help.
148
- -s, --silent Silences npm output.
149
- -v, --verbose Show verbose npm output.
150
-
151
- GLOBAL FLAGS
152
- --json Format output as json.
153
-
154
- DESCRIPTION
155
- Installs a plugin into lps.
156
130
 
157
- Uses npm to install plugins.
131
+ _See code: [src/commands/plugin/pull.ts](https://github.com/loopress/loopress/blob/v0.4.0/src/commands/plugin/pull.ts)_
158
132
 
159
- Installation of a user-installed plugin will override a core plugin.
160
-
161
- Use the LPS_NPM_LOG_LEVEL environment variable to set the npm loglevel.
162
- Use the LPS_NPM_REGISTRY environment variable to set the npm registry.
163
-
164
- ALIASES
165
- $ lps plugins add
166
-
167
- EXAMPLES
168
- Install a plugin from npm registry.
133
+ ## `lps plugin push`
169
134
 
170
- $ lps plugins add myplugin
171
-
172
- Install a plugin from a github url.
173
-
174
- $ lps plugins add https://github.com/someuser/someplugin
175
-
176
- Install a plugin from a github slug.
177
-
178
- $ lps plugins add someuser/someplugin
179
- ```
180
-
181
- ## `lps plugins:inspect PLUGIN...`
182
-
183
- Displays installation properties of a plugin.
135
+ Sync plugins on WordPress to match loopress.json
184
136
 
185
137
  ```
186
138
  USAGE
187
- $ lps plugins inspect PLUGIN...
188
-
189
- ARGUMENTS
190
- PLUGIN... [default: .] Plugin to inspect.
139
+ $ lps plugin push [--password <value>] [--url <value>] [--user <value>] [-d]
191
140
 
192
141
  FLAGS
193
- -h, --help Show CLI help.
194
- -v, --verbose
142
+ -d, --dry-run Show what would change without making changes
195
143
 
196
144
  GLOBAL FLAGS
197
- --json Format output as json.
198
-
199
- DESCRIPTION
200
- Displays installation properties of a plugin.
201
-
202
- EXAMPLES
203
- $ lps plugins inspect myplugin
204
- ```
205
-
206
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.74/src/commands/plugins/inspect.ts)_
207
-
208
- ## `lps plugins install PLUGIN`
209
-
210
- Installs a plugin into lps.
211
-
212
- ```
213
- USAGE
214
- $ lps plugins install PLUGIN... [--json] [-f] [-h] [-s | -v]
215
-
216
- ARGUMENTS
217
- PLUGIN... Plugin to install.
218
-
219
- FLAGS
220
- -f, --force Force npm to fetch remote resources even if a local copy exists on disk.
221
- -h, --help Show CLI help.
222
- -s, --silent Silences npm output.
223
- -v, --verbose Show verbose npm output.
224
-
225
- GLOBAL FLAGS
226
- --json Format output as json.
227
-
228
- DESCRIPTION
229
- Installs a plugin into lps.
230
-
231
- Uses npm to install plugins.
232
-
233
- Installation of a user-installed plugin will override a core plugin.
234
-
235
- Use the LPS_NPM_LOG_LEVEL environment variable to set the npm loglevel.
236
- Use the LPS_NPM_REGISTRY environment variable to set the npm registry.
237
-
238
- ALIASES
239
- $ lps plugins add
240
-
241
- EXAMPLES
242
- Install a plugin from npm registry.
243
-
244
- $ lps plugins install myplugin
245
-
246
- Install a plugin from a github url.
247
-
248
- $ lps plugins install https://github.com/someuser/someplugin
249
-
250
- Install a plugin from a github slug.
251
-
252
- $ lps plugins install someuser/someplugin
253
- ```
254
-
255
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.74/src/commands/plugins/install.ts)_
256
-
257
- ## `lps plugins link PATH`
258
-
259
- Links a plugin into the CLI for development.
260
-
261
- ```
262
- USAGE
263
- $ lps plugins link PATH [-h] [--install] [-v]
264
-
265
- ARGUMENTS
266
- PATH [default: .] path to plugin
267
-
268
- FLAGS
269
- -h, --help Show CLI help.
270
- -v, --verbose
271
- --[no-]install Install dependencies after linking the plugin.
272
-
273
- DESCRIPTION
274
- Links a plugin into the CLI for development.
275
-
276
- Installation of a linked plugin will override a user-installed or core plugin.
277
-
278
- e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
279
- command will override the user-installed or core plugin implementation. This is useful for development work.
280
-
281
-
282
- EXAMPLES
283
- $ lps plugins link myplugin
284
- ```
285
-
286
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.74/src/commands/plugins/link.ts)_
287
-
288
- ## `lps plugins remove [PLUGIN]`
289
-
290
- Removes a plugin from the CLI.
291
-
292
- ```
293
- USAGE
294
- $ lps plugins remove [PLUGIN...] [-h] [-v]
295
-
296
- ARGUMENTS
297
- [PLUGIN...] plugin to uninstall
298
-
299
- FLAGS
300
- -h, --help Show CLI help.
301
- -v, --verbose
145
+ --password=<value> WordPress application password (fallback; prefer `lps project config`)
146
+ --url=<value> WordPress URL (fallback; prefer `lps project config`)
147
+ --user=<value> WordPress username (fallback; prefer `lps project config`)
302
148
 
303
149
  DESCRIPTION
304
- Removes a plugin from the CLI.
305
-
306
- ALIASES
307
- $ lps plugins unlink
308
- $ lps plugins remove
150
+ Sync plugins on WordPress to match loopress.json
309
151
 
310
152
  EXAMPLES
311
- $ lps plugins remove myplugin
312
- ```
313
-
314
- ## `lps plugins reset`
153
+ $ lps plugins push
315
154
 
316
- Remove all user-installed and linked plugins.
317
-
318
- ```
319
- USAGE
320
- $ lps plugins reset [--hard] [--reinstall]
321
-
322
- FLAGS
323
- --hard Delete node_modules and package manager related files in addition to uninstalling plugins.
324
- --reinstall Reinstall all plugins after uninstalling.
155
+ $ lps plugins push --dry-run
325
156
  ```
326
157
 
327
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.74/src/commands/plugins/reset.ts)_
158
+ _See code: [src/commands/plugin/push.ts](https://github.com/loopress/loopress/blob/v0.4.0/src/commands/plugin/push.ts)_
328
159
 
329
- ## `lps plugins uninstall [PLUGIN]`
160
+ ## `lps plugin require SLUG [VERSION]`
330
161
 
331
- Removes a plugin from the CLI.
162
+ Add a plugin to loopress.json, resolving its latest version from WordPress.org
332
163
 
333
164
  ```
334
165
  USAGE
335
- $ lps plugins uninstall [PLUGIN...] [-h] [-v]
166
+ $ lps plugin require SLUG [VERSION] [--password <value>] [--url <value>] [--user <value>] [-d]
336
167
 
337
168
  ARGUMENTS
338
- [PLUGIN...] plugin to uninstall
169
+ SLUG Plugin slug (WordPress.org)
170
+ [VERSION] Version to pin (default: latest)
339
171
 
340
172
  FLAGS
341
- -h, --help Show CLI help.
342
- -v, --verbose
343
-
344
- DESCRIPTION
345
- Removes a plugin from the CLI.
346
-
347
- ALIASES
348
- $ lps plugins unlink
349
- $ lps plugins remove
350
-
351
- EXAMPLES
352
- $ lps plugins uninstall myplugin
353
- ```
354
-
355
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.74/src/commands/plugins/uninstall.ts)_
356
-
357
- ## `lps plugins unlink [PLUGIN]`
358
-
359
- Removes a plugin from the CLI.
360
-
361
- ```
362
- USAGE
363
- $ lps plugins unlink [PLUGIN...] [-h] [-v]
173
+ -d, --dry-run Show what would be written without making changes
364
174
 
365
- ARGUMENTS
366
- [PLUGIN...] plugin to uninstall
367
-
368
- FLAGS
369
- -h, --help Show CLI help.
370
- -v, --verbose
175
+ GLOBAL FLAGS
176
+ --password=<value> WordPress application password (fallback; prefer `lps project config`)
177
+ --url=<value> WordPress URL (fallback; prefer `lps project config`)
178
+ --user=<value> WordPress username (fallback; prefer `lps project config`)
371
179
 
372
180
  DESCRIPTION
373
- Removes a plugin from the CLI.
374
-
375
- ALIASES
376
- $ lps plugins unlink
377
- $ lps plugins remove
181
+ Add a plugin to loopress.json, resolving its latest version from WordPress.org
378
182
 
379
183
  EXAMPLES
380
- $ lps plugins unlink myplugin
381
- ```
382
-
383
- ## `lps plugins update`
384
-
385
- Update installed plugins.
386
-
387
- ```
388
- USAGE
389
- $ lps plugins update [-h] [-v]
184
+ $ lps plugins require woocommerce
390
185
 
391
- FLAGS
392
- -h, --help Show CLI help.
393
- -v, --verbose
186
+ $ lps plugins require woocommerce 8.9.1
394
187
 
395
- DESCRIPTION
396
- Update installed plugins.
188
+ $ lps plugins require contact-form-7 --dry-run
397
189
  ```
398
190
 
399
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.74/src/commands/plugins/update.ts)_
191
+ _See code: [src/commands/plugin/require.ts](https://github.com/loopress/loopress/blob/v0.4.0/src/commands/plugin/require.ts)_
400
192
 
401
193
  ## `lps project config`
402
194
 
@@ -413,7 +205,7 @@ EXAMPLES
413
205
  $ lps project config
414
206
  ```
415
207
 
416
- _See code: [src/commands/project/config.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/project/config.ts)_
208
+ _See code: [src/commands/project/config.ts](https://github.com/loopress/loopress/blob/v0.4.0/src/commands/project/config.ts)_
417
209
 
418
210
  ## `lps project list`
419
211
 
@@ -430,7 +222,7 @@ EXAMPLES
430
222
  $ lps project list
431
223
  ```
432
224
 
433
- _See code: [src/commands/project/list.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/project/list.ts)_
225
+ _See code: [src/commands/project/list.ts](https://github.com/loopress/loopress/blob/v0.4.0/src/commands/project/list.ts)_
434
226
 
435
227
  ## `lps project remove`
436
228
 
@@ -447,7 +239,7 @@ EXAMPLES
447
239
  $ lps project remove
448
240
  ```
449
241
 
450
- _See code: [src/commands/project/remove.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/project/remove.ts)_
242
+ _See code: [src/commands/project/remove.ts](https://github.com/loopress/loopress/blob/v0.4.0/src/commands/project/remove.ts)_
451
243
 
452
244
  ## `lps project remove-env`
453
245
 
@@ -464,7 +256,7 @@ EXAMPLES
464
256
  $ lps project remove-env
465
257
  ```
466
258
 
467
- _See code: [src/commands/project/remove-env.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/project/remove-env.ts)_
259
+ _See code: [src/commands/project/remove-env.ts](https://github.com/loopress/loopress/blob/v0.4.0/src/commands/project/remove-env.ts)_
468
260
 
469
261
  ## `lps project switch`
470
262
 
@@ -481,7 +273,7 @@ EXAMPLES
481
273
  $ lps project switch
482
274
  ```
483
275
 
484
- _See code: [src/commands/project/switch.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/project/switch.ts)_
276
+ _See code: [src/commands/project/switch.ts](https://github.com/loopress/loopress/blob/v0.4.0/src/commands/project/switch.ts)_
485
277
 
486
278
  ## `lps project switch-env`
487
279
 
@@ -498,15 +290,15 @@ EXAMPLES
498
290
  $ lps project switch-env
499
291
  ```
500
292
 
501
- _See code: [src/commands/project/switch-env.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/project/switch-env.ts)_
293
+ _See code: [src/commands/project/switch-env.ts](https://github.com/loopress/loopress/blob/v0.4.0/src/commands/project/switch-env.ts)_
502
294
 
503
- ## `lps snippets list`
295
+ ## `lps snippet list`
504
296
 
505
297
  List snippets from WordPress
506
298
 
507
299
  ```
508
300
  USAGE
509
- $ lps snippets list [--password <value>] [--url <value>] [--user <value>] [-j] [-p code-snippets|wpcode]
301
+ $ lps snippet list [--password <value>] [--url <value>] [--user <value>] [-j] [-p code-snippets|wpcode]
510
302
 
511
303
  FLAGS
512
304
  -j, --json Output in JSON format
@@ -529,15 +321,15 @@ EXAMPLES
529
321
  $ lps snippets list --plugin wpcode
530
322
  ```
531
323
 
532
- _See code: [src/commands/snippets/list.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/snippets/list.ts)_
324
+ _See code: [src/commands/snippet/list.ts](https://github.com/loopress/loopress/blob/v0.4.0/src/commands/snippet/list.ts)_
533
325
 
534
- ## `lps snippets pull [PATH]`
326
+ ## `lps snippet pull [PATH]`
535
327
 
536
328
  Pull snippets from WordPress
537
329
 
538
330
  ```
539
331
  USAGE
540
- $ lps snippets pull [PATH] [--password <value>] [--url <value>] [--user <value>] [-d] [-p code-snippets|wpcode]
332
+ $ lps snippet pull [PATH] [--password <value>] [--url <value>] [--user <value>] [-d] [-p code-snippets|wpcode]
541
333
 
542
334
  ARGUMENTS
543
335
  [PATH] Path to snippets directory (overrides project config)
@@ -565,15 +357,15 @@ EXAMPLES
565
357
  $ lps snippets pull --plugin wpcode
566
358
  ```
567
359
 
568
- _See code: [src/commands/snippets/pull.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/snippets/pull.ts)_
360
+ _See code: [src/commands/snippet/pull.ts](https://github.com/loopress/loopress/blob/v0.4.0/src/commands/snippet/pull.ts)_
569
361
 
570
- ## `lps snippets push [PATH]`
362
+ ## `lps snippet push [PATH]`
571
363
 
572
364
  Push snippets to WordPress
573
365
 
574
366
  ```
575
367
  USAGE
576
- $ lps snippets push [PATH] [--password <value>] [--url <value>] [--user <value>] [-d] [-p code-snippets|wpcode]
368
+ $ lps snippet push [PATH] [--password <value>] [--url <value>] [--user <value>] [-d] [-p code-snippets|wpcode]
577
369
 
578
370
  ARGUMENTS
579
371
  [PATH] Path to snippets directory (overrides project config)
@@ -601,15 +393,15 @@ EXAMPLES
601
393
  $ lps snippets push --plugin wpcode
602
394
  ```
603
395
 
604
- _See code: [src/commands/snippets/push.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/snippets/push.ts)_
396
+ _See code: [src/commands/snippet/push.ts](https://github.com/loopress/loopress/blob/v0.4.0/src/commands/snippet/push.ts)_
605
397
 
606
- ## `lps styles pull`
398
+ ## `lps style pull`
607
399
 
608
400
  Pull Global Styles from WordPress
609
401
 
610
402
  ```
611
403
  USAGE
612
- $ lps styles pull [--password <value>] [--url <value>] [--user <value>] [-d]
404
+ $ lps style pull [--password <value>] [--url <value>] [--user <value>] [-d]
613
405
 
614
406
  FLAGS
615
407
  -d, --dryRun Dry run - show what would happen without making changes
@@ -628,15 +420,15 @@ EXAMPLES
628
420
  $ lps styles pull --url http://example.com
629
421
  ```
630
422
 
631
- _See code: [src/commands/styles/pull.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/styles/pull.ts)_
423
+ _See code: [src/commands/style/pull.ts](https://github.com/loopress/loopress/blob/v0.4.0/src/commands/style/pull.ts)_
632
424
 
633
- ## `lps styles push`
425
+ ## `lps style push`
634
426
 
635
427
  Push Global Styles to WordPress
636
428
 
637
429
  ```
638
430
  USAGE
639
- $ lps styles push [--password <value>] [--url <value>] [--user <value>] [-d]
431
+ $ lps style push [--password <value>] [--url <value>] [--user <value>] [-d]
640
432
 
641
433
  FLAGS
642
434
  -d, --dryRun Dry run - show what would happen without making changes
@@ -655,5 +447,5 @@ EXAMPLES
655
447
  $ lps styles push --url http://example.com
656
448
  ```
657
449
 
658
- _See code: [src/commands/styles/push.ts](https://github.com/loopress/loopress/blob/v0.2.0/src/commands/styles/push.ts)_
450
+ _See code: [src/commands/style/push.ts](https://github.com/loopress/loopress/blob/v0.4.0/src/commands/style/push.ts)_
659
451
  <!-- commandsstop -->
@@ -0,0 +1,12 @@
1
+ import { LoopressCommand } from '../../lib/base.js';
2
+ export default class Pull extends LoopressCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ 'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
+ password: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ url: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ user: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
11
+ run(): Promise<void>;
12
+ }
@@ -0,0 +1,48 @@
1
+ import { Flags } from '@oclif/core';
2
+ import got from 'got';
3
+ import { LoopressCommand } from '../../lib/base.js';
4
+ import { readLocalConfig, writeLocalConfig } from '../../utils/loopress-config.js';
5
+ import { mergePluginManifest } from '../../utils/plugins.js';
6
+ export default class Pull extends LoopressCommand {
7
+ static description = 'Pull installed plugins from WordPress into loopress.json';
8
+ static examples = ['$ lps plugins pull', '$ lps plugins pull --dry-run'];
9
+ static flags = {
10
+ ...LoopressCommand.baseFlags,
11
+ 'dry-run': Flags.boolean({ char: 'd', description: 'Show what would be written without making changes' }),
12
+ };
13
+ async run() {
14
+ const { flags } = await this.parse(Pull);
15
+ const dryRun = flags['dry-run'];
16
+ const { url } = this.siteConfig;
17
+ this.log(`Pulling plugins from ${url}`);
18
+ const headers = await this.buildAuthHeaders();
19
+ const installed = await got.get(`${url}/wp-json/loopress/v1/plugins`, { headers }).json();
20
+ const incoming = Object.fromEntries(installed.map((p) => [p.slug, p.version]));
21
+ const localConfig = await readLocalConfig();
22
+ const { added, merged, updated } = mergePluginManifest(localConfig.plugins ?? {}, incoming);
23
+ if (dryRun) {
24
+ this.log(`[dry-run] Would write ${Object.keys(merged).length} plugins to loopress.json`);
25
+ if (added.length > 0)
26
+ this.log(` + ${added.join(', ')}`);
27
+ if (updated.length > 0) {
28
+ for (const u of updated)
29
+ this.log(` ~ ${u.slug} (${u.from} → ${u.to})`);
30
+ }
31
+ return;
32
+ }
33
+ await writeLocalConfig({ ...localConfig, plugins: merged });
34
+ this.log(`Wrote ${Object.keys(merged).length} plugins to loopress.json`);
35
+ if (added.length > 0)
36
+ this.log(` + Added: ${added.join(', ')}`);
37
+ for (const u of updated)
38
+ this.log(` ~ Updated: ${u.slug} ${u.from} → ${u.to}`);
39
+ if (Object.keys(merged).length > 0) {
40
+ await got
41
+ .post(`${url}/wp-json/loopress/v1/plugins/auto-updates/disable`, {
42
+ headers,
43
+ json: { slugs: Object.keys(merged) },
44
+ })
45
+ .json();
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,13 @@
1
+ import { LoopressCommand } from '../../lib/base.js';
2
+ export default class Push extends LoopressCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ 'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
+ password: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ url: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ user: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
11
+ run(): Promise<void>;
12
+ private activatePlugin;
13
+ }