@ydmnypg/cli
v0.4.7
Published
Code generator and project scaffolding tool for the ydmnypg framework
Downloads
352
Readme
@ydmnypg/cli
Code generator and project scaffolding tool for the YS framework.
Installation
npm install -g @ydmnypg/cliOr as a project dependency:
npm install --save-dev @ydmnypg/cliUsage
ys-cli <command> <subcommand>Commands
API Project
# Scaffold a new API project
ys-cli api project
# Generate a service (controller + service file)
ys-cli api service
# Generate a model with MyBatis mapper
ys-cli api model
# Generate CRUD handler files
ys-cli api crud
# Generate a single handler file
ys-cli api handlerAdmin Project
# Scaffold a new Admin project
ys-cli admin project
# Generate a service
ys-cli admin service
# Generate a model
ys-cli admin model
# Generate CRUD handler files
ys-cli admin crudGenerated Structure
api project
Creates a complete API project structure:
project/
├── bin/
│ └── worker.js
├── data/
│ ├── config/
│ │ ├── config.js
│ │ └── conf.d/
│ │ ├── config.local.json
│ │ ├── config.dev.json
│ │ ├── config.staging.json
│ │ └── config.production.json
│ └── constants/
│ └── error.js
├── env/
│ ├── nodemon.local.json
│ ├── nodemon.dev.json
│ ├── nodemon.staging.json
│ └── nodemon.prod.json
├── public/
│ └── swagger/
└── package.jsonapi service
Generates a service with controllers and optional model:
services/<name>/
├── <Name>Service.js
├── api/
│ ├── <Name>Controller.js
│ └── handlers/
├── admin/
│ ├── Admin<Name>Controller.js
│ └── handlers/
└── models/ # if model creation is selected
├── <Name>Model.js
└── mappers/
└── <name>.xmlapi crud
Generates handler files for all CRUD operations:
handlers/
├── <model>.create.js
├── <model>.delete.js
├── <model>.get.js
├── <model>.list.js
└── <model>.update.jsInteractive Prompts
All commands run interactively with guided prompts:
$ ys-cli api project
? Domain: domain.com
? Port: 9000
? Username: john
? Target: api
? Project Prefix Name: myappRunning with npm scripts
Add to your package.json:
{
"scripts": {
"generate": "ys-cli"
}
}Then run:
npm run generate -- api serviceRequirements
- Node.js >= 18.0.0
License
MIT
