@swell/cli 0.1.1 → 1.0.0-alpha
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 +31 -68
- package/dist/bin/{multipart-parser-fb5a5deb.js → multipart-parser-97941dba.js} +22 -24
- package/dist/bin/{swell-2acb6c0f.js → swell-cfd63c19.js} +12444 -11449
- package/dist/bin/swell.js +22 -24
- package/dist/man/swell.1 +12 -24
- package/package.json +20 -18
package/README.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# @swell/cli
|
|
2
2
|
|
|
3
|
-
We're in beta: commands and arguments can still change
|
|
3
|
+
#We're in beta: commands and arguments can still change.#
|
|
4
|
+
|
|
5
|
+
Install with:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install -g @swell/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
If you are using tools for version managing like [asdf](https://asdf-vm.com/), make sure you [reshim](https://asdf-vm.com/manage/core.html#reshim) after install:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
asdf reshim
|
|
15
|
+
```
|
|
4
16
|
|
|
5
17
|
# Commands
|
|
6
18
|
|
|
@@ -12,15 +24,10 @@ Commands tend to support the following helper options:
|
|
|
12
24
|
- --verbose (-v): Boolean, outputs all commands
|
|
13
25
|
- --dry-run: Boolean, dry runs requests that delete data, but doesn't run them
|
|
14
26
|
- --yes (-y): Boolean, answers all confirmation questions with **yes**.
|
|
15
|
-
- --secret-key: String, Enables ephemeral secret-key based authentication for commands
|
|
16
|
-
|
|
17
|
-
## Store namespaces
|
|
18
|
-
|
|
19
|
-
All commands accept a `--store` or `-s` option, which allows switching the context of the CLI commands to the selected store. When not in use, all commands refer to the set default store.
|
|
20
27
|
|
|
21
28
|
## Login
|
|
22
29
|
|
|
23
|
-
The `login` command authenticates and stores a user's session locally. Saved sessions can/will be used by other commands, unless a secret key is specified.
|
|
30
|
+
The `admin login` command authenticates and stores a user's session locally. Saved sessions can/will be used by other commands, unless a secret key is specified.
|
|
24
31
|
|
|
25
32
|
```sh
|
|
26
33
|
swell login [--username (-u) String] [--password (-p) String] [--set-default Boolean]
|
|
@@ -30,54 +37,33 @@ swell login [--username (-u) String] [--password (-p) String] [--set-default Boo
|
|
|
30
37
|
|
|
31
38
|
```sh
|
|
32
39
|
swell login
|
|
33
|
-
swell login --
|
|
34
|
-
swell login --store test-default --set-default
|
|
35
|
-
# local login
|
|
36
|
-
ADMIN_API_BASE_URL='http://${STORE_ID}.swell.test:4001/admin/api' swell login
|
|
40
|
+
swell login --set-default
|
|
37
41
|
```
|
|
38
42
|
|
|
39
|
-
##
|
|
43
|
+
## Storefronts
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
Push or pull storefront settings. Scopes include `settings`, `editor` and `menus`.
|
|
45
|
+
List all storefronts associated to logged in user:
|
|
44
46
|
|
|
45
47
|
```sh
|
|
46
|
-
|
|
47
|
-
swell settings pull SCOPE [--file (-f) String] [--output (-o) Boolean] [--strategy String]
|
|
48
|
-
|
|
49
|
-
# push => send settings from a JSON file or stdin to the server
|
|
50
|
-
swell settings push SCOPE [--file (-f) String] [--input (-i) Boolean] [--strategy String]
|
|
48
|
+
swell storefronts list
|
|
51
49
|
```
|
|
52
50
|
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
Retrieves storefront configuration data from the server and writes it to a file if specified or stdout by default. It requires a type to run. Configuration types allowed are "editor", "menus" and "settings":
|
|
55
52
|
```sh
|
|
56
|
-
swell
|
|
57
|
-
swell storefront settings pull settings -f settings/store.json --strategy ours # keeps our version of the file in case of conflicts
|
|
58
|
-
|
|
59
|
-
swell storefront settings push editor -f settings/editor.json
|
|
60
|
-
swell storefront settings push editor -f settings/editor.json --strategy "set" # overwrites the settings object instead of merging
|
|
61
|
-
|
|
62
|
-
cat settings/menus.json | swell storefront settings push menus -i --strategy "defaults" # merges remote settings on top of the settings being pushed, as a default mechanism
|
|
53
|
+
swell storefronts pull --id String --type (-t) String [--file (-f) String]
|
|
63
54
|
```
|
|
64
55
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
Manage a user's SSH keys to a storefront. Needs session authentication (`swell login`).
|
|
68
|
-
|
|
56
|
+
Send storefront configuration data to the server. Configuration types allowed are "editor", "menus" and "settings":
|
|
69
57
|
```sh
|
|
70
|
-
swell
|
|
71
|
-
swell storefront ssh-keys add [--name String]
|
|
72
|
-
swell storefront ssh-keys delete KEY_ID [--dry-run Boolean]
|
|
58
|
+
swell storefronts push --id String --type (-t) String [--file (-f) String] [--strategy (-i) String]
|
|
73
59
|
```
|
|
74
60
|
|
|
75
61
|
### Examples
|
|
76
62
|
|
|
77
63
|
```sh
|
|
78
|
-
swell
|
|
79
|
-
swell
|
|
80
|
-
swell
|
|
64
|
+
swell storefronts pull --id P5OzfzLD -t editor
|
|
65
|
+
swell storefronts pull --id P5OzfzLD -t menus -f menus.json
|
|
66
|
+
swell storefronts push --id P5OzfzLD -t editor -s set -f ../origin-storefront/config/editor.json
|
|
81
67
|
```
|
|
82
68
|
|
|
83
69
|
## Model
|
|
@@ -85,12 +71,12 @@ swell storefront ssh-keys delete abcdef1234567890
|
|
|
85
71
|
Push or pull model definitions, including namespaced models (e.g. content models), abstract content models and content fields.
|
|
86
72
|
|
|
87
73
|
```sh
|
|
88
|
-
# pull => retrieves a model from the server and tries to merge and/or write to a specified JSON file or stdout
|
|
74
|
+
# pull => retrieves a model from the server and tries to merge and/or write to a specified JSON file or stdout (by default)
|
|
89
75
|
# --content flag toggles between base models and abstract content models or content fields
|
|
90
|
-
swell model pull MODEL_ID [--file (-f) String] [--
|
|
76
|
+
swell model pull -m MODEL_ID [--file (-f) String] [--strategy (-s) String] [--content Boolean]
|
|
91
77
|
|
|
92
78
|
# push => send a model definition from a JSON file or stdin to the server
|
|
93
|
-
swell model push [--file (-f) String] [--input (-i)
|
|
79
|
+
swell model push [--file (-f) String] [--input (-i) stdin] [--content Boolean]
|
|
94
80
|
```
|
|
95
81
|
|
|
96
82
|
It is important that the model definition includes some fields depending on the type/source of the model.
|
|
@@ -129,32 +115,9 @@ It is important that the model definition includes some fields depending on the
|
|
|
129
115
|
### Examples
|
|
130
116
|
|
|
131
117
|
```sh
|
|
132
|
-
swell model pull products
|
|
133
|
-
swell model pull
|
|
134
|
-
swell model pull theme.origin.page --content --f models/page.json # pull a content model
|
|
118
|
+
swell model pull -m products # pull products model and display in stdout
|
|
119
|
+
swell model pull -m theme.origin.page --content -f models/page.json # pull a content model and save it to a file
|
|
135
120
|
|
|
136
121
|
swell model push -f models/orders.json
|
|
137
|
-
swell model push
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
## Settings
|
|
141
|
-
|
|
142
|
-
Push or pull store settings (e.g. payments, shipping, etc...)
|
|
143
|
-
|
|
144
|
-
```sh
|
|
145
|
-
# pull => retrieves settings from the server and tries to merge and/or write to a specified JSON file or stdout
|
|
146
|
-
swell settings pull SCOPE [--file (-f) String] [--output (-o) Boolean] [--strategy String]
|
|
147
|
-
|
|
148
|
-
# push => send settings from a JSON file or stdin to the server
|
|
149
|
-
swell settings push SCOPE [--file (-f) String] [--input (-i) Boolean] [--strategy String]
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
### Examples
|
|
153
|
-
|
|
154
|
-
```sh
|
|
155
|
-
swell settings pull payments -f settings/payments.json
|
|
156
|
-
swell settings pull payments -f settings/payments.json --strategy ours # keeps our version of the file in case of conflicts
|
|
157
|
-
|
|
158
|
-
swell settings push payments -f settings/payments.json
|
|
159
|
-
swell settings push payments -f settings/payments.json --strategy "set" # overwrites the settings object instead of merging
|
|
122
|
+
swell model push -c -f models/page.json # push a content model
|
|
160
123
|
```
|
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
5
|
-
import
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
8
|
-
import '
|
|
9
|
-
import '
|
|
10
|
-
import '
|
|
11
|
-
import '
|
|
12
|
-
import '
|
|
13
|
-
import 'stream';
|
|
14
|
-
import 'string_decoder';
|
|
15
|
-
import 'buffer';
|
|
16
|
-
import 'events';
|
|
17
|
-
import 'url';
|
|
18
|
-
import 'http';
|
|
19
|
-
import 'https';
|
|
20
|
-
import 'zlib';
|
|
21
|
-
import '
|
|
22
|
-
import '
|
|
23
|
-
import '
|
|
24
|
-
import '
|
|
25
|
-
import 'constants';
|
|
26
|
-
import 'crypto';
|
|
3
|
+
import { F as FormData, a as File } from './swell-cfd63c19.js';
|
|
4
|
+
import 'node:assert';
|
|
5
|
+
import 'node:child_process';
|
|
6
|
+
import 'node:async_hooks';
|
|
7
|
+
import 'node:util';
|
|
8
|
+
import 'node:process';
|
|
9
|
+
import 'node:os';
|
|
10
|
+
import 'node:tty';
|
|
11
|
+
import 'node:fs';
|
|
12
|
+
import 'node:path';
|
|
13
|
+
import 'node:stream';
|
|
14
|
+
import 'node:string_decoder';
|
|
15
|
+
import 'node:buffer';
|
|
16
|
+
import 'node:events';
|
|
17
|
+
import 'node:url';
|
|
18
|
+
import 'node:http';
|
|
19
|
+
import 'node:https';
|
|
20
|
+
import 'node:zlib';
|
|
21
|
+
import 'node:net';
|
|
22
|
+
import 'node:readline';
|
|
23
|
+
import 'node:constants';
|
|
24
|
+
import 'node:crypto';
|
|
27
25
|
|
|
28
26
|
let s = 0;
|
|
29
27
|
const S = {
|