@loopress/cli 0.8.0 → 0.10.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 +40 -71
- package/dist/commands/composer/pull.d.ts +0 -3
- package/dist/commands/composer/pull.js +0 -1
- package/dist/commands/composer/push.d.ts +0 -3
- package/dist/commands/composer/push.js +0 -1
- package/dist/commands/plugin/add.d.ts +0 -3
- package/dist/commands/plugin/add.js +0 -1
- package/dist/commands/plugin/pull.d.ts +0 -3
- package/dist/commands/plugin/pull.js +0 -1
- package/dist/commands/plugin/push.d.ts +3 -3
- package/dist/commands/plugin/push.js +63 -32
- package/dist/commands/sentry-test.d.ts +6 -0
- package/dist/commands/sentry-test.js +8 -0
- package/dist/commands/snippet/list.d.ts +0 -3
- package/dist/commands/snippet/list.js +1 -6
- package/dist/commands/snippet/pull.d.ts +0 -3
- package/dist/commands/snippet/pull.js +16 -23
- package/dist/commands/snippet/push.d.ts +1 -3
- package/dist/commands/snippet/push.js +25 -24
- package/dist/hooks/finally.d.ts +3 -0
- package/dist/hooks/finally.js +21 -0
- package/dist/hooks/init.d.ts +3 -0
- package/dist/hooks/init.js +18 -0
- package/dist/lib/base.d.ts +0 -5
- package/dist/lib/base.js +1 -29
- package/dist/lib/sentry.d.ts +8 -0
- package/dist/lib/sentry.js +24 -0
- package/dist/types/config.d.ts +1 -19
- package/dist/types/global-config.generated.d.ts +59 -0
- package/dist/types/global-config.generated.js +2 -0
- package/dist/types/project-config.generated.d.ts +31 -0
- package/dist/types/project-config.generated.js +2 -0
- package/dist/types/snippet.generated.d.ts +46 -0
- package/dist/types/snippet.generated.js +2 -0
- package/dist/utils/loopress-config.d.ts +2 -7
- package/oclif.manifest.json +118 -292
- package/package.json +16 -3
- package/schemas/global-config.schema.json +83 -0
- package/schemas/project-config.schema.json +48 -0
- package/schemas/snippet.schema.json +61 -0
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ A new CLI generated with oclif
|
|
|
9
9
|
<!-- toc -->
|
|
10
10
|
* [Loopress](#loopress)
|
|
11
11
|
* [Usage](#usage)
|
|
12
|
+
* [Error reporting](#error-reporting)
|
|
12
13
|
* [Commands](#commands)
|
|
13
14
|
<!-- tocstop -->
|
|
14
15
|
|
|
@@ -20,7 +21,7 @@ $ npm install -g @loopress/cli
|
|
|
20
21
|
$ lps COMMAND
|
|
21
22
|
running command...
|
|
22
23
|
$ lps (--version)
|
|
23
|
-
@loopress/cli/0.
|
|
24
|
+
@loopress/cli/0.10.0 linux-x64 node-v24.18.0
|
|
24
25
|
$ lps --help [COMMAND]
|
|
25
26
|
USAGE
|
|
26
27
|
$ lps COMMAND
|
|
@@ -28,6 +29,20 @@ USAGE
|
|
|
28
29
|
```
|
|
29
30
|
<!-- usagestop -->
|
|
30
31
|
|
|
32
|
+
# Error reporting
|
|
33
|
+
|
|
34
|
+
Loopress sends crash reports to our Sentry project so we can find and fix bugs.
|
|
35
|
+
|
|
36
|
+
To opt out, either:
|
|
37
|
+
|
|
38
|
+
- set `LOOPRESS_TELEMETRY_DISABLED=1`, or
|
|
39
|
+
- pass `--no-error-reporting` on the command.
|
|
40
|
+
|
|
41
|
+
A crash report includes the command name, its flags/args as typed, your Node.js
|
|
42
|
+
version, and OS. WordPress credentials are configured via `lps project config`
|
|
43
|
+
and are never passed as command-line arguments, so they don't end up in a
|
|
44
|
+
report.
|
|
45
|
+
|
|
31
46
|
# Commands
|
|
32
47
|
|
|
33
48
|
<!-- commands -->
|
|
@@ -55,16 +70,11 @@ Pull composer.lock from WordPress
|
|
|
55
70
|
|
|
56
71
|
```
|
|
57
72
|
USAGE
|
|
58
|
-
$ lps composer pull [
|
|
73
|
+
$ lps composer pull [-d]
|
|
59
74
|
|
|
60
75
|
FLAGS
|
|
61
76
|
-d, --dry-run Show what would change without making changes
|
|
62
77
|
|
|
63
|
-
GLOBAL FLAGS
|
|
64
|
-
--password=<value> WordPress application password (overrides project config, requires --user)
|
|
65
|
-
--url=<value> WordPress URL (overrides project config)
|
|
66
|
-
--user=<value> WordPress username (overrides project config, requires --password)
|
|
67
|
-
|
|
68
78
|
DESCRIPTION
|
|
69
79
|
Pull composer.lock from WordPress
|
|
70
80
|
|
|
@@ -74,7 +84,7 @@ EXAMPLES
|
|
|
74
84
|
$ lps composer pull --dry-run
|
|
75
85
|
```
|
|
76
86
|
|
|
77
|
-
_See code: [src/commands/composer/pull.ts](https://github.com/loopress/loopress/blob/v0.
|
|
87
|
+
_See code: [src/commands/composer/pull.ts](https://github.com/loopress/loopress/blob/v0.10.0/src/commands/composer/pull.ts)_
|
|
78
88
|
|
|
79
89
|
## `lps composer push`
|
|
80
90
|
|
|
@@ -82,16 +92,11 @@ Push composer.json and composer.lock to WordPress and run composer install
|
|
|
82
92
|
|
|
83
93
|
```
|
|
84
94
|
USAGE
|
|
85
|
-
$ lps composer push [
|
|
95
|
+
$ lps composer push [-d]
|
|
86
96
|
|
|
87
97
|
FLAGS
|
|
88
98
|
-d, --dry-run Show what would change without making changes
|
|
89
99
|
|
|
90
|
-
GLOBAL FLAGS
|
|
91
|
-
--password=<value> WordPress application password (overrides project config, requires --user)
|
|
92
|
-
--url=<value> WordPress URL (overrides project config)
|
|
93
|
-
--user=<value> WordPress username (overrides project config, requires --password)
|
|
94
|
-
|
|
95
100
|
DESCRIPTION
|
|
96
101
|
Push composer.json and composer.lock to WordPress and run composer install
|
|
97
102
|
|
|
@@ -101,7 +106,7 @@ EXAMPLES
|
|
|
101
106
|
$ lps composer push --dry-run
|
|
102
107
|
```
|
|
103
108
|
|
|
104
|
-
_See code: [src/commands/composer/push.ts](https://github.com/loopress/loopress/blob/v0.
|
|
109
|
+
_See code: [src/commands/composer/push.ts](https://github.com/loopress/loopress/blob/v0.10.0/src/commands/composer/push.ts)_
|
|
105
110
|
|
|
106
111
|
## `lps help [COMMAND]`
|
|
107
112
|
|
|
@@ -138,7 +143,7 @@ EXAMPLES
|
|
|
138
143
|
$ lps init
|
|
139
144
|
```
|
|
140
145
|
|
|
141
|
-
_See code: [src/commands/init.ts](https://github.com/loopress/loopress/blob/v0.
|
|
146
|
+
_See code: [src/commands/init.ts](https://github.com/loopress/loopress/blob/v0.10.0/src/commands/init.ts)_
|
|
142
147
|
|
|
143
148
|
## `lps login`
|
|
144
149
|
|
|
@@ -155,7 +160,7 @@ EXAMPLES
|
|
|
155
160
|
$ lps login
|
|
156
161
|
```
|
|
157
162
|
|
|
158
|
-
_See code: [src/commands/login.ts](https://github.com/loopress/loopress/blob/v0.
|
|
163
|
+
_See code: [src/commands/login.ts](https://github.com/loopress/loopress/blob/v0.10.0/src/commands/login.ts)_
|
|
159
164
|
|
|
160
165
|
## `lps logout`
|
|
161
166
|
|
|
@@ -172,7 +177,7 @@ EXAMPLES
|
|
|
172
177
|
$ lps logout
|
|
173
178
|
```
|
|
174
179
|
|
|
175
|
-
_See code: [src/commands/logout.ts](https://github.com/loopress/loopress/blob/v0.
|
|
180
|
+
_See code: [src/commands/logout.ts](https://github.com/loopress/loopress/blob/v0.10.0/src/commands/logout.ts)_
|
|
176
181
|
|
|
177
182
|
## `lps plugin add SLUG [VERSION]`
|
|
178
183
|
|
|
@@ -180,7 +185,7 @@ Add a WordPress.org plugin to loopress.json
|
|
|
180
185
|
|
|
181
186
|
```
|
|
182
187
|
USAGE
|
|
183
|
-
$ lps plugin add SLUG [VERSION] [
|
|
188
|
+
$ lps plugin add SLUG [VERSION] [-d]
|
|
184
189
|
|
|
185
190
|
ARGUMENTS
|
|
186
191
|
SLUG Plugin slug on WordPress.org
|
|
@@ -189,11 +194,6 @@ ARGUMENTS
|
|
|
189
194
|
FLAGS
|
|
190
195
|
-d, --dry-run Show what would change without making changes
|
|
191
196
|
|
|
192
|
-
GLOBAL FLAGS
|
|
193
|
-
--password=<value> WordPress application password (overrides project config, requires --user)
|
|
194
|
-
--url=<value> WordPress URL (overrides project config)
|
|
195
|
-
--user=<value> WordPress username (overrides project config, requires --password)
|
|
196
|
-
|
|
197
197
|
DESCRIPTION
|
|
198
198
|
Add a WordPress.org plugin to loopress.json
|
|
199
199
|
|
|
@@ -205,7 +205,7 @@ EXAMPLES
|
|
|
205
205
|
$ lps plugin add contact-form-7 --dry-run
|
|
206
206
|
```
|
|
207
207
|
|
|
208
|
-
_See code: [src/commands/plugin/add.ts](https://github.com/loopress/loopress/blob/v0.
|
|
208
|
+
_See code: [src/commands/plugin/add.ts](https://github.com/loopress/loopress/blob/v0.10.0/src/commands/plugin/add.ts)_
|
|
209
209
|
|
|
210
210
|
## `lps plugin pull`
|
|
211
211
|
|
|
@@ -213,16 +213,11 @@ Pull installed plugins from WordPress into loopress.json
|
|
|
213
213
|
|
|
214
214
|
```
|
|
215
215
|
USAGE
|
|
216
|
-
$ lps plugin pull [
|
|
216
|
+
$ lps plugin pull [-d]
|
|
217
217
|
|
|
218
218
|
FLAGS
|
|
219
219
|
-d, --dry-run Show what would change without making changes
|
|
220
220
|
|
|
221
|
-
GLOBAL FLAGS
|
|
222
|
-
--password=<value> WordPress application password (overrides project config, requires --user)
|
|
223
|
-
--url=<value> WordPress URL (overrides project config)
|
|
224
|
-
--user=<value> WordPress username (overrides project config, requires --password)
|
|
225
|
-
|
|
226
221
|
DESCRIPTION
|
|
227
222
|
Pull installed plugins from WordPress into loopress.json
|
|
228
223
|
|
|
@@ -232,7 +227,7 @@ EXAMPLES
|
|
|
232
227
|
$ lps plugin pull --dry-run
|
|
233
228
|
```
|
|
234
229
|
|
|
235
|
-
_See code: [src/commands/plugin/pull.ts](https://github.com/loopress/loopress/blob/v0.
|
|
230
|
+
_See code: [src/commands/plugin/pull.ts](https://github.com/loopress/loopress/blob/v0.10.0/src/commands/plugin/pull.ts)_
|
|
236
231
|
|
|
237
232
|
## `lps plugin push`
|
|
238
233
|
|
|
@@ -240,16 +235,11 @@ Push plugins to WordPress to match loopress.json
|
|
|
240
235
|
|
|
241
236
|
```
|
|
242
237
|
USAGE
|
|
243
|
-
$ lps plugin push [
|
|
238
|
+
$ lps plugin push [-d]
|
|
244
239
|
|
|
245
240
|
FLAGS
|
|
246
241
|
-d, --dry-run Show what would change without making changes
|
|
247
242
|
|
|
248
|
-
GLOBAL FLAGS
|
|
249
|
-
--password=<value> WordPress application password (overrides project config, requires --user)
|
|
250
|
-
--url=<value> WordPress URL (overrides project config)
|
|
251
|
-
--user=<value> WordPress username (overrides project config, requires --password)
|
|
252
|
-
|
|
253
243
|
DESCRIPTION
|
|
254
244
|
Push plugins to WordPress to match loopress.json
|
|
255
245
|
|
|
@@ -259,7 +249,7 @@ EXAMPLES
|
|
|
259
249
|
$ lps plugin push --dry-run
|
|
260
250
|
```
|
|
261
251
|
|
|
262
|
-
_See code: [src/commands/plugin/push.ts](https://github.com/loopress/loopress/blob/v0.
|
|
252
|
+
_See code: [src/commands/plugin/push.ts](https://github.com/loopress/loopress/blob/v0.10.0/src/commands/plugin/push.ts)_
|
|
263
253
|
|
|
264
254
|
## `lps project config`
|
|
265
255
|
|
|
@@ -276,7 +266,7 @@ EXAMPLES
|
|
|
276
266
|
$ lps project config
|
|
277
267
|
```
|
|
278
268
|
|
|
279
|
-
_See code: [src/commands/project/config.ts](https://github.com/loopress/loopress/blob/v0.
|
|
269
|
+
_See code: [src/commands/project/config.ts](https://github.com/loopress/loopress/blob/v0.10.0/src/commands/project/config.ts)_
|
|
280
270
|
|
|
281
271
|
## `lps project list`
|
|
282
272
|
|
|
@@ -293,7 +283,7 @@ EXAMPLES
|
|
|
293
283
|
$ lps project list
|
|
294
284
|
```
|
|
295
285
|
|
|
296
|
-
_See code: [src/commands/project/list.ts](https://github.com/loopress/loopress/blob/v0.
|
|
286
|
+
_See code: [src/commands/project/list.ts](https://github.com/loopress/loopress/blob/v0.10.0/src/commands/project/list.ts)_
|
|
297
287
|
|
|
298
288
|
## `lps project remove`
|
|
299
289
|
|
|
@@ -310,7 +300,7 @@ EXAMPLES
|
|
|
310
300
|
$ lps project remove
|
|
311
301
|
```
|
|
312
302
|
|
|
313
|
-
_See code: [src/commands/project/remove.ts](https://github.com/loopress/loopress/blob/v0.
|
|
303
|
+
_See code: [src/commands/project/remove.ts](https://github.com/loopress/loopress/blob/v0.10.0/src/commands/project/remove.ts)_
|
|
314
304
|
|
|
315
305
|
## `lps project switch`
|
|
316
306
|
|
|
@@ -327,7 +317,7 @@ EXAMPLES
|
|
|
327
317
|
$ lps project switch
|
|
328
318
|
```
|
|
329
319
|
|
|
330
|
-
_See code: [src/commands/project/switch.ts](https://github.com/loopress/loopress/blob/v0.
|
|
320
|
+
_See code: [src/commands/project/switch.ts](https://github.com/loopress/loopress/blob/v0.10.0/src/commands/project/switch.ts)_
|
|
331
321
|
|
|
332
322
|
## `lps snippet list`
|
|
333
323
|
|
|
@@ -335,30 +325,23 @@ List snippets from WordPress
|
|
|
335
325
|
|
|
336
326
|
```
|
|
337
327
|
USAGE
|
|
338
|
-
$ lps snippet list [
|
|
328
|
+
$ lps snippet list [-j] [-p code-snippets|wpcode]
|
|
339
329
|
|
|
340
330
|
FLAGS
|
|
341
331
|
-j, --json Output in JSON format
|
|
342
332
|
-p, --plugin=<option> WordPress snippet plugin to target (overrides loopress.json)
|
|
343
333
|
<options: code-snippets|wpcode>
|
|
344
334
|
|
|
345
|
-
GLOBAL FLAGS
|
|
346
|
-
--password=<value> WordPress application password (overrides project config, requires --user)
|
|
347
|
-
--url=<value> WordPress URL (overrides project config)
|
|
348
|
-
--user=<value> WordPress username (overrides project config, requires --password)
|
|
349
|
-
|
|
350
335
|
DESCRIPTION
|
|
351
336
|
List snippets from WordPress
|
|
352
337
|
|
|
353
338
|
EXAMPLES
|
|
354
339
|
$ lps snippet list
|
|
355
340
|
|
|
356
|
-
$ lps snippet list --url http://example.com
|
|
357
|
-
|
|
358
341
|
$ lps snippet list --plugin wpcode
|
|
359
342
|
```
|
|
360
343
|
|
|
361
|
-
_See code: [src/commands/snippet/list.ts](https://github.com/loopress/loopress/blob/v0.
|
|
344
|
+
_See code: [src/commands/snippet/list.ts](https://github.com/loopress/loopress/blob/v0.10.0/src/commands/snippet/list.ts)_
|
|
362
345
|
|
|
363
346
|
## `lps snippet pull [PATH]`
|
|
364
347
|
|
|
@@ -366,7 +349,7 @@ Pull snippets from WordPress
|
|
|
366
349
|
|
|
367
350
|
```
|
|
368
351
|
USAGE
|
|
369
|
-
$ lps snippet pull [PATH] [
|
|
352
|
+
$ lps snippet pull [PATH] [-d] [-p code-snippets|wpcode]
|
|
370
353
|
|
|
371
354
|
ARGUMENTS
|
|
372
355
|
[PATH] Path to snippets directory (overrides project config)
|
|
@@ -376,25 +359,18 @@ FLAGS
|
|
|
376
359
|
-p, --plugin=<option> WordPress snippet plugin to target (overrides loopress.json)
|
|
377
360
|
<options: code-snippets|wpcode>
|
|
378
361
|
|
|
379
|
-
GLOBAL FLAGS
|
|
380
|
-
--password=<value> WordPress application password (overrides project config, requires --user)
|
|
381
|
-
--url=<value> WordPress URL (overrides project config)
|
|
382
|
-
--user=<value> WordPress username (overrides project config, requires --password)
|
|
383
|
-
|
|
384
362
|
DESCRIPTION
|
|
385
363
|
Pull snippets from WordPress
|
|
386
364
|
|
|
387
365
|
EXAMPLES
|
|
388
366
|
$ lps snippet pull
|
|
389
367
|
|
|
390
|
-
$ lps snippet pull --url http://example.com
|
|
391
|
-
|
|
392
368
|
$ lps snippet pull --path ./snippets
|
|
393
369
|
|
|
394
370
|
$ lps snippet pull --plugin wpcode
|
|
395
371
|
```
|
|
396
372
|
|
|
397
|
-
_See code: [src/commands/snippet/pull.ts](https://github.com/loopress/loopress/blob/v0.
|
|
373
|
+
_See code: [src/commands/snippet/pull.ts](https://github.com/loopress/loopress/blob/v0.10.0/src/commands/snippet/pull.ts)_
|
|
398
374
|
|
|
399
375
|
## `lps snippet push [PATH]`
|
|
400
376
|
|
|
@@ -402,7 +378,7 @@ Push snippets to WordPress. Local snippet files created or updated remotely are
|
|
|
402
378
|
|
|
403
379
|
```
|
|
404
380
|
USAGE
|
|
405
|
-
$ lps snippet push [PATH] [
|
|
381
|
+
$ lps snippet push [PATH] [-d] [-p code-snippets|wpcode]
|
|
406
382
|
|
|
407
383
|
ARGUMENTS
|
|
408
384
|
[PATH] Path to snippets directory (overrides project config)
|
|
@@ -412,11 +388,6 @@ FLAGS
|
|
|
412
388
|
-p, --plugin=<option> WordPress snippet plugin to target (overrides loopress.json)
|
|
413
389
|
<options: code-snippets|wpcode>
|
|
414
390
|
|
|
415
|
-
GLOBAL FLAGS
|
|
416
|
-
--password=<value> WordPress application password (overrides project config, requires --user)
|
|
417
|
-
--url=<value> WordPress URL (overrides project config)
|
|
418
|
-
--user=<value> WordPress username (overrides project config, requires --password)
|
|
419
|
-
|
|
420
391
|
DESCRIPTION
|
|
421
392
|
Push snippets to WordPress. Local snippet files created or updated remotely are renamed on disk to the `<id>-<slug>`
|
|
422
393
|
convention.
|
|
@@ -424,14 +395,12 @@ DESCRIPTION
|
|
|
424
395
|
EXAMPLES
|
|
425
396
|
$ lps snippet push
|
|
426
397
|
|
|
427
|
-
$ lps snippet push --url http://example.com
|
|
428
|
-
|
|
429
398
|
$ lps snippet push --path ./snippets
|
|
430
399
|
|
|
431
400
|
$ lps snippet push --plugin wpcode
|
|
432
401
|
```
|
|
433
402
|
|
|
434
|
-
_See code: [src/commands/snippet/push.ts](https://github.com/loopress/loopress/blob/v0.
|
|
403
|
+
_See code: [src/commands/snippet/push.ts](https://github.com/loopress/loopress/blob/v0.10.0/src/commands/snippet/push.ts)_
|
|
435
404
|
|
|
436
405
|
## `lps status`
|
|
437
406
|
|
|
@@ -448,5 +417,5 @@ EXAMPLES
|
|
|
448
417
|
$ lps status
|
|
449
418
|
```
|
|
450
419
|
|
|
451
|
-
_See code: [src/commands/status.ts](https://github.com/loopress/loopress/blob/v0.
|
|
420
|
+
_See code: [src/commands/status.ts](https://github.com/loopress/loopress/blob/v0.10.0/src/commands/status.ts)_
|
|
452
421
|
<!-- commandsstop -->
|
|
@@ -4,9 +4,6 @@ export default class ComposerPull extends LoopressCommand {
|
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
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
7
|
};
|
|
11
8
|
run(): Promise<void>;
|
|
12
9
|
}
|
|
@@ -5,7 +5,6 @@ export default class ComposerPull extends LoopressCommand {
|
|
|
5
5
|
static description = 'Pull composer.lock from WordPress';
|
|
6
6
|
static examples = ['$ lps composer pull', '$ lps composer pull --dry-run'];
|
|
7
7
|
static flags = {
|
|
8
|
-
...LoopressCommand.baseFlags,
|
|
9
8
|
...LoopressCommand.dryRunFlag,
|
|
10
9
|
};
|
|
11
10
|
async run() {
|
|
@@ -4,9 +4,6 @@ export default class ComposerPush extends PushCommand {
|
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
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
7
|
};
|
|
11
8
|
run(): Promise<void>;
|
|
12
9
|
}
|
|
@@ -6,7 +6,6 @@ export default class ComposerPush extends PushCommand {
|
|
|
6
6
|
static description = 'Push composer.json and composer.lock to WordPress and run composer install';
|
|
7
7
|
static examples = ['$ lps composer push', '$ lps composer push --dry-run'];
|
|
8
8
|
static flags = {
|
|
9
|
-
...PushCommand.baseFlags,
|
|
10
9
|
...PushCommand.dryRunFlag,
|
|
11
10
|
};
|
|
12
11
|
async run() {
|
|
@@ -9,9 +9,6 @@ export default class Add extends LoopressCommand {
|
|
|
9
9
|
static examples: string[];
|
|
10
10
|
static flags: {
|
|
11
11
|
'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
-
password: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
-
url: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
-
user: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
12
|
};
|
|
16
13
|
run(): Promise<void>;
|
|
17
14
|
}
|
|
@@ -4,9 +4,6 @@ export default class Pull extends LoopressCommand {
|
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
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
7
|
};
|
|
11
8
|
run(): Promise<void>;
|
|
12
9
|
}
|
|
@@ -6,7 +6,6 @@ export default class Pull extends LoopressCommand {
|
|
|
6
6
|
static description = 'Pull installed plugins from WordPress into loopress.json';
|
|
7
7
|
static examples = ['$ lps plugin pull', '$ lps plugin pull --dry-run'];
|
|
8
8
|
static flags = {
|
|
9
|
-
...LoopressCommand.baseFlags,
|
|
10
9
|
...LoopressCommand.dryRunFlag,
|
|
11
10
|
};
|
|
12
11
|
async run() {
|
|
@@ -4,11 +4,11 @@ export default class Push extends PushCommand {
|
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
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
7
|
};
|
|
8
|
+
private failedCount;
|
|
11
9
|
run(): Promise<void>;
|
|
12
10
|
private activatePlugin;
|
|
13
11
|
private installAndActivate;
|
|
12
|
+
private performPluginAction;
|
|
13
|
+
private syncDrifted;
|
|
14
14
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { confirm } from '@inquirer/prompts';
|
|
2
|
+
import { Listr } from 'listr2';
|
|
2
3
|
import { PushCommand } from '../../lib/push-command.js';
|
|
3
4
|
import { getComposerManagedSlugs, readComposerJson } from '../../utils/composer.js';
|
|
4
5
|
import { diffPlugins } from '../../utils/plugins.js';
|
|
@@ -6,9 +7,9 @@ export default class Push extends PushCommand {
|
|
|
6
7
|
static description = 'Push plugins to WordPress to match loopress.json';
|
|
7
8
|
static examples = ['$ lps plugin push', '$ lps plugin push --dry-run'];
|
|
8
9
|
static flags = {
|
|
9
|
-
...PushCommand.baseFlags,
|
|
10
10
|
...PushCommand.dryRunFlag,
|
|
11
11
|
};
|
|
12
|
+
failedCount = 0;
|
|
12
13
|
async run() {
|
|
13
14
|
const { url } = this.siteConfig;
|
|
14
15
|
const manifest = this.localConfig.plugins;
|
|
@@ -49,49 +50,79 @@ export default class Push extends PushCommand {
|
|
|
49
50
|
if (this.dryRun)
|
|
50
51
|
return;
|
|
51
52
|
// Install missing plugins and activate them.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
if (toInstall.length > 0) {
|
|
54
|
+
await new Listr(toInstall.map((action) => ({
|
|
55
|
+
task: async (_ctx, task) => this.installAndActivate(action.slug, action.targetVersion, task),
|
|
56
|
+
title: `Install ${action.slug} @ ${action.targetVersion}`,
|
|
57
|
+
})), { concurrent: false, exitOnError: false }).run();
|
|
55
58
|
}
|
|
56
59
|
// Activate installed-but-inactive plugins without prompting.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
if (toActivate.length > 0) {
|
|
61
|
+
await new Listr(toActivate.map((action) => ({
|
|
62
|
+
task: async (_ctx, task) => this.activatePlugin(action.slug, task),
|
|
63
|
+
title: `Activate ${action.slug}`,
|
|
64
|
+
})), { concurrent: false, exitOnError: false }).run();
|
|
60
65
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
this.
|
|
64
|
-
const proceed = await confirm({
|
|
65
|
-
default: false,
|
|
66
|
-
message: `${action.slug} is at ${action.currentVersion} on the site but manifest wants ${action.targetVersion}. Sync to ${action.targetVersion}?`,
|
|
67
|
-
});
|
|
68
|
-
if (!proceed) {
|
|
69
|
-
this.log(` Skipped ${action.slug}`);
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
this.log(` Syncing ${action.slug} to ${action.targetVersion}...`);
|
|
73
|
-
await this.installAndActivate(action.slug, action.targetVersion);
|
|
66
|
+
await this.syncDrifted(drifted);
|
|
67
|
+
if (this.failedCount > 0) {
|
|
68
|
+
this.error(`${this.failedCount} plugin${this.failedCount === 1 ? '' : 's'} failed to install or activate.`);
|
|
74
69
|
}
|
|
75
70
|
await this.recordSuccess();
|
|
76
71
|
}
|
|
77
|
-
|
|
72
|
+
// `task` is only passed when called from within a running Listr task list (see `run()`); it lets
|
|
73
|
+
// status lines go through `task.output` instead of `this.log`/`this.warn`, which would otherwise
|
|
74
|
+
// race with the renderer repainting the terminal. Called without `task` (e.g. directly in tests),
|
|
75
|
+
// it falls back to plain logging. Rethrowing on failure (rather than swallowing) is what lets Listr
|
|
76
|
+
// mark the task as failed (red cross) instead of completed, even though `exitOnError: false` stops
|
|
77
|
+
// that failure from aborting sibling tasks in the same list.
|
|
78
|
+
async activatePlugin(slug, task) {
|
|
79
|
+
await this.performPluginAction('activate', { body: { slug }, endpoint: 'loopress/v1/plugins/activate', slug }, task);
|
|
80
|
+
}
|
|
81
|
+
async installAndActivate(slug, version, task) {
|
|
82
|
+
await this.performPluginAction('install', { body: { slug, version }, endpoint: 'loopress/v1/plugins/install', slug }, task);
|
|
83
|
+
await this.activatePlugin(slug, task);
|
|
84
|
+
}
|
|
85
|
+
async performPluginAction(verb, request, task) {
|
|
86
|
+
const { body, endpoint, slug } = request;
|
|
78
87
|
try {
|
|
79
|
-
const result = await this.wp.post(
|
|
80
|
-
|
|
88
|
+
const result = await this.wp.post(endpoint, body);
|
|
89
|
+
const message = `✓ ${result.message}`;
|
|
90
|
+
if (task)
|
|
91
|
+
task.output = message;
|
|
92
|
+
else
|
|
93
|
+
this.log(` ${message}`);
|
|
81
94
|
}
|
|
82
95
|
catch (error) {
|
|
83
|
-
|
|
96
|
+
const message = `Failed to ${verb} ${slug}: ${error.message}`;
|
|
97
|
+
if (task)
|
|
98
|
+
task.output = message;
|
|
99
|
+
else
|
|
100
|
+
this.warn(` ${message}`);
|
|
101
|
+
this.failedCount++;
|
|
102
|
+
throw error;
|
|
84
103
|
}
|
|
85
104
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
105
|
+
// Prompt per drifted plugin before syncing. Prompts run sequentially on plain stdout,
|
|
106
|
+
// before the Listr renderer takes over the terminal for the confirmed subset.
|
|
107
|
+
async syncDrifted(drifted) {
|
|
108
|
+
const confirmedDrift = [];
|
|
109
|
+
for (const action of drifted) {
|
|
110
|
+
const proceed = await confirm({
|
|
111
|
+
default: false,
|
|
112
|
+
message: `${action.slug} is at ${action.currentVersion} on the site but manifest wants ${action.targetVersion}. Sync to ${action.targetVersion}?`,
|
|
113
|
+
});
|
|
114
|
+
if (proceed) {
|
|
115
|
+
confirmedDrift.push(action);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
this.log(` Skipped ${action.slug}`);
|
|
119
|
+
}
|
|
90
120
|
}
|
|
91
|
-
|
|
92
|
-
this.warn(` Failed to install ${slug}: ${error.message}`);
|
|
121
|
+
if (confirmedDrift.length === 0)
|
|
93
122
|
return;
|
|
94
|
-
|
|
95
|
-
|
|
123
|
+
await new Listr(confirmedDrift.map((action) => ({
|
|
124
|
+
task: async (_ctx, task) => this.installAndActivate(action.slug, action.targetVersion, task),
|
|
125
|
+
title: `Sync ${action.slug} to ${action.targetVersion}`,
|
|
126
|
+
})), { concurrent: false, exitOnError: false }).run();
|
|
96
127
|
}
|
|
97
128
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class SentryTest extends Command {
|
|
3
|
+
static description = 'Throw a test error to verify Sentry error reporting is wired up correctly';
|
|
4
|
+
static hidden = true;
|
|
5
|
+
async run() {
|
|
6
|
+
throw new Error('Sentry test error from `lps sentry-test`');
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -5,9 +5,6 @@ export default class List extends LoopressCommand {
|
|
|
5
5
|
static flags: {
|
|
6
6
|
plugin: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
7
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
-
password: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
-
url: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
-
user: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
8
|
};
|
|
12
9
|
run(): Promise<void>;
|
|
13
10
|
}
|
|
@@ -4,13 +4,8 @@ import { snippetPluginFlag } from '../../utils/snippet-plugin-flag.js';
|
|
|
4
4
|
import { getSnippetPlugin } from '../../utils/snippet-plugin.js';
|
|
5
5
|
export default class List extends LoopressCommand {
|
|
6
6
|
static description = 'List snippets from WordPress';
|
|
7
|
-
static examples = [
|
|
8
|
-
'$ lps snippet list',
|
|
9
|
-
'$ lps snippet list --url http://example.com',
|
|
10
|
-
'$ lps snippet list --plugin wpcode',
|
|
11
|
-
];
|
|
7
|
+
static examples = ['$ lps snippet list', '$ lps snippet list --plugin wpcode'];
|
|
12
8
|
static flags = {
|
|
13
|
-
...LoopressCommand.baseFlags,
|
|
14
9
|
json: Flags.boolean({ char: 'j', description: 'Output in JSON format' }),
|
|
15
10
|
...snippetPluginFlag,
|
|
16
11
|
};
|
|
@@ -11,9 +11,6 @@ export default class Pull extends LoopressCommand {
|
|
|
11
11
|
static flags: {
|
|
12
12
|
plugin: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
13
|
'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
-
password: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
-
url: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
-
user: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
14
|
};
|
|
18
15
|
run(): Promise<void>;
|
|
19
16
|
}
|