@loopress/cli 0.5.0 → 0.7.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 +140 -101
- package/dist/commands/composer/pull.d.ts +12 -0
- package/dist/commands/composer/pull.js +33 -0
- package/dist/commands/composer/push.d.ts +12 -0
- package/dist/commands/composer/push.js +49 -0
- package/dist/commands/init.js +15 -6
- package/dist/commands/login.js +1 -1
- package/dist/commands/logout.js +1 -1
- package/dist/commands/plugin/{require.d.ts → add.d.ts} +1 -1
- package/dist/commands/plugin/{require.js → add.js} +8 -8
- package/dist/commands/plugin/pull.js +11 -2
- package/dist/commands/plugin/push.js +13 -4
- package/dist/commands/project/config.d.ts +1 -0
- package/dist/commands/project/config.js +36 -17
- package/dist/commands/project/list.js +4 -5
- package/dist/commands/project/remove.js +33 -14
- package/dist/commands/project/switch.d.ts +2 -0
- package/dist/commands/project/switch.js +28 -9
- package/dist/commands/snippet/list.js +3 -3
- package/dist/commands/snippet/pull.d.ts +1 -1
- package/dist/commands/snippet/pull.js +7 -6
- package/dist/commands/snippet/push.d.ts +2 -2
- package/dist/commands/snippet/push.js +47 -15
- package/dist/commands/{project/switch-env.d.ts → status.d.ts} +3 -1
- package/dist/commands/status.js +66 -0
- package/dist/config/project-config.manager.d.ts +17 -10
- package/dist/config/project-config.manager.js +91 -44
- package/dist/config/types.d.ts +5 -2
- package/dist/lib/base.js +13 -3
- package/dist/types/snippet.d.ts +2 -0
- package/dist/utils/composer.d.ts +7 -0
- package/dist/utils/composer.js +33 -0
- package/dist/utils/snippet-plugin.d.ts +2 -1
- package/dist/utils/snippet-plugin.js +5 -4
- package/oclif.manifest.json +160 -72
- package/package.json +25 -6
- package/dist/commands/project/remove-env.d.ts +0 -6
- package/dist/commands/project/remove-env.js +0 -33
- package/dist/commands/project/switch-env.js +0 -33
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ $ npm install -g @loopress/cli
|
|
|
20
20
|
$ lps COMMAND
|
|
21
21
|
running command...
|
|
22
22
|
$ lps (--version)
|
|
23
|
-
@loopress/cli/0.
|
|
23
|
+
@loopress/cli/0.7.0 linux-x64 node-v24.18.0
|
|
24
24
|
$ lps --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ lps COMMAND
|
|
@@ -31,22 +31,77 @@ USAGE
|
|
|
31
31
|
# Commands
|
|
32
32
|
|
|
33
33
|
<!-- commands -->
|
|
34
|
+
* [`lps composer pull`](#lps-composer-pull)
|
|
35
|
+
* [`lps composer push`](#lps-composer-push)
|
|
34
36
|
* [`lps help [COMMAND]`](#lps-help-command)
|
|
35
37
|
* [`lps init`](#lps-init)
|
|
36
38
|
* [`lps login`](#lps-login)
|
|
37
39
|
* [`lps logout`](#lps-logout)
|
|
40
|
+
* [`lps plugin add SLUG [VERSION]`](#lps-plugin-add-slug-version)
|
|
38
41
|
* [`lps plugin pull`](#lps-plugin-pull)
|
|
39
42
|
* [`lps plugin push`](#lps-plugin-push)
|
|
40
|
-
* [`lps plugin require SLUG [VERSION]`](#lps-plugin-require-slug-version)
|
|
41
43
|
* [`lps project config`](#lps-project-config)
|
|
42
44
|
* [`lps project list`](#lps-project-list)
|
|
43
45
|
* [`lps project remove`](#lps-project-remove)
|
|
44
|
-
* [`lps project remove-env`](#lps-project-remove-env)
|
|
45
46
|
* [`lps project switch`](#lps-project-switch)
|
|
46
|
-
* [`lps project switch-env`](#lps-project-switch-env)
|
|
47
47
|
* [`lps snippet list`](#lps-snippet-list)
|
|
48
48
|
* [`lps snippet pull [PATH]`](#lps-snippet-pull-path)
|
|
49
49
|
* [`lps snippet push [PATH]`](#lps-snippet-push-path)
|
|
50
|
+
* [`lps status`](#lps-status)
|
|
51
|
+
|
|
52
|
+
## `lps composer pull`
|
|
53
|
+
|
|
54
|
+
Pull composer.lock from WordPress
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
USAGE
|
|
58
|
+
$ lps composer pull [--password <value>] [--url <value>] [--user <value>] [-d]
|
|
59
|
+
|
|
60
|
+
FLAGS
|
|
61
|
+
-d, --dry-run Show what would be written without making changes
|
|
62
|
+
|
|
63
|
+
GLOBAL FLAGS
|
|
64
|
+
--password=<value> WordPress application password (fallback; prefer `lps project config`)
|
|
65
|
+
--url=<value> WordPress URL (fallback; prefer `lps project config`)
|
|
66
|
+
--user=<value> WordPress username (fallback; prefer `lps project config`)
|
|
67
|
+
|
|
68
|
+
DESCRIPTION
|
|
69
|
+
Pull composer.lock from WordPress
|
|
70
|
+
|
|
71
|
+
EXAMPLES
|
|
72
|
+
$ lps composer pull
|
|
73
|
+
|
|
74
|
+
$ lps composer pull --dry-run
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
_See code: [src/commands/composer/pull.ts](https://github.com/loopress/loopress/blob/v0.7.0/src/commands/composer/pull.ts)_
|
|
78
|
+
|
|
79
|
+
## `lps composer push`
|
|
80
|
+
|
|
81
|
+
Push composer.json and composer.lock to WordPress and run composer install
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
USAGE
|
|
85
|
+
$ lps composer push [--password <value>] [--url <value>] [--user <value>] [-d]
|
|
86
|
+
|
|
87
|
+
FLAGS
|
|
88
|
+
-d, --dry-run Show what would change without making changes
|
|
89
|
+
|
|
90
|
+
GLOBAL FLAGS
|
|
91
|
+
--password=<value> WordPress application password (fallback; prefer `lps project config`)
|
|
92
|
+
--url=<value> WordPress URL (fallback; prefer `lps project config`)
|
|
93
|
+
--user=<value> WordPress username (fallback; prefer `lps project config`)
|
|
94
|
+
|
|
95
|
+
DESCRIPTION
|
|
96
|
+
Push composer.json and composer.lock to WordPress and run composer install
|
|
97
|
+
|
|
98
|
+
EXAMPLES
|
|
99
|
+
$ lps composer push
|
|
100
|
+
|
|
101
|
+
$ lps composer push --dry-run
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
_See code: [src/commands/composer/push.ts](https://github.com/loopress/loopress/blob/v0.7.0/src/commands/composer/push.ts)_
|
|
50
105
|
|
|
51
106
|
## `lps help [COMMAND]`
|
|
52
107
|
|
|
@@ -66,7 +121,7 @@ DESCRIPTION
|
|
|
66
121
|
Display help for lps.
|
|
67
122
|
```
|
|
68
123
|
|
|
69
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.
|
|
124
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.53/src/commands/help.ts)_
|
|
70
125
|
|
|
71
126
|
## `lps init`
|
|
72
127
|
|
|
@@ -83,49 +138,53 @@ EXAMPLES
|
|
|
83
138
|
$ lps init
|
|
84
139
|
```
|
|
85
140
|
|
|
86
|
-
_See code: [src/commands/init.ts](https://github.com/loopress/loopress/blob/v0.
|
|
141
|
+
_See code: [src/commands/init.ts](https://github.com/loopress/loopress/blob/v0.7.0/src/commands/init.ts)_
|
|
87
142
|
|
|
88
143
|
## `lps login`
|
|
89
144
|
|
|
90
|
-
Log in to Loopress
|
|
145
|
+
Log in to the Loopress console
|
|
91
146
|
|
|
92
147
|
```
|
|
93
148
|
USAGE
|
|
94
149
|
$ lps login
|
|
95
150
|
|
|
96
151
|
DESCRIPTION
|
|
97
|
-
Log in to Loopress
|
|
152
|
+
Log in to the Loopress console
|
|
98
153
|
|
|
99
154
|
EXAMPLES
|
|
100
155
|
$ lps login
|
|
101
156
|
```
|
|
102
157
|
|
|
103
|
-
_See code: [src/commands/login.ts](https://github.com/loopress/loopress/blob/v0.
|
|
158
|
+
_See code: [src/commands/login.ts](https://github.com/loopress/loopress/blob/v0.7.0/src/commands/login.ts)_
|
|
104
159
|
|
|
105
160
|
## `lps logout`
|
|
106
161
|
|
|
107
|
-
Log out from Loopress console
|
|
162
|
+
Log out from the Loopress console
|
|
108
163
|
|
|
109
164
|
```
|
|
110
165
|
USAGE
|
|
111
166
|
$ lps logout
|
|
112
167
|
|
|
113
168
|
DESCRIPTION
|
|
114
|
-
Log out from Loopress console
|
|
169
|
+
Log out from the Loopress console
|
|
115
170
|
|
|
116
171
|
EXAMPLES
|
|
117
172
|
$ lps logout
|
|
118
173
|
```
|
|
119
174
|
|
|
120
|
-
_See code: [src/commands/logout.ts](https://github.com/loopress/loopress/blob/v0.
|
|
175
|
+
_See code: [src/commands/logout.ts](https://github.com/loopress/loopress/blob/v0.7.0/src/commands/logout.ts)_
|
|
121
176
|
|
|
122
|
-
## `lps plugin
|
|
177
|
+
## `lps plugin add SLUG [VERSION]`
|
|
123
178
|
|
|
124
|
-
|
|
179
|
+
Add a WordPress.org plugin to loopress.json
|
|
125
180
|
|
|
126
181
|
```
|
|
127
182
|
USAGE
|
|
128
|
-
$ lps plugin
|
|
183
|
+
$ lps plugin add SLUG [VERSION] [--password <value>] [--url <value>] [--user <value>] [-d]
|
|
184
|
+
|
|
185
|
+
ARGUMENTS
|
|
186
|
+
SLUG Plugin slug on WordPress.org
|
|
187
|
+
[VERSION] Version to pin (default: latest)
|
|
129
188
|
|
|
130
189
|
FLAGS
|
|
131
190
|
-d, --dry-run Show what would be written without making changes
|
|
@@ -136,26 +195,28 @@ GLOBAL FLAGS
|
|
|
136
195
|
--user=<value> WordPress username (fallback; prefer `lps project config`)
|
|
137
196
|
|
|
138
197
|
DESCRIPTION
|
|
139
|
-
|
|
198
|
+
Add a WordPress.org plugin to loopress.json
|
|
140
199
|
|
|
141
200
|
EXAMPLES
|
|
142
|
-
$ lps
|
|
201
|
+
$ lps plugin add woocommerce
|
|
202
|
+
|
|
203
|
+
$ lps plugin add woocommerce 8.9.1
|
|
143
204
|
|
|
144
|
-
$ lps
|
|
205
|
+
$ lps plugin add contact-form-7 --dry-run
|
|
145
206
|
```
|
|
146
207
|
|
|
147
|
-
_See code: [src/commands/plugin/
|
|
208
|
+
_See code: [src/commands/plugin/add.ts](https://github.com/loopress/loopress/blob/v0.7.0/src/commands/plugin/add.ts)_
|
|
148
209
|
|
|
149
|
-
## `lps plugin
|
|
210
|
+
## `lps plugin pull`
|
|
150
211
|
|
|
151
|
-
|
|
212
|
+
Pull installed plugins from WordPress into loopress.json
|
|
152
213
|
|
|
153
214
|
```
|
|
154
215
|
USAGE
|
|
155
|
-
$ lps plugin
|
|
216
|
+
$ lps plugin pull [--password <value>] [--url <value>] [--user <value>] [-d]
|
|
156
217
|
|
|
157
218
|
FLAGS
|
|
158
|
-
-d, --dry-run Show what would
|
|
219
|
+
-d, --dry-run Show what would be written without making changes
|
|
159
220
|
|
|
160
221
|
GLOBAL FLAGS
|
|
161
222
|
--password=<value> WordPress application password (fallback; prefer `lps project config`)
|
|
@@ -163,30 +224,26 @@ GLOBAL FLAGS
|
|
|
163
224
|
--user=<value> WordPress username (fallback; prefer `lps project config`)
|
|
164
225
|
|
|
165
226
|
DESCRIPTION
|
|
166
|
-
|
|
227
|
+
Pull installed plugins from WordPress into loopress.json
|
|
167
228
|
|
|
168
229
|
EXAMPLES
|
|
169
|
-
$ lps
|
|
230
|
+
$ lps plugin pull
|
|
170
231
|
|
|
171
|
-
$ lps
|
|
232
|
+
$ lps plugin pull --dry-run
|
|
172
233
|
```
|
|
173
234
|
|
|
174
|
-
_See code: [src/commands/plugin/
|
|
235
|
+
_See code: [src/commands/plugin/pull.ts](https://github.com/loopress/loopress/blob/v0.7.0/src/commands/plugin/pull.ts)_
|
|
175
236
|
|
|
176
|
-
## `lps plugin
|
|
237
|
+
## `lps plugin push`
|
|
177
238
|
|
|
178
|
-
|
|
239
|
+
Push plugins to WordPress to match loopress.json
|
|
179
240
|
|
|
180
241
|
```
|
|
181
242
|
USAGE
|
|
182
|
-
$ lps plugin
|
|
183
|
-
|
|
184
|
-
ARGUMENTS
|
|
185
|
-
SLUG Plugin slug (WordPress.org)
|
|
186
|
-
[VERSION] Version to pin (default: latest)
|
|
243
|
+
$ lps plugin push [--password <value>] [--url <value>] [--user <value>] [-d]
|
|
187
244
|
|
|
188
245
|
FLAGS
|
|
189
|
-
-d, --dry-run Show what would
|
|
246
|
+
-d, --dry-run Show what would change without making changes
|
|
190
247
|
|
|
191
248
|
GLOBAL FLAGS
|
|
192
249
|
--password=<value> WordPress application password (fallback; prefer `lps project config`)
|
|
@@ -194,17 +251,15 @@ GLOBAL FLAGS
|
|
|
194
251
|
--user=<value> WordPress username (fallback; prefer `lps project config`)
|
|
195
252
|
|
|
196
253
|
DESCRIPTION
|
|
197
|
-
|
|
254
|
+
Push plugins to WordPress to match loopress.json
|
|
198
255
|
|
|
199
256
|
EXAMPLES
|
|
200
|
-
$ lps
|
|
201
|
-
|
|
202
|
-
$ lps plugins require woocommerce 8.9.1
|
|
257
|
+
$ lps plugin push
|
|
203
258
|
|
|
204
|
-
$ lps
|
|
259
|
+
$ lps plugin push --dry-run
|
|
205
260
|
```
|
|
206
261
|
|
|
207
|
-
_See code: [src/commands/plugin/
|
|
262
|
+
_See code: [src/commands/plugin/push.ts](https://github.com/loopress/loopress/blob/v0.7.0/src/commands/plugin/push.ts)_
|
|
208
263
|
|
|
209
264
|
## `lps project config`
|
|
210
265
|
|
|
@@ -221,7 +276,7 @@ EXAMPLES
|
|
|
221
276
|
$ lps project config
|
|
222
277
|
```
|
|
223
278
|
|
|
224
|
-
_See code: [src/commands/project/config.ts](https://github.com/loopress/loopress/blob/v0.
|
|
279
|
+
_See code: [src/commands/project/config.ts](https://github.com/loopress/loopress/blob/v0.7.0/src/commands/project/config.ts)_
|
|
225
280
|
|
|
226
281
|
## `lps project list`
|
|
227
282
|
|
|
@@ -238,75 +293,41 @@ EXAMPLES
|
|
|
238
293
|
$ lps project list
|
|
239
294
|
```
|
|
240
295
|
|
|
241
|
-
_See code: [src/commands/project/list.ts](https://github.com/loopress/loopress/blob/v0.
|
|
296
|
+
_See code: [src/commands/project/list.ts](https://github.com/loopress/loopress/blob/v0.7.0/src/commands/project/list.ts)_
|
|
242
297
|
|
|
243
298
|
## `lps project remove`
|
|
244
299
|
|
|
245
|
-
Remove one or more WordPress
|
|
300
|
+
Remove one or more WordPress projects or environments
|
|
246
301
|
|
|
247
302
|
```
|
|
248
303
|
USAGE
|
|
249
304
|
$ lps project remove
|
|
250
305
|
|
|
251
306
|
DESCRIPTION
|
|
252
|
-
Remove one or more WordPress
|
|
307
|
+
Remove one or more WordPress projects or environments
|
|
253
308
|
|
|
254
309
|
EXAMPLES
|
|
255
310
|
$ lps project remove
|
|
256
311
|
```
|
|
257
312
|
|
|
258
|
-
_See code: [src/commands/project/remove.ts](https://github.com/loopress/loopress/blob/v0.
|
|
259
|
-
|
|
260
|
-
## `lps project remove-env`
|
|
261
|
-
|
|
262
|
-
Remove one or more environments from the current project
|
|
263
|
-
|
|
264
|
-
```
|
|
265
|
-
USAGE
|
|
266
|
-
$ lps project remove-env
|
|
267
|
-
|
|
268
|
-
DESCRIPTION
|
|
269
|
-
Remove one or more environments from the current project
|
|
270
|
-
|
|
271
|
-
EXAMPLES
|
|
272
|
-
$ lps project remove-env
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
_See code: [src/commands/project/remove-env.ts](https://github.com/loopress/loopress/blob/v0.5.0/src/commands/project/remove-env.ts)_
|
|
313
|
+
_See code: [src/commands/project/remove.ts](https://github.com/loopress/loopress/blob/v0.7.0/src/commands/project/remove.ts)_
|
|
276
314
|
|
|
277
315
|
## `lps project switch`
|
|
278
316
|
|
|
279
|
-
Switch the active project
|
|
317
|
+
Switch the active project and environment
|
|
280
318
|
|
|
281
319
|
```
|
|
282
320
|
USAGE
|
|
283
321
|
$ lps project switch
|
|
284
322
|
|
|
285
323
|
DESCRIPTION
|
|
286
|
-
Switch the active project
|
|
324
|
+
Switch the active project and environment
|
|
287
325
|
|
|
288
326
|
EXAMPLES
|
|
289
327
|
$ lps project switch
|
|
290
328
|
```
|
|
291
329
|
|
|
292
|
-
_See code: [src/commands/project/switch.ts](https://github.com/loopress/loopress/blob/v0.
|
|
293
|
-
|
|
294
|
-
## `lps project switch-env`
|
|
295
|
-
|
|
296
|
-
Switch the active environment within the current project
|
|
297
|
-
|
|
298
|
-
```
|
|
299
|
-
USAGE
|
|
300
|
-
$ lps project switch-env
|
|
301
|
-
|
|
302
|
-
DESCRIPTION
|
|
303
|
-
Switch the active environment within the current project
|
|
304
|
-
|
|
305
|
-
EXAMPLES
|
|
306
|
-
$ lps project switch-env
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
_See code: [src/commands/project/switch-env.ts](https://github.com/loopress/loopress/blob/v0.5.0/src/commands/project/switch-env.ts)_
|
|
330
|
+
_See code: [src/commands/project/switch.ts](https://github.com/loopress/loopress/blob/v0.7.0/src/commands/project/switch.ts)_
|
|
310
331
|
|
|
311
332
|
## `lps snippet list`
|
|
312
333
|
|
|
@@ -330,14 +351,14 @@ DESCRIPTION
|
|
|
330
351
|
List snippets from WordPress
|
|
331
352
|
|
|
332
353
|
EXAMPLES
|
|
333
|
-
$ lps
|
|
354
|
+
$ lps snippet list
|
|
334
355
|
|
|
335
|
-
$ lps
|
|
356
|
+
$ lps snippet list --url http://example.com
|
|
336
357
|
|
|
337
|
-
$ lps
|
|
358
|
+
$ lps snippet list --plugin wpcode
|
|
338
359
|
```
|
|
339
360
|
|
|
340
|
-
_See code: [src/commands/snippet/list.ts](https://github.com/loopress/loopress/blob/v0.
|
|
361
|
+
_See code: [src/commands/snippet/list.ts](https://github.com/loopress/loopress/blob/v0.7.0/src/commands/snippet/list.ts)_
|
|
341
362
|
|
|
342
363
|
## `lps snippet pull [PATH]`
|
|
343
364
|
|
|
@@ -351,7 +372,7 @@ ARGUMENTS
|
|
|
351
372
|
[PATH] Path to snippets directory (overrides project config)
|
|
352
373
|
|
|
353
374
|
FLAGS
|
|
354
|
-
-d, --
|
|
375
|
+
-d, --dry-run Show what would be written without making changes
|
|
355
376
|
-p, --plugin=<option> WordPress snippet plugin to target (overrides loopress.json)
|
|
356
377
|
<options: code-snippets|wpcode>
|
|
357
378
|
|
|
@@ -364,20 +385,20 @@ DESCRIPTION
|
|
|
364
385
|
Pull snippets from WordPress
|
|
365
386
|
|
|
366
387
|
EXAMPLES
|
|
367
|
-
$ lps
|
|
388
|
+
$ lps snippet pull
|
|
368
389
|
|
|
369
|
-
$ lps
|
|
390
|
+
$ lps snippet pull --url http://example.com
|
|
370
391
|
|
|
371
|
-
$ lps
|
|
392
|
+
$ lps snippet pull --path ./snippets
|
|
372
393
|
|
|
373
|
-
$ lps
|
|
394
|
+
$ lps snippet pull --plugin wpcode
|
|
374
395
|
```
|
|
375
396
|
|
|
376
|
-
_See code: [src/commands/snippet/pull.ts](https://github.com/loopress/loopress/blob/v0.
|
|
397
|
+
_See code: [src/commands/snippet/pull.ts](https://github.com/loopress/loopress/blob/v0.7.0/src/commands/snippet/pull.ts)_
|
|
377
398
|
|
|
378
399
|
## `lps snippet push [PATH]`
|
|
379
400
|
|
|
380
|
-
Push snippets to WordPress
|
|
401
|
+
Push snippets to WordPress. Local snippet files created or updated remotely are renamed on disk to the `<id>-<slug>` convention.
|
|
381
402
|
|
|
382
403
|
```
|
|
383
404
|
USAGE
|
|
@@ -387,7 +408,7 @@ ARGUMENTS
|
|
|
387
408
|
[PATH] Path to snippets directory (overrides project config)
|
|
388
409
|
|
|
389
410
|
FLAGS
|
|
390
|
-
-d, --
|
|
411
|
+
-d, --dry-run Show what would change without making changes
|
|
391
412
|
-p, --plugin=<option> WordPress snippet plugin to target (overrides loopress.json)
|
|
392
413
|
<options: code-snippets|wpcode>
|
|
393
414
|
|
|
@@ -397,17 +418,35 @@ GLOBAL FLAGS
|
|
|
397
418
|
--user=<value> WordPress username (fallback; prefer `lps project config`)
|
|
398
419
|
|
|
399
420
|
DESCRIPTION
|
|
400
|
-
Push snippets to WordPress
|
|
421
|
+
Push snippets to WordPress. Local snippet files created or updated remotely are renamed on disk to the `<id>-<slug>`
|
|
422
|
+
convention.
|
|
401
423
|
|
|
402
424
|
EXAMPLES
|
|
403
|
-
$ lps
|
|
425
|
+
$ lps snippet push
|
|
426
|
+
|
|
427
|
+
$ lps snippet push --url http://example.com
|
|
428
|
+
|
|
429
|
+
$ lps snippet push --path ./snippets
|
|
430
|
+
|
|
431
|
+
$ lps snippet push --plugin wpcode
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
_See code: [src/commands/snippet/push.ts](https://github.com/loopress/loopress/blob/v0.7.0/src/commands/snippet/push.ts)_
|
|
404
435
|
|
|
405
|
-
|
|
436
|
+
## `lps status`
|
|
406
437
|
|
|
407
|
-
|
|
438
|
+
Show which WordPress project and environment commands will target
|
|
408
439
|
|
|
409
|
-
|
|
440
|
+
```
|
|
441
|
+
USAGE
|
|
442
|
+
$ lps status
|
|
443
|
+
|
|
444
|
+
DESCRIPTION
|
|
445
|
+
Show which WordPress project and environment commands will target
|
|
446
|
+
|
|
447
|
+
EXAMPLES
|
|
448
|
+
$ lps status
|
|
410
449
|
```
|
|
411
450
|
|
|
412
|
-
_See code: [src/commands/
|
|
451
|
+
_See code: [src/commands/status.ts](https://github.com/loopress/loopress/blob/v0.7.0/src/commands/status.ts)_
|
|
413
452
|
<!-- commandsstop -->
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LoopressCommand } from '../../lib/base.js';
|
|
2
|
+
export default class ComposerPull 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,33 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import got from 'got';
|
|
3
|
+
import { writeFile } from 'node:fs/promises';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { LoopressCommand } from '../../lib/base.js';
|
|
6
|
+
import { readLocalConfig } from '../../utils/loopress-config.js';
|
|
7
|
+
export default class ComposerPull extends LoopressCommand {
|
|
8
|
+
static description = 'Pull composer.lock from WordPress';
|
|
9
|
+
static examples = ['$ lps composer pull', '$ lps composer pull --dry-run'];
|
|
10
|
+
static flags = {
|
|
11
|
+
...LoopressCommand.baseFlags,
|
|
12
|
+
'dry-run': Flags.boolean({ char: 'd', description: 'Show what would be written without making changes' }),
|
|
13
|
+
};
|
|
14
|
+
async run() {
|
|
15
|
+
const { flags } = await this.parse(ComposerPull);
|
|
16
|
+
const dryRun = flags['dry-run'];
|
|
17
|
+
const { url } = this.siteConfig;
|
|
18
|
+
this.log(`Pulling composer.lock from ${url}`);
|
|
19
|
+
const headers = await this.buildAuthHeaders();
|
|
20
|
+
const { composerLock } = await got
|
|
21
|
+
.get(`${url}/wp-json/loopress/v1/composer/lock`, { headers })
|
|
22
|
+
.json();
|
|
23
|
+
if (dryRun) {
|
|
24
|
+
this.log('[dry-run] Would write composer.lock');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const localConfig = await readLocalConfig();
|
|
28
|
+
const rootDir = localConfig.rootDir ?? '.';
|
|
29
|
+
const lockPath = join(process.cwd(), rootDir, 'composer.lock');
|
|
30
|
+
await writeFile(lockPath, composerLock, 'utf8');
|
|
31
|
+
this.log(`Wrote composer.lock`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PushCommand } from '../../lib/push-command.js';
|
|
2
|
+
export default class ComposerPush extends PushCommand {
|
|
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,49 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import got from 'got';
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
4
|
+
import { readFile } from 'node:fs/promises';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { PushCommand } from '../../lib/push-command.js';
|
|
7
|
+
import { readLocalConfig } from '../../utils/loopress-config.js';
|
|
8
|
+
export default class ComposerPush extends PushCommand {
|
|
9
|
+
static description = 'Push composer.json and composer.lock to WordPress and run composer install';
|
|
10
|
+
static examples = ['$ lps composer push', '$ lps composer push --dry-run'];
|
|
11
|
+
static flags = {
|
|
12
|
+
...PushCommand.baseFlags,
|
|
13
|
+
'dry-run': Flags.boolean({ char: 'd', description: 'Show what would change without making changes' }),
|
|
14
|
+
};
|
|
15
|
+
async run() {
|
|
16
|
+
const { flags } = await this.parse(ComposerPush);
|
|
17
|
+
const dryRun = flags['dry-run'];
|
|
18
|
+
this.dryRun = dryRun;
|
|
19
|
+
const { url } = this.siteConfig;
|
|
20
|
+
const localConfig = await readLocalConfig();
|
|
21
|
+
const rootDir = localConfig.rootDir ?? '.';
|
|
22
|
+
const composerJsonPath = join(process.cwd(), rootDir, 'composer.json');
|
|
23
|
+
const composerLockPath = join(process.cwd(), rootDir, 'composer.lock');
|
|
24
|
+
if (!existsSync(composerJsonPath)) {
|
|
25
|
+
this.error(`No composer.json found at ${composerJsonPath}`);
|
|
26
|
+
}
|
|
27
|
+
const composerJsonRaw = await readFile(composerJsonPath, 'utf8');
|
|
28
|
+
const parsed = JSON.parse(composerJsonRaw);
|
|
29
|
+
const packageCount = Object.keys(parsed.require ?? {}).length;
|
|
30
|
+
const hasLock = existsSync(composerLockPath);
|
|
31
|
+
const composerLockRaw = hasLock ? await readFile(composerLockPath, 'utf8') : null;
|
|
32
|
+
this.log(`Pushing composer.json (${packageCount} ${packageCount === 1 ? 'package' : 'packages'}) to ${url}`);
|
|
33
|
+
if (composerLockRaw) {
|
|
34
|
+
this.log(' + composer.lock included (reproducible install)');
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
this.warn('No composer.lock found. The server will resolve versions freely.');
|
|
38
|
+
}
|
|
39
|
+
if (dryRun)
|
|
40
|
+
return;
|
|
41
|
+
const headers = await this.buildAuthHeaders();
|
|
42
|
+
await got.post(`${url}/wp-json/loopress/v1/composer/sync`, {
|
|
43
|
+
headers,
|
|
44
|
+
json: { composerJson: composerJsonRaw, composerLock: composerLockRaw },
|
|
45
|
+
});
|
|
46
|
+
this.log('composer install completed on the server.');
|
|
47
|
+
await this.recordSuccess();
|
|
48
|
+
}
|
|
49
|
+
}
|
package/dist/commands/init.js
CHANGED
|
@@ -22,19 +22,27 @@ export default class Init extends Command {
|
|
|
22
22
|
}
|
|
23
23
|
const projects = configManager.listProjects();
|
|
24
24
|
let projectId;
|
|
25
|
+
let projectLabel;
|
|
25
26
|
if (projects.length > 0) {
|
|
26
27
|
const choices = [
|
|
27
|
-
...projects.map((p) => ({ name: p.name, value: p.
|
|
28
|
+
...projects.map((p) => ({ name: p.name, value: p.id })),
|
|
28
29
|
{ name: 'Enter a project ID manually', value: '__manual__' },
|
|
29
30
|
];
|
|
30
31
|
const choice = await select({
|
|
31
32
|
choices,
|
|
32
33
|
message: 'WordPress project',
|
|
33
34
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
if (choice === '__manual__') {
|
|
36
|
+
projectId = await input({
|
|
37
|
+
message: 'Project ID',
|
|
38
|
+
validate: (value) => (value.trim().length > 0 ? true : 'Project ID cannot be empty'),
|
|
39
|
+
});
|
|
40
|
+
projectLabel = projectId;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
projectId = choice;
|
|
44
|
+
projectLabel = projects.find((p) => p.id === choice).name;
|
|
45
|
+
}
|
|
38
46
|
}
|
|
39
47
|
else {
|
|
40
48
|
this.log('No projects configured yet. Run `lps project config` to add one first.');
|
|
@@ -42,6 +50,7 @@ export default class Init extends Command {
|
|
|
42
50
|
message: 'Project ID',
|
|
43
51
|
validate: (value) => (value.trim().length > 0 ? true : 'Project ID cannot be empty'),
|
|
44
52
|
});
|
|
53
|
+
projectLabel = projectId;
|
|
45
54
|
}
|
|
46
55
|
const snippetPlugin = await select({
|
|
47
56
|
choices: [
|
|
@@ -66,7 +75,7 @@ export default class Init extends Command {
|
|
|
66
75
|
};
|
|
67
76
|
await writeLocalConfig(config);
|
|
68
77
|
this.log(`\n✓ loopress.json created`);
|
|
69
|
-
this.log(` Project: ${
|
|
78
|
+
this.log(` Project: ${projectLabel}`);
|
|
70
79
|
this.log(` Plugin: ${snippetPlugin}`);
|
|
71
80
|
this.log(` Snippets: ${join(rootDir, snippetsDir)}`);
|
|
72
81
|
}
|
package/dist/commands/login.js
CHANGED
|
@@ -5,7 +5,7 @@ import { authManager } from '../config/auth.manager.js';
|
|
|
5
5
|
const CONSOLE_URL = 'https://console.loopress.dev';
|
|
6
6
|
const TIMEOUT_MS = 5 * 60 * 1000;
|
|
7
7
|
export default class Login extends Command {
|
|
8
|
-
static description = 'Log in to Loopress
|
|
8
|
+
static description = 'Log in to the Loopress console';
|
|
9
9
|
static examples = ['$ lps login'];
|
|
10
10
|
async run() {
|
|
11
11
|
const { email, token } = await this.waitForCallback();
|
package/dist/commands/logout.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
2
|
import { authManager } from '../config/auth.manager.js';
|
|
3
3
|
export default class Logout extends Command {
|
|
4
|
-
static description = 'Log out from Loopress console';
|
|
4
|
+
static description = 'Log out from the Loopress console';
|
|
5
5
|
static examples = ['$ lps logout'];
|
|
6
6
|
async run() {
|
|
7
7
|
const auth = authManager.getAuth();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LoopressCommand } from '../../lib/base.js';
|
|
2
2
|
export declare function resolvePluginVersion(slug: string, version: string): Promise<string>;
|
|
3
|
-
export default class
|
|
3
|
+
export default class Add extends LoopressCommand {
|
|
4
4
|
static args: {
|
|
5
5
|
slug: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
6
|
version: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|