corep-cli
v0.2.3
Published
A versatile command-line tool designed to streamline the creation of web development projects by generating structured templates for backend and frontend. Supports dynamic CRUD generation, page structures, and theme customization.
Downloads
1,486
Readme
core-cli
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.
Installation
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.
Configuring .core-config
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
Example .core-config
for Backend Projects
{
"nameProject": "my-backend-project",
"version": "1.0.0",
"platform": "backend",
"connectionConfig": "unit-connection"
}
Example .core-config
for Frontend Projects
{
"nameProject": "my-frontend-project",
"version": "1.0.0",
"platform": "frontend"
}
Key Fields in .core-config
:
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
.
How .core-config
Works:
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
.
Usage
Command Structure
core-cli
can be invoked using the following aliases: core
, core-cli
, or cr
. Below are the available options and how to use them:
Options Overview
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.
Examples
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
Error Handling & Messages
- 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.
License
This project is licensed under the “Commons Clause”. For more details, refer to the LICENSE.md
file in the project repository.