clean-nestjs-cli v1.1.0
Description
A command-line interface tool designed to streamline the creation and management of Nest projects following Clean Architecture principles.
Installation
npm install -g clean-nestjs-cli
Or
yarn global add clean-nestjs-cli
Or
pnpm add -g clean-nestjs-cli
Global Options
-v, --version
: Outputs the current version of the CLI.
Example:
clean-nest -v
-h, --help
: Displays help with all available commands and their options.
Example:
clean-nest -h
Usage
After installation, you can access the CLI using the clean-nest
or cnest
command.
cnest <command> [options]
Available Commands
new <project-name> [options]
Creates a new project with a clean and structured setup.
Alias: n
cnest new my-new-project
Options:
--no-linters
: Disables linters (enabled by default).Example:
cnest new my-new-project --no-linters
generate <schematics> <module> [resource] [options]
Generates a new element in your project, such as modules or resources.
Alias: g
cnest generate module user
Available schematics: module|mo, repository|rp, use-case|uc
Options:
--path <path>
: Specifies the destination directory inside the/src/modules
folder. The default path is the module root (/
).Example:
cnest generate module user --path auth
--no-spec
: Do not generate a spec filesExample:
cnest generate use-case user find-all --no-spec
Folder Structure
When using the new
command, a Nest project with the following clean structure will be created:
my-new-project/
├──src/
│ ├── modules/
│ │ ├── module-example/
│ │ │ ├── models/
│ │ │ │ ├── dtos/
│ │ │ │ ├── entities/
│ │ │ │ ├── interfaces/
│ │ │ │ ├── enums/
│ │ │ ├── repositories/
│ │ │ ├── use-cases/
│ │ │ │ ├── use-case-example-1/
│ │ │ │ └── use-case-example-2/
│ ├── app.module.ts
│ ├── main.ts
│ ├── shared/
│ │ ├── databases/
└── ...
Contribution
Contributions are welcome! Feel free to open issues and pull requests on the official repository.
Author
Jheison Novak
License
Copyright © 2024, Jheison Novak. Released under the MIT License.