@remkoj/optimizely-cms-cli
Advanced tools
+17
-11
| { | ||
| "name": "@remkoj/optimizely-cms-cli", | ||
| "description": "Optimizely CMS CLI Tools", | ||
| "description": "CLI Utility to work with Optimizely SaaS CMS.", | ||
| "license": "Apache-2.0", | ||
| "author": "Remko Jantzen <693172+remkoj@users.noreply.github.com>", | ||
| "keywords": [ | ||
| "Optimizely CMS", | ||
| "Optimizely", | ||
| "CMS", | ||
| "CLI" | ||
| ], | ||
| "type": "module", | ||
| "version": "6.0.0-pre5", | ||
| "version": "6.0.0-pre6", | ||
| "bin": { | ||
| "opti-cms": "./dist/index.js" | ||
| "opti-cms": "./dist/index.js", | ||
| "optimizely-cms-cli": "./dist/index.js" | ||
| }, | ||
@@ -20,18 +29,15 @@ "files": [ | ||
| "devDependencies": { | ||
| "@remkoj/optimizely-cms-api": "6.0.0-pre5", | ||
| "@remkoj/optimizely-cms-api": "6.0.0-pre6", | ||
| "@rollup/plugin-json": "^6.1.0", | ||
| "@rollup/plugin-typescript": "^12.1.4", | ||
| "@types/node": "^22.16.2", | ||
| "@types/node": "^22.16.4", | ||
| "@types/yargs": "^17.0.33", | ||
| "rollup": "^4.44.2", | ||
| "rollup": "^4.45.0", | ||
| "tslib": "^2.8.1", | ||
| "typescript": "^5.8.3" | ||
| }, | ||
| "peerDependencies": { | ||
| "@types/node": "*" | ||
| }, | ||
| "dependencies": { | ||
| "@fastify/deepmerge": "^3.1.0", | ||
| "@inquirer/prompts": "^7.6.0", | ||
| "@remkoj/optimizely-cms-api": "^6.0.0-pre5", | ||
| "@remkoj/optimizely-cms-api": "^6.0.0-pre6", | ||
| "ajv": "^8.17.1", | ||
@@ -41,3 +47,3 @@ "ajv-formats": "^3.0.1", | ||
| "cli-table3": "^0.6.5", | ||
| "dotenv": "^17.1.0", | ||
| "dotenv": "^17.2.0", | ||
| "dotenv-expand": "^12.0.2", | ||
@@ -44,0 +50,0 @@ "fast-deep-equal": "^3.1.3", |
+56
-6
@@ -6,3 +6,5 @@ # Optimizely CMS Command Line Toolkit <!-- omit in toc --> | ||
| - [1. Installing](#1-installing) | ||
| - [1. Installing / using](#1-installing--using) | ||
| - [1.1. Installing as development dependency](#11-installing-as-development-dependency) | ||
| - [1.2. Usage through direct execution](#12-usage-through-direct-execution) | ||
| - [2. General usage and parameters](#2-general-usage-and-parameters) | ||
@@ -12,6 +14,17 @@ - [2.1. Global parameters](#21-global-parameters) | ||
| - [3. Available commands](#3-available-commands) | ||
| - [3.1. Generate React Component Factory](#31-generate-react-component-factory) | ||
| - [3.1. General CMS Commands](#31-general-cms-commands) | ||
| - [3.2. JSON Schema's and Schema Validation](#32-json-schemas-and-schema-validation) | ||
| - [3.3. Display Templates (Styles)](#33-display-templates-styles) | ||
| - [3.4. Content Types](#34-content-types) | ||
| - [3.5. Next.JS Project support](#35-nextjs-project-support) | ||
| - [4. Detailed command descriptions](#4-detailed-command-descriptions) | ||
| - [4.1. Generate React Component Factory](#41-generate-react-component-factory) | ||
| ## 1. Installing | ||
| ## 1. Installing / using | ||
| This package has been tested through `npx`, `yarn dlx` as well as development dependency within a Yarn managed project. Though there *should not* be a any dependency on Yarn as package manager for your project it has not been verified. | ||
| The usage examples through this readme are assuming the package has been installed as development dependency in a Yarn managed project, you must adjust these based upon your project. | ||
| ### 1.1. Installing as development dependency | ||
| This package has been designed to work in a Yarn PnP / Zero-install environment, it may or may not work with other package managers. | ||
@@ -22,2 +35,19 @@ ```bash | ||
| ### 1.2. Usage through direct execution | ||
| Instead of using the `yarn opti-cms` as shown in the examples, which is available as short-hand after installation as development dependency, you may use one of these as well. | ||
| ```bash | ||
| # Execution through NPX, latest version | ||
| npx @remkoj/optimizely-cms-cli | ||
| # Execution through Yarn DLX, latest version | ||
| yarn dlx @remkoj/optimizely-cms-cli | ||
| # Execution through NPX, explicit version 5.1.1 | ||
| npx @remkoj/optimizely-cms-cli@5.1.1 | ||
| # Execution through Yarn DLX, explicit version 5.1.1 | ||
| yarn dlx @remkoj/optimizely-cms-cli@5.1.1 | ||
| ``` | ||
| ## 2. General usage and parameters | ||
@@ -50,2 +80,3 @@ | ||
| ### 3.1. General CMS Commands | ||
| | Command | Description | | ||
@@ -55,11 +86,30 @@ | --- | --- | | ||
| |`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. | | ||
| ### 3.2. JSON Schema's and Schema Validation | ||
| | Command | Description | | ||
| | --- | --- | | ||
| | `schema:download` | Download schema definitions into a `.schema` folder within your project to facilitate JSON Schema validation by your IDE of choice. Use one or more `-s [schemaName]` parameters to override the schemas that must be downloaded. The `-d [relativePath]` to change where the location where the schema files must be stored. Using `-f` enables overwriting of existing schema files. | | ||
| | `schema:list` | Display a list of all schema's available within the Optimizely CMS instance. | ||
| | `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. | | ||
| | `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. | | ||
| | `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. | | ||
| ### 3.3. Display Templates (Styles) | ||
| | Command | Description | | ||
| | --- | --- | | ||
| | `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. | | ||
| ### 3.4. Content Types | ||
| | Command | Description | | ||
| | --- | --- | | ||
| |`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. | | ||
| |`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. | | ||
| | `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) | | ||
| ### 3.5. Next.JS Project support | ||
| | Command | Description | | ||
| | --- | --- | | ||
| | `nextjs:factory` | Generate the component factories needed for suggested implementation pattern of Optimizely CMS in Next.JS. See [4.1. Generate React Component Factory](#41-generate-react-component-factory) | | ||
| | `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. | | ||
| ### 3.1. Generate React Component Factory | ||
| ## 4. Detailed command descriptions | ||
| ### 4.1. Generate React Component Factory | ||
| 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. | ||
@@ -66,0 +116,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No License Found
LicenseLicense information could not be found.
Found 1 instance in 1 package
246848
5.48%14
-6.67%0
-100%2374
4.21%1
-50%126
65.79%+ Added
- Removed
- Removed
- Removed
Updated