0.1.7 • Published 8 months ago

@franshiro/express-cli v0.1.7

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

@franshiro/express-cli

A powerful CLI tool for generating Express.js templates and managing modules with best practices and modern architecture.

Features

  • šŸš€ Quick project setup with Express.js
  • šŸ“¦ Modern project structure
  • šŸ”§ Built-in configuration templates
  • šŸ› ļø Easy to use CLI interface
  • šŸ“ Interactive project generation
  • šŸ“ Module generation for existing projects

Installation

npm install -g @franshiro/express-cli

Usage

After installation, run the CLI:

express-template-2

You'll be presented with the following options:

  1. Create a new project
  2. Add new module to an existing project
  3. Cancel

Creating a New Project

When you choose "Create a new project", you'll be prompted to:

  • Enter the project name (e.g., project-name)

The CLI will create a new Express.js project with the specified name.

Adding a New Module

When you choose "Add new module to an existing project", you'll be prompted to:

  • Enter the module name (e.g., UserPayment)

After entering the module name, you'll have several options:

  1. Create Custom File

    • Choose whether to create a custom function file
    • If yes, a custom function file will be created with example methods
  2. Generate New Model

    • Choose whether to generate a new model
    • If yes, you'll be prompted to:
      • Add columns in the format: name:string or price:decimal(15,2)
      • Supported column types: string, integer, float, boolean, date, text, json, decimal
      • Continue adding columns until you're done
    • The CLI will automatically:
      • Create a migration file
      • Create a model file
      • Add the model to the database models import
      • Add API routes with CRUD operations and middleware
  3. Just Create Files

    • If you choose not to generate a model, the CLI will create:
      • Service module file
      • Controller module file
      • Router module file

After module creation, you'll need to:

  1. Review and modify the generated migration and model files if needed
  2. Run migrations: npm run db:migrate

Project Structure

The generated project will include:

project-name/
ā”œā”€ā”€ src/
│   ā”œā”€ā”€ _utils/
│   ā”œā”€ā”€ customFunctions/
│   ā”œā”€ā”€ database/
│   ā”œā”€ā”€ helpers/
│   ā”œā”€ā”€ middlewares/
│   ā”œā”€ā”€ validations/
│   ā”œā”€ā”€ .babelrc
│   ā”œā”€ā”€ index.js
ā”œā”€ā”€ .env.example
ā”œā”€ā”€ .gitignore
ā”œā”€ā”€ .sequelizerc
ā”œā”€ā”€ package.json
└── README.md

Dependencies

  • Node.js 14.x or higher
  • npm 6.x or higher

Development

# Clone the repository
git clone https://github.com/yourusername/express-cli.git

# Install dependencies
npm install

# Run tests
npm test

License

ISC Ā© franshiromedia

0.1.7

8 months ago

0.1.6

8 months ago

0.1.5

8 months ago

0.1.4

8 months ago

0.1.3

8 months ago

0.1.2

8 months ago

0.1.1

8 months ago

0.1.0

8 months ago

0.0.9

8 months ago

0.0.8

8 months ago

0.0.7

8 months ago

0.0.6

8 months ago

0.0.5

8 months ago

0.0.4

8 months ago

0.0.3

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago