@remkoj/optimizely-cms-cli 5.2.0 → 5.3.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 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
- - [3.1. Generate React Component Factory](#31-generate-react-component-factory)
16
- - [3.2. Check build and CMS Versions](#32-check-build-and-cms-versions)
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, you can always run `opti-cms --help` or `opti-cms [command] --help` to see all information for the CLI utility or command. If the command is omitted, the CLI will assume the `cms:version` command.
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
- |`cms:version`| Fetch the version of the CMS from the endpoint. See [3.2. Check build and CMS Versions](#32-check-build-and-cms-versions) |
55
- |`cms:reset` | Reset the CMS instance by removing all Content, Content Types and Display Templates.<br/>***Note:*** This currently requires some manual steps, the CLI will provide the needed guidance on these manual steps. |
56
- |`types:pull`| Read all existing content types from the Optimizely CMS and create their representation within the codebase. Use the parameters of this method to control which types will be pulled and to allow overwriting of existing files. |
57
- |`types:push`| Create or overwrite the content type defintions from the codebase into Optimizely CMS, use the parameters of this method to control which types will be transferred and whether destructive changes are allowed. |
58
- | `nextjs:factory` | Generate the component factories needed for suggested implementation pattern of Optimizely CMS in Next.JS. See [3.1. Generate React Component Factory](#31-generate-react-component-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
- ### 3.1. Generate React Component Factory
61
- This is a companion method to the ComponentFactory / DefaultComponentFactory implementation within [@remkoj/optimizely-cms-react](https://www.npmjs.com/package/@remkoj/optimizely-cms-react) that is used to resolve content types within Optimizely CMS into React Components. This method will create the needed files to easily construct the factory from the components in the frontend.
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
- #### Usage & example<!-- omit in toc -->
64
- Command: `nextjs:factory`
65
- ```Bash
66
- yarn opti-cms nextjs:factory -f
91
+ <a id="cmd-cms-version"></a>
92
+ ### `cms:version`
93
+ ```bash
94
+ yarn opti-cms cms:version
67
95
  ```
68
96
 
69
- #### Command line parameters<!-- omit in toc -->
70
- | Parameter | Alias | Usage | Default |
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
- | --excludeTypes | --ect | Key of content type to exclude. Can be used multiple times to exclude a list of content types | [] |
73
- | --excludeBaseTypes | --ebt | Exclude all content types, with one of these base types. If provided it will replace the default. Add multiple times to build a list | ["folder","media","image","video"] |
74
- | --baseTypes | -b | Select only content types with one of these base types. Add multiple times to build a list | [] |
75
- | --types | -t | Select content types with this key. Add multiple times to build a list | [] |
76
- | --all | -a | Include non-supported base types, non supported base types are skipped by default | |
77
- | --force | -f | By default, this method is none-destructive. Set this parameter to overwrite existing files. | |
78
-
79
- ### 3.2. Check build and CMS Versions
80
- Connect to the Optimizely CMS Service to fetch service health and version information.
81
-
82
- #### Usage & example<!-- omit in toc -->
83
- Command: `cms:version`
84
- ```Bash
85
- yarn opti-cms cms:version
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` |