@remkoj/optimizely-cms-cli 5.2.0 → 5.3.1
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 +232 -32
- package/dist/index.js +325 -124
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -12,8 +12,21 @@ The defaults and methods are based upon using a Next.JS application with the con
|
|
|
12
12
|
- [2.1. Global parameters](#21-global-parameters)
|
|
13
13
|
- [2.2. Environment variables](#22-environment-variables)
|
|
14
14
|
- [3. Available commands](#3-available-commands)
|
|
15
|
-
- [
|
|
16
|
-
- [
|
|
15
|
+
- [`cms:reset`](#cmsreset)
|
|
16
|
+
- [`cms:version`](#cmsversion)
|
|
17
|
+
- [`nextjs:components`](#nextjscomponents)
|
|
18
|
+
- [`nextjs:create`](#nextjscreate)
|
|
19
|
+
- [`nextjs:factory`](#nextjsfactory)
|
|
20
|
+
- [`nextjs:fragments`](#nextjsfragments)
|
|
21
|
+
- [`nextjs:queries`](#nextjsqueries)
|
|
22
|
+
- [`nextjs:visualbuilder`](#nextjsvisualbuilder)
|
|
23
|
+
- [`style:create`](#stylecreate)
|
|
24
|
+
- [`styles:delete`](#stylesdelete)
|
|
25
|
+
- [`styles:list`](#styleslist)
|
|
26
|
+
- [`styles:pull`](#stylespull)
|
|
27
|
+
- [`styles:push`](#stylespush)
|
|
28
|
+
- [`types:pull`](#typespull)
|
|
29
|
+
- [`types:push`](#typespush)
|
|
17
30
|
|
|
18
31
|
|
|
19
32
|
## 1. Installing
|
|
@@ -47,40 +60,227 @@ All commands share these parameters that configure the frontend environment.
|
|
|
47
60
|
This CLI tool shares the environment variables with [@remkoj/optimizely-cms-api](https://www.npmjs.com/package/@remkoj/optimizely-cms-api). When starting the CLI tool, it looks for `.env` and `.env.local` to extend the environment variables and thus works using the Next.JS conventions.
|
|
48
61
|
|
|
49
62
|
## 3. Available commands
|
|
50
|
-
The following commands are available
|
|
63
|
+
The following commands are available. You can run `opti-cms --help` or `opti-cms [command] --help` to view all options. If the command is omitted, the CLI defaults to `cms:version`.
|
|
51
64
|
|
|
52
|
-
| Command | Description |
|
|
53
|
-
| --- | --- |
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
| `nextjs:factory` |
|
|
65
|
+
| Command | Description | Usage |
|
|
66
|
+
| --- | --- | --- |
|
|
67
|
+
| `cms:reset` | Completely clear & reset the CMS Database | [See usage](#cmd-cms-reset) |
|
|
68
|
+
| `cms:version` | Get the CMS Version information | [See usage](#cmd-cms-version) |
|
|
69
|
+
| `nextjs:components` | Create the React Components for a Next.JS / Optimizely Graph structure | [See usage](#cmd-nextjs-components) |
|
|
70
|
+
| `nextjs:create` | Scaffold a complete Next.JS / Optimizely Graph structure | [See usage](#cmd-nextjs-create) |
|
|
71
|
+
| `nextjs:factory` | Create the ComponentFactory for a Next.JS / Optimizely Graph structure | [See usage](#cmd-nextjs-factory) |
|
|
72
|
+
| `nextjs:fragments` | Create the GrapQL Fragments for a Next.JS / Optimizely Graph structure | [See usage](#cmd-nextjs-fragments) |
|
|
73
|
+
| `nextjs:queries` | Create the GrapQL Queries to use two queries to load content | [See usage](#cmd-nextjs-queries) |
|
|
74
|
+
| `nextjs:visualbuilder` | Create the React Components for Visual Builder in a Next.JS / Optimizely Graph structure | [See usage](#cmd-nextjs-visualbuilder) |
|
|
75
|
+
| `style:create` | Create a new style definition | [See usage](#cmd-style-create) |
|
|
76
|
+
| `styles:delete` | Remove Visual Builder style definitions from the CMS | [See usage](#cmd-styles-delete) |
|
|
77
|
+
| `styles:list` | List Visual Builder style definitions from the CMS | [See usage](#cmd-styles-list) |
|
|
78
|
+
| `styles:pull` | Create Visual Builder style definitions from the CMS | [See usage](#cmd-styles-pull) |
|
|
79
|
+
| `styles:push` | Push Visual Builder style definitions into the CMS (create/patch) | [See usage](#cmd-styles-push) |
|
|
80
|
+
| `types:pull` | Pull content type definition files into the project | [See usage](#cmd-types-pull) |
|
|
81
|
+
| `types:push` | Push content type definition into Optimizely CMS (create / replace) | [See usage](#cmd-types-push) |
|
|
59
82
|
|
|
60
|
-
|
|
61
|
-
|
|
83
|
+
<a id="cmd-cms-reset"></a>
|
|
84
|
+
### `cms:reset`
|
|
85
|
+
```bash
|
|
86
|
+
yarn opti-cms cms:reset
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Command-specific parameters: none. This command only uses [global parameters](#21-global-parameters).
|
|
62
90
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```
|
|
66
|
-
yarn opti-cms
|
|
91
|
+
<a id="cmd-cms-version"></a>
|
|
92
|
+
### `cms:version`
|
|
93
|
+
```bash
|
|
94
|
+
yarn opti-cms cms:version
|
|
67
95
|
```
|
|
68
96
|
|
|
69
|
-
|
|
70
|
-
|
|
97
|
+
Command-specific parameters: none. This command only uses [global parameters](#21-global-parameters).
|
|
98
|
+
|
|
99
|
+
<a id="cmd-nextjs-components"></a>
|
|
100
|
+
### `nextjs:components`
|
|
101
|
+
```bash
|
|
102
|
+
yarn opti-cms nextjs:components
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
| Parameter | Alias | Usage | Example |
|
|
71
106
|
| --- | --- | --- | --- |
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
107
|
+
| `--excludeTypes` | `--ect` | Exclude specific content type keys | `yarn opti-cms nextjs:components --excludeTypes StartPage --excludeTypes LandingPage` |
|
|
108
|
+
| `--excludeBaseTypes` | `--ebt` | Exclude specific base types | `yarn opti-cms nextjs:components --excludeBaseTypes media` |
|
|
109
|
+
| `--baseTypes` | `-b` | Include only the selected base types | `yarn opti-cms nextjs:components -b page -b section` |
|
|
110
|
+
| `--types` | `-t` | Include only the selected content type keys | `yarn opti-cms nextjs:components -t StartPage` |
|
|
111
|
+
| `--all` | `-a` | Include non-supported base types | `yarn opti-cms nextjs:components -a` |
|
|
112
|
+
| `--force` | `-f` | Overwrite existing generated files | `yarn opti-cms nextjs:components -f` |
|
|
113
|
+
|
|
114
|
+
<a id="cmd-nextjs-create"></a>
|
|
115
|
+
### `nextjs:create`
|
|
116
|
+
```bash
|
|
117
|
+
yarn opti-cms nextjs:create
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
| Parameter | Alias | Usage | Example |
|
|
121
|
+
| --- | --- | --- | --- |
|
|
122
|
+
| `--excludeTypes` | `--ect` | Exclude specific content type keys | `yarn opti-cms nextjs:create --excludeTypes StartPage` |
|
|
123
|
+
| `--excludeBaseTypes` | `--ebt` | Exclude specific base types | `yarn opti-cms nextjs:create --excludeBaseTypes media` |
|
|
124
|
+
| `--baseTypes` | `-b` | Include only the selected base types | `yarn opti-cms nextjs:create -b page -b experience` |
|
|
125
|
+
| `--types` | `-t` | Include only the selected content type keys | `yarn opti-cms nextjs:create -t StartPage` |
|
|
126
|
+
| `--all` | `-a` | Include non-supported base types | `yarn opti-cms nextjs:create -a` |
|
|
127
|
+
| `--force` | `-f` | Overwrite existing generated files | `yarn opti-cms nextjs:create -f` |
|
|
128
|
+
|
|
129
|
+
<a id="cmd-nextjs-factory"></a>
|
|
130
|
+
### `nextjs:factory`
|
|
131
|
+
```bash
|
|
132
|
+
yarn opti-cms nextjs:factory
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
| Parameter | Alias | Usage | Example |
|
|
136
|
+
| --- | --- | --- | --- |
|
|
137
|
+
| `--excludeTypes` | `--ect` | Exclude specific content type keys | `yarn opti-cms nextjs:factory --excludeTypes StartPage` |
|
|
138
|
+
| `--excludeBaseTypes` | `--ebt` | Exclude specific base types | `yarn opti-cms nextjs:factory --excludeBaseTypes media` |
|
|
139
|
+
| `--baseTypes` | `-b` | Include only the selected base types | `yarn opti-cms nextjs:factory -b page` |
|
|
140
|
+
| `--types` | `-t` | Include only the selected content type keys | `yarn opti-cms nextjs:factory -t StartPage` |
|
|
141
|
+
| `--all` | `-a` | Include non-supported base types | `yarn opti-cms nextjs:factory -a` |
|
|
142
|
+
| `--force` | `-f` | Overwrite existing generated files | `yarn opti-cms nextjs:factory -f` |
|
|
143
|
+
|
|
144
|
+
<a id="cmd-nextjs-fragments"></a>
|
|
145
|
+
### `nextjs:fragments`
|
|
146
|
+
```bash
|
|
147
|
+
yarn opti-cms nextjs:fragments
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
| Parameter | Alias | Usage | Example |
|
|
151
|
+
| --- | --- | --- | --- |
|
|
152
|
+
| `--excludeTypes` | `--ect` | Exclude specific content type keys | `yarn opti-cms nextjs:fragments --excludeTypes StartPage` |
|
|
153
|
+
| `--excludeBaseTypes` | `--ebt` | Exclude specific base types | `yarn opti-cms nextjs:fragments --excludeBaseTypes media` |
|
|
154
|
+
| `--baseTypes` | `-b` | Include only the selected base types | `yarn opti-cms nextjs:fragments -b page -b section` |
|
|
155
|
+
| `--types` | `-t` | Include only the selected content type keys | `yarn opti-cms nextjs:fragments -t StartPage` |
|
|
156
|
+
| `--all` | `-a` | Include non-supported base types | `yarn opti-cms nextjs:fragments -a` |
|
|
157
|
+
| `--force` | `-f` | Overwrite existing generated files | `yarn opti-cms nextjs:fragments -f` |
|
|
158
|
+
|
|
159
|
+
<a id="cmd-nextjs-queries"></a>
|
|
160
|
+
### `nextjs:queries`
|
|
161
|
+
```bash
|
|
162
|
+
yarn opti-cms nextjs:queries
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
| Parameter | Alias | Usage | Example |
|
|
166
|
+
| --- | --- | --- | --- |
|
|
167
|
+
| `--excludeTypes` | `--ect` | Exclude specific content type keys | `yarn opti-cms nextjs:queries --excludeTypes StartPage` |
|
|
168
|
+
| `--excludeBaseTypes` | `--ebt` | Exclude specific base types | `yarn opti-cms nextjs:queries --excludeBaseTypes media` |
|
|
169
|
+
| `--baseTypes` | `-b` | Include only selected base types (defaults to `page` and `experience`) | `yarn opti-cms nextjs:queries -b page` |
|
|
170
|
+
| `--types` | `-t` | Include only the selected content type keys | `yarn opti-cms nextjs:queries -t StartPage` |
|
|
171
|
+
| `--all` | `-a` | Include non-supported base types | `yarn opti-cms nextjs:queries -a` |
|
|
172
|
+
| `--force` | `-f` | Overwrite existing generated files | `yarn opti-cms nextjs:queries -f` |
|
|
173
|
+
|
|
174
|
+
<a id="cmd-nextjs-visualbuilder"></a>
|
|
175
|
+
### `nextjs:visualbuilder`
|
|
176
|
+
```bash
|
|
177
|
+
yarn opti-cms nextjs:visualbuilder
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
| Parameter | Alias | Usage | Example |
|
|
181
|
+
| --- | --- | --- | --- |
|
|
182
|
+
| `--excludeTypes` | `--ect` | Exclude specific content type keys | `yarn opti-cms nextjs:visualbuilder --excludeTypes StartPage` |
|
|
183
|
+
| `--excludeBaseTypes` | `--ebt` | Exclude specific base types | `yarn opti-cms nextjs:visualbuilder --excludeBaseTypes media` |
|
|
184
|
+
| `--baseTypes` | `-b` | Include only the selected base types | `yarn opti-cms nextjs:visualbuilder -b section` |
|
|
185
|
+
| `--types` | `-t` | Include only the selected content type keys | `yarn opti-cms nextjs:visualbuilder -t StandardPage` |
|
|
186
|
+
| `--all` | `-a` | Include non-supported base types | `yarn opti-cms nextjs:visualbuilder -a` |
|
|
187
|
+
| `--force` | `-f` | Overwrite existing generated files | `yarn opti-cms nextjs:visualbuilder -f` |
|
|
188
|
+
|
|
189
|
+
<a id="cmd-style-create"></a>
|
|
190
|
+
### `style:create`
|
|
191
|
+
```bash
|
|
192
|
+
yarn opti-cms style:create
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Command-specific parameters: none. This command is interactive and prompts for all required values.
|
|
196
|
+
|
|
197
|
+
<a id="cmd-styles-delete"></a>
|
|
198
|
+
### `styles:delete`
|
|
199
|
+
```bash
|
|
200
|
+
yarn opti-cms styles:delete
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
| Parameter | Alias | Usage | Example |
|
|
204
|
+
| --- | --- | --- | --- |
|
|
205
|
+
| `--excludeTypes` | `--ect` | Exclude content types when resolving style targets | `yarn opti-cms styles:delete --excludeTypes StartPage` |
|
|
206
|
+
| `--excludeBaseTypes` | `--ebt` | Exclude base types when resolving style targets | `yarn opti-cms styles:delete --excludeBaseTypes media` |
|
|
207
|
+
| `--baseTypes` | `-b` | Include only styles targeting selected base types | `yarn opti-cms styles:delete -b section` |
|
|
208
|
+
| `--types` | `-t` | Include only styles targeting selected content types | `yarn opti-cms styles:delete -t StartPage` |
|
|
209
|
+
| `--all` | `-a` | Include non-supported base types | `yarn opti-cms styles:delete -a` |
|
|
210
|
+
| `--excludeNodeTypes` | `--ent` | Exclude specific node types | `yarn opti-cms styles:delete --excludeNodeTypes row` |
|
|
211
|
+
| `--excludeTemplates` | `--et` | Exclude specific style template keys | `yarn opti-cms styles:delete --excludeTemplates hero` |
|
|
212
|
+
| `--nodes` | `-n` | Include only selected node types | `yarn opti-cms styles:delete -n row` |
|
|
213
|
+
| `--templates` | `-d` | Include only selected style template keys | `yarn opti-cms styles:delete -d hero -d article` |
|
|
214
|
+
| `--templateTypes` | `--tt` | Include only selected style target types (`node`, `base`, `component`) | `yarn opti-cms styles:delete --tt node --tt base` |
|
|
215
|
+
| `--force` | `-f` | Actually perform delete; without this the command shows a dry preview | `yarn opti-cms styles:delete -f` |
|
|
216
|
+
| `--withStyleFile` | `-w` | Also delete local `.opti-style.json` files | `yarn opti-cms styles:delete -f -w` |
|
|
217
|
+
| `--definitions` | `-u` | Update/delete generated TypeScript display template helpers | `yarn opti-cms styles:delete -f -u` |
|
|
218
|
+
|
|
219
|
+
<a id="cmd-styles-list"></a>
|
|
220
|
+
### `styles:list`
|
|
221
|
+
```bash
|
|
222
|
+
yarn opti-cms styles:list
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Command-specific parameters: none. This command only uses [global parameters](#21-global-parameters).
|
|
226
|
+
|
|
227
|
+
<a id="cmd-styles-pull"></a>
|
|
228
|
+
### `styles:pull`
|
|
229
|
+
```bash
|
|
230
|
+
yarn opti-cms styles:pull
|
|
86
231
|
```
|
|
232
|
+
|
|
233
|
+
| Parameter | Alias | Usage | Example |
|
|
234
|
+
| --- | --- | --- | --- |
|
|
235
|
+
| `--excludeTypes` | `--ect` | Exclude content types when resolving style targets | `yarn opti-cms styles:pull --excludeTypes StartPage` |
|
|
236
|
+
| `--excludeBaseTypes` | `--ebt` | Exclude base types when resolving style targets | `yarn opti-cms styles:pull --excludeBaseTypes media` |
|
|
237
|
+
| `--baseTypes` | `-b` | Include only styles targeting selected base types | `yarn opti-cms styles:pull -b section -b element` |
|
|
238
|
+
| `--types` | `-t` | Include only styles targeting selected content types | `yarn opti-cms styles:pull -t StartPage` |
|
|
239
|
+
| `--all` | `-a` | Include non-supported base types | `yarn opti-cms styles:pull -a` |
|
|
240
|
+
| `--excludeNodeTypes` | `--ent` | Exclude specific node types | `yarn opti-cms styles:pull --excludeNodeTypes row` |
|
|
241
|
+
| `--excludeTemplates` | `--et` | Exclude specific style template keys | `yarn opti-cms styles:pull --excludeTemplates hero` |
|
|
242
|
+
| `--nodes` | `-n` | Include only selected node types | `yarn opti-cms styles:pull -n row` |
|
|
243
|
+
| `--templates` | `-d` | Include only selected style template keys | `yarn opti-cms styles:pull -d hero -d article` |
|
|
244
|
+
| `--templateTypes` | `--tt` | Include only selected style target types (`node`, `base`, `component`) | `yarn opti-cms styles:pull --tt component` |
|
|
245
|
+
| `--force` | `-f` | Overwrite existing generated files | `yarn opti-cms styles:pull -f` |
|
|
246
|
+
| `--definitions` | `-u` | Create or update generated TypeScript definitions | `yarn opti-cms styles:pull -u` |
|
|
247
|
+
|
|
248
|
+
<a id="cmd-styles-push"></a>
|
|
249
|
+
### `styles:push`
|
|
250
|
+
```bash
|
|
251
|
+
yarn opti-cms styles:push
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
| Parameter | Alias | Usage | Example |
|
|
255
|
+
| --- | --- | --- | --- |
|
|
256
|
+
| `--excludeTemplates` | `-e` | Exclude style template keys from push | `yarn opti-cms styles:push -e hero` |
|
|
257
|
+
| `--templates` | `-t` | Push only selected style template keys | `yarn opti-cms styles:push -t hero -t article` |
|
|
258
|
+
|
|
259
|
+
<a id="cmd-types-pull"></a>
|
|
260
|
+
### `types:pull`
|
|
261
|
+
```bash
|
|
262
|
+
yarn opti-cms types:pull
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
| Parameter | Alias | Usage | Example |
|
|
266
|
+
| --- | --- | --- | --- |
|
|
267
|
+
| `--excludeTypes` | `--ect` | Exclude specific content type keys | `yarn opti-cms types:pull --excludeTypes StartPage` |
|
|
268
|
+
| `--excludeBaseTypes` | `--ebt` | Exclude specific base types | `yarn opti-cms types:pull --excludeBaseTypes media` |
|
|
269
|
+
| `--baseTypes` | `-b` | Include only selected base types | `yarn opti-cms types:pull -b page -b section` |
|
|
270
|
+
| `--types` | `-t` | Include only selected content type keys | `yarn opti-cms types:pull -t StartPage` |
|
|
271
|
+
| `--all` | `-a` | Include non-supported base types | `yarn opti-cms types:pull -a` |
|
|
272
|
+
| `--force` | `-f` | Overwrite existing generated files | `yarn opti-cms types:pull -f` |
|
|
273
|
+
|
|
274
|
+
<a id="cmd-types-push"></a>
|
|
275
|
+
### `types:push`
|
|
276
|
+
```bash
|
|
277
|
+
yarn opti-cms types:push
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
| Parameter | Alias | Usage | Example |
|
|
281
|
+
| --- | --- | --- | --- |
|
|
282
|
+
| `--force` | `-f` | Force overwrite/replace while pushing to CMS | `yarn opti-cms types:push -f` |
|
|
283
|
+
| `--excludeTypes` | `--ect` | Exclude specific content type keys from push | `yarn opti-cms types:push --excludeTypes StartPage` |
|
|
284
|
+
| `--excludeBaseTypes` | `--ebt` | Exclude content type base types from push | `yarn opti-cms types:push --excludeBaseTypes media` |
|
|
285
|
+
| `--baseTypes` | `-b` | Push only content types with selected base types | `yarn opti-cms types:push -b page` |
|
|
286
|
+
| `--types` | `-t` | Push only selected content type keys | `yarn opti-cms types:push -t StartPage -t ArticlePage` |
|