@uniformdev/csk-cli
v6.1.57
Published
Command-line interface (CLI) tool designed to streamline the development workflow within Uniform projects. It provides commands for pulling additional data and generating components based on Canvas data
Keywords
Readme
@uniformdev/csk-cli
@uniformdev/csk-cli is a command-line interface (CLI) tool designed to streamline the development workflow within Uniform projects. It provides commands for pulling additional data and generating components based on Canvas data.
Installation
You can install the package as a dependency in your project:
npm install @uniformdev/csk-cli --save-devCommands
pull Command
The pull command retrieves additional data for the project. Currently, it supports pulling locales, with potential future expansions.
Usage
Add the following script to your package.json:
"scripts": {
"pull:locales": "csk-cli pull -l"
}Run the command using:
npm run pull:localesOptions
-l, --locales– Pulls locales configuration.
Environment Variables
Before running the command, configure the following environment variables:
UNIFORM_API_KEY– Your Uniform API key.UNIFORM_PROJECT_ID– The ID of your Uniform project.
These can be set in a .env file or provided directly in the CLI environment.
Optional Configuration
To specify a custom folder for generated components, set the CUSTOM_CANVAS_FOLDER_PATH environment variable:
LOCALES_PATH=src/i18nscaffold Command
The scaffold command generates React components based on Canvas data, making it easier to integrate new components into a Uniform project.
Features
- Component Generation: Automatically generates React components with necessary imports, types, and properties.
- Component Registration: Registers components in the Custom Canvas resolver.
- Custom Folder Support: Allows specifying a custom folder for generated components.
Usage
Add the following script to your package.json:
"scripts": {
"scaffold:add": "csk-cli scaffold"
}Run the command using:
npm run scaffold:addEnvironment Variables
Before running the command, configure the following environment variables:
UNIFORM_API_KEY– Your Uniform API key.UNIFORM_PROJECT_ID– The ID of your Uniform project.
These can be set in a .env file or provided directly in the CLI environment.
Optional Configuration
To specify a custom folder for generated components, set the CUSTOM_CANVAS_FOLDER_PATH environment variable:
CUSTOM_CANVAS_FOLDER_PATH=src/components/custom-canvasGenerated Code
The package generates a React component and integrates it into the Canvas resolver by updating the component mappings.
Workflow
- Set Environment Variables: Ensure
UNIFORM_API_KEYandUNIFORM_PROJECT_IDare set. - Run the Command: Use
npm run scaffold:addas configured in your project.
