core-cli
is a command-line tool designed to accelerate the creation of web development projects by simplifying the generation of project structures for both backend and frontend. This tool allows developers to quickly generate CRUD models for backend applications and create various pages and structures for frontend projects, including support for light and dark themes.
To install core-cli
globally on your system, run the following command:
npm install -g corep-cli
This command allows you to access core-cli
from anywhere in your terminal.
core-cli
uses a .core-config
file to manage project settings automatically. This file can be created by running:
core-cli --init
Or using the shorthand:
core-cli -i
{
"nameProject": "my-backend-project",
"version": "1.0.0",
"platform": "backend",
"connectionConfig": "unit-connection"
}
{
"nameProject": "my-frontend-project",
"version": "1.0.0",
"platform": "frontend"
}
-
nameProject
: The name of the project used in various operations. -
version
: The current version of the project. -
platform
: Defines whether the project is forbackend
orfrontend
. -
connectionConfig
: For backend projects, this field determines the database connection type. It can beglobal-connection
orunit-connection
.
If the .core-config
file is present in the project root, core-cli
will automatically use the settings specified within it. For example, when running the command:
core-cli --create crud-v4 --directory src/core --name product
If the --platform
option is not provided, core-cli
will default to the platform specified in the .core-config
file. However, if the --platform
option is passed, it will override the value in the .core-config
.
core-cli
can be invoked using the following aliases: core
, core-cli
, or cr
. Below are the available options and how to use them:
-
Platform [--platform | -p]: Specify the target platform for your project. Accepted values include:
-
Backend:
backend
,back
,b
-
Frontend:
frontend
,front
,f
-
Backend:
-
Template [--create | -c]: This is a required option that specifies the type of template you want to create. Accepted values include:
- For backend:
-
crud-v4
: Generates a complete CRUD model with functionalities to create, update, delete, export to Excel, and pagination. Routes are automatically configured in the API.
-
- For frontend:
-
page
: Creates a basic page structure following the project conventions. -
single-forms
: Creates pages for managing single forms. -
page-v4-tool
: An enhanced implementation including a modern layout, full CRUD support, and a theme selector (light and dark).
-
- For backend:
-
Directory [--directory | -d]: Specify the target directory for the template copy. If a
--name
is not provided, the last segment of the directory path will be used as the name. -
Name [--name | -n]: Define the name for the copied template. If no directory is specified, a new folder with this name will be created in the current working directory to store the files.
-
Creating a backend CRUD with a specific name:
core -c crud-v4 -n brand
-
Specifying a directory for the template:
cr --create crud-v4 -d src/core/category
-
Full configuration, specifying platform, template, directory, and name:
core-cli --platform backend --create crud-v4 --directory src/core --name product
- If a target directory already exists with the same name,
core-cli
will display an error and stop execution. - When templates are successfully generated, the tool displays a list of created files along with success messages.
- The tool also checks for the existence of a “base” directory. If not found, an error message is shown.
This project is licensed under the “Commons Clause”. For more details, refer to the LICENSE.md
file in the project repository.