@loopress/cli 0.3.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 +75 -283
- package/dist/commands/plugin/pull.d.ts +12 -0
- package/dist/commands/plugin/pull.js +48 -0
- package/dist/commands/plugin/push.d.ts +13 -0
- package/dist/commands/plugin/push.js +111 -0
- package/dist/commands/plugin/require.d.ts +17 -0
- package/dist/commands/plugin/require.js +74 -0
- package/dist/types/plugin.d.ts +15 -0
- package/dist/types/plugin.js +1 -0
- package/dist/utils/loopress-config.d.ts +2 -0
- package/dist/utils/loopress-config.js +8 -3
- package/dist/utils/plugins.d.ts +27 -0
- package/dist/utils/plugins.js +34 -0
- package/oclif.manifest.json +198 -16
- package/package.json +3 -4
- /package/dist/commands/{snippets → snippet}/list.d.ts +0 -0
- /package/dist/commands/{snippets → snippet}/list.js +0 -0
- /package/dist/commands/{snippets → snippet}/pull.d.ts +0 -0
- /package/dist/commands/{snippets → snippet}/pull.js +0 -0
- /package/dist/commands/{snippets → snippet}/push.d.ts +0 -0
- /package/dist/commands/{snippets → snippet}/push.js +0 -0
- /package/dist/commands/{styles → style}/pull.d.ts +0 -0
- /package/dist/commands/{styles → style}/pull.js +0 -0
- /package/dist/commands/{styles → style}/push.d.ts +0 -0
- /package/dist/commands/{styles → style}/push.js +0 -0
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
|
[](https://oclif.io)
|
|
8
6
|
[](https://npmjs.org/package/mynewcli)
|
|
9
7
|
[](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.
|
|
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
|
|
36
|
-
* [`lps
|
|
37
|
-
* [`lps
|
|
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
|
|
52
|
-
* [`lps
|
|
53
|
-
* [`lps
|
|
54
|
-
* [`lps
|
|
55
|
-
* [`lps
|
|
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.
|
|
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.
|
|
104
|
+
_See code: [src/commands/logout.ts](https://github.com/loopress/loopress/blob/v0.4.0/src/commands/logout.ts)_
|
|
110
105
|
|
|
111
|
-
## `lps
|
|
106
|
+
## `lps plugin pull`
|
|
112
107
|
|
|
113
|
-
|
|
108
|
+
Pull installed plugins from WordPress into loopress.json
|
|
114
109
|
|
|
115
110
|
```
|
|
116
111
|
USAGE
|
|
117
|
-
$ lps
|
|
112
|
+
$ lps plugin pull [--password <value>] [--url <value>] [--user <value>] [-d]
|
|
118
113
|
|
|
119
114
|
FLAGS
|
|
120
|
-
--
|
|
115
|
+
-d, --dry-run Show what would be written without making changes
|
|
121
116
|
|
|
122
117
|
GLOBAL FLAGS
|
|
123
|
-
--
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
-
|
|
194
|
-
-v, --verbose
|
|
142
|
+
-d, --dry-run Show what would change without making changes
|
|
195
143
|
|
|
196
144
|
GLOBAL FLAGS
|
|
197
|
-
--
|
|
198
|
-
|
|
199
|
-
|
|
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
|
-
|
|
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
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
## `lps plugins reset`
|
|
153
|
+
$ lps plugins push
|
|
315
154
|
|
|
316
|
-
|
|
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: [
|
|
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
|
|
160
|
+
## `lps plugin require SLUG [VERSION]`
|
|
330
161
|
|
|
331
|
-
|
|
162
|
+
Add a plugin to loopress.json, resolving its latest version from WordPress.org
|
|
332
163
|
|
|
333
164
|
```
|
|
334
165
|
USAGE
|
|
335
|
-
$ lps
|
|
166
|
+
$ lps plugin require SLUG [VERSION] [--password <value>] [--url <value>] [--user <value>] [-d]
|
|
336
167
|
|
|
337
168
|
ARGUMENTS
|
|
338
|
-
|
|
169
|
+
SLUG Plugin slug (WordPress.org)
|
|
170
|
+
[VERSION] Version to pin (default: latest)
|
|
339
171
|
|
|
340
172
|
FLAGS
|
|
341
|
-
-
|
|
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
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
392
|
-
-h, --help Show CLI help.
|
|
393
|
-
-v, --verbose
|
|
186
|
+
$ lps plugins require woocommerce 8.9.1
|
|
394
187
|
|
|
395
|
-
|
|
396
|
-
Update installed plugins.
|
|
188
|
+
$ lps plugins require contact-form-7 --dry-run
|
|
397
189
|
```
|
|
398
190
|
|
|
399
|
-
_See code: [
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
295
|
+
## `lps snippet list`
|
|
504
296
|
|
|
505
297
|
List snippets from WordPress
|
|
506
298
|
|
|
507
299
|
```
|
|
508
300
|
USAGE
|
|
509
|
-
$ lps
|
|
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/
|
|
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
|
|
326
|
+
## `lps snippet pull [PATH]`
|
|
535
327
|
|
|
536
328
|
Pull snippets from WordPress
|
|
537
329
|
|
|
538
330
|
```
|
|
539
331
|
USAGE
|
|
540
|
-
$ lps
|
|
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/
|
|
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
|
|
362
|
+
## `lps snippet push [PATH]`
|
|
571
363
|
|
|
572
364
|
Push snippets to WordPress
|
|
573
365
|
|
|
574
366
|
```
|
|
575
367
|
USAGE
|
|
576
|
-
$ lps
|
|
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/
|
|
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
|
|
398
|
+
## `lps style pull`
|
|
607
399
|
|
|
608
400
|
Pull Global Styles from WordPress
|
|
609
401
|
|
|
610
402
|
```
|
|
611
403
|
USAGE
|
|
612
|
-
$ lps
|
|
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/
|
|
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
|
|
425
|
+
## `lps style push`
|
|
634
426
|
|
|
635
427
|
Push Global Styles to WordPress
|
|
636
428
|
|
|
637
429
|
```
|
|
638
430
|
USAGE
|
|
639
|
-
$ lps
|
|
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/
|
|
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
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { confirm } from '@inquirer/prompts';
|
|
2
|
+
import { Flags } from '@oclif/core';
|
|
3
|
+
import got from 'got';
|
|
4
|
+
import { LoopressCommand } from '../../lib/base.js';
|
|
5
|
+
import { readLocalConfig } from '../../utils/loopress-config.js';
|
|
6
|
+
import { diffPlugins } from '../../utils/plugins.js';
|
|
7
|
+
export default class Push extends LoopressCommand {
|
|
8
|
+
static description = 'Sync plugins on WordPress to match loopress.json';
|
|
9
|
+
static examples = ['$ lps plugins push', '$ lps plugins push --dry-run'];
|
|
10
|
+
static flags = {
|
|
11
|
+
...LoopressCommand.baseFlags,
|
|
12
|
+
'dry-run': Flags.boolean({ char: 'd', description: 'Show what would change without making changes' }),
|
|
13
|
+
};
|
|
14
|
+
async run() {
|
|
15
|
+
const { flags } = await this.parse(Push);
|
|
16
|
+
const dryRun = flags['dry-run'];
|
|
17
|
+
const { url } = this.siteConfig;
|
|
18
|
+
const localConfig = await readLocalConfig();
|
|
19
|
+
const manifest = localConfig.plugins;
|
|
20
|
+
if (!manifest || Object.keys(manifest).length === 0) {
|
|
21
|
+
this.error('No plugins found in loopress.json. Run `lps plugins pull` first.');
|
|
22
|
+
}
|
|
23
|
+
this.log(`Pushing plugins to ${url}`);
|
|
24
|
+
const headers = await this.buildAuthHeaders();
|
|
25
|
+
const installed = await got.get(`${url}/wp-json/loopress/v1/plugins`, { headers }).json();
|
|
26
|
+
const { drifted, toActivate, toInstall } = diffPlugins(manifest, installed);
|
|
27
|
+
if (toInstall.length === 0 && toActivate.length === 0 && drifted.length === 0) {
|
|
28
|
+
this.log('Everything is already in sync.');
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (toInstall.length > 0) {
|
|
32
|
+
this.log(`\nTo install (${toInstall.length}):`);
|
|
33
|
+
for (const a of toInstall)
|
|
34
|
+
this.log(` + ${a.slug} @ ${a.targetVersion}`);
|
|
35
|
+
}
|
|
36
|
+
if (toActivate.length > 0) {
|
|
37
|
+
this.log(`\nTo activate (${toActivate.length}):`);
|
|
38
|
+
for (const a of toActivate)
|
|
39
|
+
this.log(` ↑ ${a.slug}`);
|
|
40
|
+
}
|
|
41
|
+
if (drifted.length > 0) {
|
|
42
|
+
this.log(`\nVersion mismatch (${drifted.length}):`);
|
|
43
|
+
for (const a of drifted) {
|
|
44
|
+
this.log(` ~ ${a.slug}: site has ${a.currentVersion}, manifest wants ${a.targetVersion}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (dryRun)
|
|
48
|
+
return;
|
|
49
|
+
// Install missing plugins and activate them.
|
|
50
|
+
for (const action of toInstall) {
|
|
51
|
+
this.log(`\nInstalling ${action.slug} @ ${action.targetVersion}...`);
|
|
52
|
+
try {
|
|
53
|
+
const result = await got
|
|
54
|
+
.post(`${url}/wp-json/loopress/v1/plugins/install`, {
|
|
55
|
+
headers,
|
|
56
|
+
json: { slug: action.slug, version: action.targetVersion },
|
|
57
|
+
})
|
|
58
|
+
.json();
|
|
59
|
+
this.log(` ✓ ${result.message}`);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
this.warn(` Failed to install ${action.slug}: ${error.message}`);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
await this.activatePlugin(url, headers, action.slug);
|
|
66
|
+
}
|
|
67
|
+
// Activate installed-but-inactive plugins without prompting.
|
|
68
|
+
for (const action of toActivate) {
|
|
69
|
+
this.log(`\nActivating ${action.slug}...`);
|
|
70
|
+
await this.activatePlugin(url, headers, action.slug);
|
|
71
|
+
}
|
|
72
|
+
// Prompt per drifted plugin before syncing.
|
|
73
|
+
for (const action of drifted) {
|
|
74
|
+
this.log('');
|
|
75
|
+
const proceed = await confirm({
|
|
76
|
+
default: false,
|
|
77
|
+
message: `${action.slug} is at ${action.currentVersion} on the site but manifest wants ${action.targetVersion}. Sync to ${action.targetVersion}?`,
|
|
78
|
+
});
|
|
79
|
+
if (!proceed) {
|
|
80
|
+
this.log(` Skipped ${action.slug}`);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
this.log(` Syncing ${action.slug} to ${action.targetVersion}...`);
|
|
84
|
+
try {
|
|
85
|
+
const result = await got
|
|
86
|
+
.post(`${url}/wp-json/loopress/v1/plugins/install`, {
|
|
87
|
+
headers,
|
|
88
|
+
json: { slug: action.slug, version: action.targetVersion },
|
|
89
|
+
})
|
|
90
|
+
.json();
|
|
91
|
+
this.log(` ✓ ${result.message}`);
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
this.warn(` Failed to sync ${action.slug}: ${error.message}`);
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
await this.activatePlugin(url, headers, action.slug);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
async activatePlugin(url, headers, slug) {
|
|
101
|
+
try {
|
|
102
|
+
const result = await got
|
|
103
|
+
.post(`${url}/wp-json/loopress/v1/plugins/activate`, { headers, json: { slug } })
|
|
104
|
+
.json();
|
|
105
|
+
this.log(` ✓ ${result.message}`);
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
this.warn(` Failed to activate ${slug}: ${error.message}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LoopressCommand } from '../../lib/base.js';
|
|
2
|
+
export declare function resolvePluginVersion(slug: string, version: string): Promise<string>;
|
|
3
|
+
export default class Require extends LoopressCommand {
|
|
4
|
+
static args: {
|
|
5
|
+
slug: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
version: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static description: string;
|
|
9
|
+
static examples: string[];
|
|
10
|
+
static flags: {
|
|
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
|
+
};
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Args, 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
|
+
const WP_ORG_API = 'https://api.wordpress.org/plugins/info/1.2/';
|
|
6
|
+
export async function resolvePluginVersion(slug, version) {
|
|
7
|
+
if (version !== 'latest')
|
|
8
|
+
return version;
|
|
9
|
+
let info;
|
|
10
|
+
try {
|
|
11
|
+
info = await got
|
|
12
|
+
.get(WP_ORG_API, {
|
|
13
|
+
searchParams: {
|
|
14
|
+
action: 'plugin_information',
|
|
15
|
+
'request[slug]': slug,
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
.json();
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
throw new Error(`Plugin "${slug}" not found on WordPress.org.`);
|
|
22
|
+
}
|
|
23
|
+
if (info.error)
|
|
24
|
+
throw new Error(`Plugin "${slug}" not found on WordPress.org.`);
|
|
25
|
+
return info.version;
|
|
26
|
+
}
|
|
27
|
+
export default class Require extends LoopressCommand {
|
|
28
|
+
static args = {
|
|
29
|
+
slug: Args.string({ description: 'Plugin slug (WordPress.org)', required: true }),
|
|
30
|
+
version: Args.string({ description: 'Version to pin (default: latest)' }),
|
|
31
|
+
};
|
|
32
|
+
static description = 'Add a plugin to loopress.json, resolving its latest version from WordPress.org';
|
|
33
|
+
static examples = [
|
|
34
|
+
'$ lps plugins require woocommerce',
|
|
35
|
+
'$ lps plugins require woocommerce 8.9.1',
|
|
36
|
+
'$ lps plugins require contact-form-7 --dry-run',
|
|
37
|
+
];
|
|
38
|
+
static flags = {
|
|
39
|
+
...LoopressCommand.baseFlags,
|
|
40
|
+
'dry-run': Flags.boolean({ char: 'd', description: 'Show what would be written without making changes' }),
|
|
41
|
+
};
|
|
42
|
+
async run() {
|
|
43
|
+
const { args, flags } = await this.parse(Require);
|
|
44
|
+
const dryRun = flags['dry-run'];
|
|
45
|
+
const { slug } = args;
|
|
46
|
+
const requestedVersion = args.version ?? 'latest';
|
|
47
|
+
this.log(`Resolving ${slug}@${requestedVersion}...`);
|
|
48
|
+
let resolvedVersion;
|
|
49
|
+
try {
|
|
50
|
+
resolvedVersion = await resolvePluginVersion(slug, requestedVersion);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
this.error(error.message);
|
|
54
|
+
}
|
|
55
|
+
this.log(`Resolved: ${slug}@${resolvedVersion}`);
|
|
56
|
+
const localConfig = await readLocalConfig();
|
|
57
|
+
const existing = localConfig.plugins ?? {};
|
|
58
|
+
if (existing[slug] === resolvedVersion) {
|
|
59
|
+
this.log(`${slug}@${resolvedVersion} is already in loopress.json — nothing to do.`);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const updated = existing[slug] !== undefined;
|
|
63
|
+
const label = updated ? `${existing[slug]} → ${resolvedVersion}` : resolvedVersion;
|
|
64
|
+
if (dryRun) {
|
|
65
|
+
this.log(`[dry-run] Would ${updated ? 'update' : 'add'} ${slug}: ${label}`);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
await writeLocalConfig({
|
|
69
|
+
...localConfig,
|
|
70
|
+
plugins: { ...existing, [slug]: resolvedVersion },
|
|
71
|
+
});
|
|
72
|
+
this.log(`${updated ? 'Updated' : 'Added'} ${slug}: ${label}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface InstalledPlugin {
|
|
2
|
+
active: boolean;
|
|
3
|
+
file: string;
|
|
4
|
+
name: string;
|
|
5
|
+
slug: string;
|
|
6
|
+
version: string;
|
|
7
|
+
}
|
|
8
|
+
export interface InstallResult {
|
|
9
|
+
message: string;
|
|
10
|
+
version: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ActivateResult {
|
|
13
|
+
message: string;
|
|
14
|
+
}
|
|
15
|
+
export type PluginManifest = Record<string, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export interface LoopressLocalConfig {
|
|
2
|
+
plugins?: Record<string, string>;
|
|
2
3
|
rootDir?: string;
|
|
3
4
|
snippets?: string;
|
|
4
5
|
styles?: string;
|
|
5
6
|
}
|
|
6
7
|
export declare function readLocalConfig(): Promise<LoopressLocalConfig>;
|
|
8
|
+
export declare function writeLocalConfig(config: LoopressLocalConfig): Promise<void>;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
3
|
import { join } from 'node:path';
|
|
3
4
|
export async function readLocalConfig() {
|
|
4
|
-
const configPath = join(process.cwd(), 'loopress.
|
|
5
|
+
const configPath = join(process.cwd(), 'loopress.json');
|
|
5
6
|
if (!existsSync(configPath))
|
|
6
7
|
return {};
|
|
7
8
|
try {
|
|
8
|
-
const
|
|
9
|
-
return
|
|
9
|
+
const content = await readFile(configPath, 'utf8');
|
|
10
|
+
return JSON.parse(content);
|
|
10
11
|
}
|
|
11
12
|
catch {
|
|
12
13
|
return {};
|
|
13
14
|
}
|
|
14
15
|
}
|
|
16
|
+
export async function writeLocalConfig(config) {
|
|
17
|
+
const configPath = join(process.cwd(), 'loopress.json');
|
|
18
|
+
await writeFile(configPath, JSON.stringify(config, null, 2) + '\n', 'utf8');
|
|
19
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { InstalledPlugin, PluginManifest } from '../types/plugin.js';
|
|
2
|
+
export interface PluginDiff {
|
|
3
|
+
drifted: Array<{
|
|
4
|
+
currentVersion: string;
|
|
5
|
+
slug: string;
|
|
6
|
+
targetVersion: string;
|
|
7
|
+
}>;
|
|
8
|
+
toActivate: Array<{
|
|
9
|
+
slug: string;
|
|
10
|
+
}>;
|
|
11
|
+
toInstall: Array<{
|
|
12
|
+
slug: string;
|
|
13
|
+
targetVersion: string;
|
|
14
|
+
}>;
|
|
15
|
+
upToDate: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface MergeResult {
|
|
18
|
+
added: string[];
|
|
19
|
+
merged: PluginManifest;
|
|
20
|
+
updated: Array<{
|
|
21
|
+
from: string;
|
|
22
|
+
slug: string;
|
|
23
|
+
to: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
export declare function mergePluginManifest(existing: PluginManifest, incoming: PluginManifest): MergeResult;
|
|
27
|
+
export declare function diffPlugins(manifest: PluginManifest, installed: InstalledPlugin[]): PluginDiff;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export function mergePluginManifest(existing, incoming) {
|
|
2
|
+
const merged = { ...existing, ...incoming };
|
|
3
|
+
const added = Object.keys(incoming).filter((s) => !(s in existing));
|
|
4
|
+
const updated = Object.keys(incoming)
|
|
5
|
+
.filter((s) => s in existing && existing[s] !== incoming[s])
|
|
6
|
+
.map((s) => ({ from: existing[s], slug: s, to: incoming[s] }));
|
|
7
|
+
return { added, merged, updated };
|
|
8
|
+
}
|
|
9
|
+
export function diffPlugins(manifest, installed) {
|
|
10
|
+
const installedMap = new Map(installed.map((p) => [p.slug, p]));
|
|
11
|
+
const toInstall = [];
|
|
12
|
+
const toActivate = [];
|
|
13
|
+
const drifted = [];
|
|
14
|
+
const upToDate = [];
|
|
15
|
+
for (const [slug, targetVersion] of Object.entries(manifest)) {
|
|
16
|
+
const live = installedMap.get(slug);
|
|
17
|
+
if (!live) {
|
|
18
|
+
toInstall.push({ slug, targetVersion });
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (live.version === targetVersion) {
|
|
22
|
+
if (live.active) {
|
|
23
|
+
upToDate.push(slug);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
toActivate.push({ slug });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
drifted.push({ currentVersion: live.version, slug, targetVersion });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return { drifted, toActivate, toInstall, upToDate };
|
|
34
|
+
}
|
package/oclif.manifest.json
CHANGED
|
@@ -46,6 +46,188 @@
|
|
|
46
46
|
"logout.js"
|
|
47
47
|
]
|
|
48
48
|
},
|
|
49
|
+
"plugin:pull": {
|
|
50
|
+
"aliases": [],
|
|
51
|
+
"args": {},
|
|
52
|
+
"description": "Pull installed plugins from WordPress into loopress.json",
|
|
53
|
+
"examples": [
|
|
54
|
+
"$ lps plugins pull",
|
|
55
|
+
"$ lps plugins pull --dry-run"
|
|
56
|
+
],
|
|
57
|
+
"flags": {
|
|
58
|
+
"password": {
|
|
59
|
+
"description": "WordPress application password (fallback; prefer `lps project config`)",
|
|
60
|
+
"helpGroup": "GLOBAL",
|
|
61
|
+
"name": "password",
|
|
62
|
+
"hasDynamicHelp": false,
|
|
63
|
+
"multiple": false,
|
|
64
|
+
"type": "option"
|
|
65
|
+
},
|
|
66
|
+
"url": {
|
|
67
|
+
"description": "WordPress URL (fallback; prefer `lps project config`)",
|
|
68
|
+
"helpGroup": "GLOBAL",
|
|
69
|
+
"name": "url",
|
|
70
|
+
"hasDynamicHelp": false,
|
|
71
|
+
"multiple": false,
|
|
72
|
+
"type": "option"
|
|
73
|
+
},
|
|
74
|
+
"user": {
|
|
75
|
+
"description": "WordPress username (fallback; prefer `lps project config`)",
|
|
76
|
+
"helpGroup": "GLOBAL",
|
|
77
|
+
"name": "user",
|
|
78
|
+
"hasDynamicHelp": false,
|
|
79
|
+
"multiple": false,
|
|
80
|
+
"type": "option"
|
|
81
|
+
},
|
|
82
|
+
"dry-run": {
|
|
83
|
+
"char": "d",
|
|
84
|
+
"description": "Show what would be written without making changes",
|
|
85
|
+
"name": "dry-run",
|
|
86
|
+
"allowNo": false,
|
|
87
|
+
"type": "boolean"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"hasDynamicHelp": false,
|
|
91
|
+
"hiddenAliases": [],
|
|
92
|
+
"id": "plugin:pull",
|
|
93
|
+
"pluginAlias": "@loopress/cli",
|
|
94
|
+
"pluginName": "@loopress/cli",
|
|
95
|
+
"pluginType": "core",
|
|
96
|
+
"strict": true,
|
|
97
|
+
"enableJsonFlag": false,
|
|
98
|
+
"isESM": true,
|
|
99
|
+
"relativePath": [
|
|
100
|
+
"dist",
|
|
101
|
+
"commands",
|
|
102
|
+
"plugin",
|
|
103
|
+
"pull.js"
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
"plugin:push": {
|
|
107
|
+
"aliases": [],
|
|
108
|
+
"args": {},
|
|
109
|
+
"description": "Sync plugins on WordPress to match loopress.json",
|
|
110
|
+
"examples": [
|
|
111
|
+
"$ lps plugins push",
|
|
112
|
+
"$ lps plugins push --dry-run"
|
|
113
|
+
],
|
|
114
|
+
"flags": {
|
|
115
|
+
"password": {
|
|
116
|
+
"description": "WordPress application password (fallback; prefer `lps project config`)",
|
|
117
|
+
"helpGroup": "GLOBAL",
|
|
118
|
+
"name": "password",
|
|
119
|
+
"hasDynamicHelp": false,
|
|
120
|
+
"multiple": false,
|
|
121
|
+
"type": "option"
|
|
122
|
+
},
|
|
123
|
+
"url": {
|
|
124
|
+
"description": "WordPress URL (fallback; prefer `lps project config`)",
|
|
125
|
+
"helpGroup": "GLOBAL",
|
|
126
|
+
"name": "url",
|
|
127
|
+
"hasDynamicHelp": false,
|
|
128
|
+
"multiple": false,
|
|
129
|
+
"type": "option"
|
|
130
|
+
},
|
|
131
|
+
"user": {
|
|
132
|
+
"description": "WordPress username (fallback; prefer `lps project config`)",
|
|
133
|
+
"helpGroup": "GLOBAL",
|
|
134
|
+
"name": "user",
|
|
135
|
+
"hasDynamicHelp": false,
|
|
136
|
+
"multiple": false,
|
|
137
|
+
"type": "option"
|
|
138
|
+
},
|
|
139
|
+
"dry-run": {
|
|
140
|
+
"char": "d",
|
|
141
|
+
"description": "Show what would change without making changes",
|
|
142
|
+
"name": "dry-run",
|
|
143
|
+
"allowNo": false,
|
|
144
|
+
"type": "boolean"
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"hasDynamicHelp": false,
|
|
148
|
+
"hiddenAliases": [],
|
|
149
|
+
"id": "plugin:push",
|
|
150
|
+
"pluginAlias": "@loopress/cli",
|
|
151
|
+
"pluginName": "@loopress/cli",
|
|
152
|
+
"pluginType": "core",
|
|
153
|
+
"strict": true,
|
|
154
|
+
"enableJsonFlag": false,
|
|
155
|
+
"isESM": true,
|
|
156
|
+
"relativePath": [
|
|
157
|
+
"dist",
|
|
158
|
+
"commands",
|
|
159
|
+
"plugin",
|
|
160
|
+
"push.js"
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
"plugin:require": {
|
|
164
|
+
"aliases": [],
|
|
165
|
+
"args": {
|
|
166
|
+
"slug": {
|
|
167
|
+
"description": "Plugin slug (WordPress.org)",
|
|
168
|
+
"name": "slug",
|
|
169
|
+
"required": true
|
|
170
|
+
},
|
|
171
|
+
"version": {
|
|
172
|
+
"description": "Version to pin (default: latest)",
|
|
173
|
+
"name": "version"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
"description": "Add a plugin to loopress.json, resolving its latest version from WordPress.org",
|
|
177
|
+
"examples": [
|
|
178
|
+
"$ lps plugins require woocommerce",
|
|
179
|
+
"$ lps plugins require woocommerce 8.9.1",
|
|
180
|
+
"$ lps plugins require contact-form-7 --dry-run"
|
|
181
|
+
],
|
|
182
|
+
"flags": {
|
|
183
|
+
"password": {
|
|
184
|
+
"description": "WordPress application password (fallback; prefer `lps project config`)",
|
|
185
|
+
"helpGroup": "GLOBAL",
|
|
186
|
+
"name": "password",
|
|
187
|
+
"hasDynamicHelp": false,
|
|
188
|
+
"multiple": false,
|
|
189
|
+
"type": "option"
|
|
190
|
+
},
|
|
191
|
+
"url": {
|
|
192
|
+
"description": "WordPress URL (fallback; prefer `lps project config`)",
|
|
193
|
+
"helpGroup": "GLOBAL",
|
|
194
|
+
"name": "url",
|
|
195
|
+
"hasDynamicHelp": false,
|
|
196
|
+
"multiple": false,
|
|
197
|
+
"type": "option"
|
|
198
|
+
},
|
|
199
|
+
"user": {
|
|
200
|
+
"description": "WordPress username (fallback; prefer `lps project config`)",
|
|
201
|
+
"helpGroup": "GLOBAL",
|
|
202
|
+
"name": "user",
|
|
203
|
+
"hasDynamicHelp": false,
|
|
204
|
+
"multiple": false,
|
|
205
|
+
"type": "option"
|
|
206
|
+
},
|
|
207
|
+
"dry-run": {
|
|
208
|
+
"char": "d",
|
|
209
|
+
"description": "Show what would be written without making changes",
|
|
210
|
+
"name": "dry-run",
|
|
211
|
+
"allowNo": false,
|
|
212
|
+
"type": "boolean"
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
"hasDynamicHelp": false,
|
|
216
|
+
"hiddenAliases": [],
|
|
217
|
+
"id": "plugin:require",
|
|
218
|
+
"pluginAlias": "@loopress/cli",
|
|
219
|
+
"pluginName": "@loopress/cli",
|
|
220
|
+
"pluginType": "core",
|
|
221
|
+
"strict": true,
|
|
222
|
+
"enableJsonFlag": false,
|
|
223
|
+
"isESM": true,
|
|
224
|
+
"relativePath": [
|
|
225
|
+
"dist",
|
|
226
|
+
"commands",
|
|
227
|
+
"plugin",
|
|
228
|
+
"require.js"
|
|
229
|
+
]
|
|
230
|
+
},
|
|
49
231
|
"project:config": {
|
|
50
232
|
"aliases": [],
|
|
51
233
|
"args": {},
|
|
@@ -190,7 +372,7 @@
|
|
|
190
372
|
"switch.js"
|
|
191
373
|
]
|
|
192
374
|
},
|
|
193
|
-
"
|
|
375
|
+
"snippet:list": {
|
|
194
376
|
"aliases": [],
|
|
195
377
|
"args": {},
|
|
196
378
|
"description": "List snippets from WordPress",
|
|
@@ -247,7 +429,7 @@
|
|
|
247
429
|
},
|
|
248
430
|
"hasDynamicHelp": false,
|
|
249
431
|
"hiddenAliases": [],
|
|
250
|
-
"id": "
|
|
432
|
+
"id": "snippet:list",
|
|
251
433
|
"pluginAlias": "@loopress/cli",
|
|
252
434
|
"pluginName": "@loopress/cli",
|
|
253
435
|
"pluginType": "core",
|
|
@@ -257,11 +439,11 @@
|
|
|
257
439
|
"relativePath": [
|
|
258
440
|
"dist",
|
|
259
441
|
"commands",
|
|
260
|
-
"
|
|
442
|
+
"snippet",
|
|
261
443
|
"list.js"
|
|
262
444
|
]
|
|
263
445
|
},
|
|
264
|
-
"
|
|
446
|
+
"snippet:pull": {
|
|
265
447
|
"aliases": [],
|
|
266
448
|
"args": {
|
|
267
449
|
"path": {
|
|
@@ -324,7 +506,7 @@
|
|
|
324
506
|
},
|
|
325
507
|
"hasDynamicHelp": false,
|
|
326
508
|
"hiddenAliases": [],
|
|
327
|
-
"id": "
|
|
509
|
+
"id": "snippet:pull",
|
|
328
510
|
"pluginAlias": "@loopress/cli",
|
|
329
511
|
"pluginName": "@loopress/cli",
|
|
330
512
|
"pluginType": "core",
|
|
@@ -334,11 +516,11 @@
|
|
|
334
516
|
"relativePath": [
|
|
335
517
|
"dist",
|
|
336
518
|
"commands",
|
|
337
|
-
"
|
|
519
|
+
"snippet",
|
|
338
520
|
"pull.js"
|
|
339
521
|
]
|
|
340
522
|
},
|
|
341
|
-
"
|
|
523
|
+
"snippet:push": {
|
|
342
524
|
"aliases": [],
|
|
343
525
|
"args": {
|
|
344
526
|
"path": {
|
|
@@ -401,7 +583,7 @@
|
|
|
401
583
|
},
|
|
402
584
|
"hasDynamicHelp": false,
|
|
403
585
|
"hiddenAliases": [],
|
|
404
|
-
"id": "
|
|
586
|
+
"id": "snippet:push",
|
|
405
587
|
"pluginAlias": "@loopress/cli",
|
|
406
588
|
"pluginName": "@loopress/cli",
|
|
407
589
|
"pluginType": "core",
|
|
@@ -411,11 +593,11 @@
|
|
|
411
593
|
"relativePath": [
|
|
412
594
|
"dist",
|
|
413
595
|
"commands",
|
|
414
|
-
"
|
|
596
|
+
"snippet",
|
|
415
597
|
"push.js"
|
|
416
598
|
]
|
|
417
599
|
},
|
|
418
|
-
"
|
|
600
|
+
"style:pull": {
|
|
419
601
|
"aliases": [],
|
|
420
602
|
"args": {},
|
|
421
603
|
"description": "Pull Global Styles from WordPress",
|
|
@@ -458,7 +640,7 @@
|
|
|
458
640
|
},
|
|
459
641
|
"hasDynamicHelp": false,
|
|
460
642
|
"hiddenAliases": [],
|
|
461
|
-
"id": "
|
|
643
|
+
"id": "style:pull",
|
|
462
644
|
"pluginAlias": "@loopress/cli",
|
|
463
645
|
"pluginName": "@loopress/cli",
|
|
464
646
|
"pluginType": "core",
|
|
@@ -468,11 +650,11 @@
|
|
|
468
650
|
"relativePath": [
|
|
469
651
|
"dist",
|
|
470
652
|
"commands",
|
|
471
|
-
"
|
|
653
|
+
"style",
|
|
472
654
|
"pull.js"
|
|
473
655
|
]
|
|
474
656
|
},
|
|
475
|
-
"
|
|
657
|
+
"style:push": {
|
|
476
658
|
"aliases": [],
|
|
477
659
|
"args": {},
|
|
478
660
|
"description": "Push Global Styles to WordPress",
|
|
@@ -515,7 +697,7 @@
|
|
|
515
697
|
},
|
|
516
698
|
"hasDynamicHelp": false,
|
|
517
699
|
"hiddenAliases": [],
|
|
518
|
-
"id": "
|
|
700
|
+
"id": "style:push",
|
|
519
701
|
"pluginAlias": "@loopress/cli",
|
|
520
702
|
"pluginName": "@loopress/cli",
|
|
521
703
|
"pluginType": "core",
|
|
@@ -525,10 +707,10 @@
|
|
|
525
707
|
"relativePath": [
|
|
526
708
|
"dist",
|
|
527
709
|
"commands",
|
|
528
|
-
"
|
|
710
|
+
"style",
|
|
529
711
|
"push.js"
|
|
530
712
|
]
|
|
531
713
|
}
|
|
532
714
|
},
|
|
533
|
-
"version": "0.
|
|
715
|
+
"version": "0.4.0"
|
|
534
716
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loopress/cli",
|
|
3
3
|
"description": "CLI tool for syncing WordPress CodeSnippets, styles, and menus via the REST API",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"author": "jean-smaug",
|
|
6
6
|
"bin": {
|
|
7
7
|
"loopress": "bin/run.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@oclif/prettier-config": "^0.2.1",
|
|
25
25
|
"@oclif/test": "^4",
|
|
26
26
|
"@types/chai": "^5.2.3",
|
|
27
|
-
"@types/mocha": "^10",
|
|
27
|
+
"@types/mocha": "^10.0.10",
|
|
28
28
|
"@types/node": "25.9.3",
|
|
29
29
|
"chai": "^6.2.2",
|
|
30
30
|
"eslint": "^9",
|
|
@@ -63,8 +63,7 @@
|
|
|
63
63
|
"commands": "./dist/commands",
|
|
64
64
|
"helpClass": "./dist/help.js",
|
|
65
65
|
"plugins": [
|
|
66
|
-
"@oclif/plugin-help"
|
|
67
|
-
"@oclif/plugin-plugins"
|
|
66
|
+
"@oclif/plugin-help"
|
|
68
67
|
],
|
|
69
68
|
"topicSeparator": " "
|
|
70
69
|
},
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|