@remkoj/optimizely-cms-cli 2.0.4 → 3.0.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
@@ -1,15 +1,79 @@
1
- # Optimizely CMS Command Line Toolkit
1
+ # Optimizely CMS Command Line Toolkit <!-- omit in toc -->
2
2
  A collection of Command Line tools used to increase productivity when working with the Optimizely CMS from a TypeScript / JavaScript based frontend.
3
3
 
4
- ## Installing
4
+ The defaults and methods are based upon using a Next.JS application with the conventions introduced by the [Create Next App template](https://github.com/remkoj/optimizely-saas-starter)
5
5
 
6
- ## General parameters
6
+ - [1. Installing](#1-installing)
7
+ - [2. General usage and parameters](#2-general-usage-and-parameters)
8
+ - [2.1. Global parameters](#21-global-parameters)
9
+ - [2.2. Environment variables](#22-environment-variables)
10
+ - [3. Available commands](#3-available-commands)
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
+
14
+
15
+ ## 1. Installing
16
+ This package has been designed to work in a Yarn PnP / Zero-install environment, it may or may not work with other package managers.
17
+ ```bash
18
+ yarn add --dev @remkoj/optimizely-cms-cli
19
+ ```
20
+
21
+ ## 2. General usage and parameters
22
+
23
+ - **List all commands and global parameters:** `yarn opti-cms --help`
24
+ - **Build version:** `yarn opti-cms --version`
25
+ - **Command specific help and parameters:** `yarn opti-cms [command] --help`
26
+
27
+ ### 2.1. Global parameters
7
28
  All commands share these parameters that configure the frontend environment.
8
29
 
9
- ## Available commands
30
+ | Parameter | Alias | Usage | Default |
31
+ | --- | --- | --- | --- |
32
+ | --version | | Show version number | |
33
+ | --path | -p | The application root folder | The current working directory |
34
+ | --components | -c | The components folder within the application | ./src/components/cms |
35
+ | --cms_url | --cu | The Url of the Optimizely CMS Service | Calculated from the environment variables `OPTIMIZELY_CMS_URL` and `OPTIMIZELY_CMS_SCHEMA`
36
+ | --client_id | --ci | The CMS Service Client ID | Taken from the environment variable `OPTIMIZELY_CMS_CLIENT_ID` |
37
+ | --client_secret | --cs | The CMS Service Client Secret | Taken from the environment variable `OPTIMIZELY_CMS_CLIENT_SECRET` |
38
+ | --user_id | u | The CMS User to impersonate | Taken from the environment variable `OPTIMIZELY_CMS_USER_ID` |
39
+ | --verbose | | Show debugging output | |
40
+ | --help | | Show help text
41
+
42
+ ### 2.2. Environment variables
43
+ 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.
44
+
45
+ ## 3. Available commands
10
46
  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.
11
47
 
12
48
  | Command | Description |
13
49
  | --- | --- |
14
50
  |`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. |
15
51
  |`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. |
52
+
53
+ ### 3.1. Generate React Component Factory
54
+ 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.
55
+
56
+ #### Usage & example<!-- omit in toc -->
57
+ Command: `nextjs:factory`
58
+ ```Bash
59
+ yarn opti-cms nextjs:factory -f
60
+ ```
61
+
62
+ #### Command line parameters<!-- omit in toc -->
63
+ | Parameter | Alias | Usage | Default |
64
+ | --- | --- | --- | --- |
65
+ | --excludeTypes | --ect | Key of content type to exclude. Can be used multiple times to exclude a list of content types | [] |
66
+ | --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"] |
67
+ | --baseTypes | -b | Select only content types with one of these base types. Add multiple times to build a list | [] |
68
+ | --types | -t | Select content types with this key. Add multiple times to build a list | [] |
69
+ | --all | -a | Include non-supported base types, non supported base types are skipped by default | |
70
+ | --force | -f | By default, this method is none-destructive. Set this parameter to overwrite existing files. | |
71
+
72
+ ### 3.2. Check build and CMS Versions
73
+ Connect to the Optimizely CMS Service to fetch service health and version information.
74
+
75
+ #### Usage & example<!-- omit in toc -->
76
+ Command: `cms:version`
77
+ ```Bash
78
+ yarn opti-cms cms:version
79
+ ```