@remkoj/optimizely-cms-cli 6.0.0-pre3 → 6.0.0-pre5
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 +6 -12
- package/dist/index.js +586 -138
- package/dist/index.js.map +1 -1
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -9,7 +9,6 @@ The defaults and methods are based upon using a Next.JS application with the con
|
|
|
9
9
|
- [2.2. Environment variables](#22-environment-variables)
|
|
10
10
|
- [3. Available commands](#3-available-commands)
|
|
11
11
|
- [3.1. Generate React Component Factory](#31-generate-react-component-factory)
|
|
12
|
-
- [3.2. Check build and CMS Versions](#32-check-build-and-cms-versions)
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
## 1. Installing
|
|
@@ -47,11 +46,15 @@ The following commands are available, you can always run `opti-cms --help` or `o
|
|
|
47
46
|
|
|
48
47
|
| Command | Description |
|
|
49
48
|
| --- | --- |
|
|
50
|
-
|`cms:version`| Fetch the version of the CMS from the endpoint
|
|
49
|
+
|`cms:version`| Fetch and display the version of the CMS from the endpoint, allowing validation of the connection with Optimizely CMS. |
|
|
51
50
|
|`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. |
|
|
51
|
+
| `schema:vscode` | Updates the `.vscode` folder to include the JSON Schema for both Content Type defintions and Display Templates. This will also create or update the `settings.json` to enable code-completion and validation on `*.opti-style.json` and `*.opti-type.json` files, using these schema's. Rerun this command to ensure that the definitions remain in sync with the OpenAPI specification of the CMS API. |
|
|
52
|
+
| `schema:validate` | Downloads the OpenAPI Specification from the configured Optimizely CMS instance, extracts the appropriate types from it and uses those to validate all `*.opti-style.json` and `*.opti-type.json` files in the project. The output provides detailled error messages for each file that is not valid. |
|
|
53
|
+
| `style:create` | Create a new Style definition file *(and optionally create it immediately within the CMS as well)* using a CLI interface, that will guide you through the process of setting the required properties.<br/>***Visual Studio Code users:*** Running `yarn opti-cms schema:vscode` will enable VS-Code to provide validation and completion for the generated `*.opti-style.json` file. |
|
|
52
54
|
|`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. |
|
|
53
55
|
|`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. |
|
|
54
56
|
| `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) |
|
|
57
|
+
| `nextjs:create` | An conveniance command, that will run the appropriate commands from the CLI in the right order to fully scaffold a frontend based upon the Content Types and Display Templates that already exist within the Optimizely CMS instance.<br/>It runs these commands: `types:pull`, `styles:pull`, `nextjs:fragments` `nextjs:components`, `nextjs:visualbuilder` and `nextjs:factory`. The command line arguments you provide to `nextjs:create` will be forwarded to each of these commands. |
|
|
55
58
|
|
|
56
59
|
### 3.1. Generate React Component Factory
|
|
57
60
|
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.
|
|
@@ -70,13 +73,4 @@ yarn opti-cms nextjs:factory -f
|
|
|
70
73
|
| --baseTypes | -b | Select only content types with one of these base types. Add multiple times to build a list | [] |
|
|
71
74
|
| --types | -t | Select content types with this key. Add multiple times to build a list | [] |
|
|
72
75
|
| --all | -a | Include non-supported base types, non supported base types are skipped by default | |
|
|
73
|
-
| --force | -f | By default, this method is none-destructive. Set this parameter to overwrite existing files. | |
|
|
74
|
-
|
|
75
|
-
### 3.2. Check build and CMS Versions
|
|
76
|
-
Connect to the Optimizely CMS Service to fetch service health and version information.
|
|
77
|
-
|
|
78
|
-
#### Usage & example<!-- omit in toc -->
|
|
79
|
-
Command: `cms:version`
|
|
80
|
-
```Bash
|
|
81
|
-
yarn opti-cms cms:version
|
|
82
|
-
```
|
|
76
|
+
| --force | -f | By default, this method is none-destructive. Set this parameter to overwrite existing files. | |
|