1.2.3 • Published 2 years ago

@ccci/run v1.2.3

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Micro Server Helper Utilities

Micro Server Helper Utilities is a command-line tool designed to simplify the development process for projects based on the Micro Server framework. This utility streamlines tasks such as creating new projects, adding API endpoints, and generating routes, controllers, and models.


Features

  • Project Initialization: Quickly scaffold a new Micro Server project.
  • API Endpoint Generation: Automatically create routes, controllers, and models for new API endpoints.
  • Seamless Integration: Ensure generated components align with the Micro Server structure.

Installation

  1. Install the utility globally using Bun.js or npm:

    bun add -g @ccci/run
    # or
    npm install -g @ccci/run
  2. Verify the installation (WIP):

    @ccci/run --version

Usage

1. Initialize a New Project

Create a new Micro Server project:

bunx @ccci/run init <project-name>

This will scaffold the directory structure, install dependencies, and set up a basic configuration.

2. Generate an API Endpoint

Add a new API endpoint along with the necessary route, controller, and model:

bunx @ccci/run create api <endpoint-name>

Example:

bunx @ccci/run create api users

This creates:

  • /routes/users.js
  • /controller/UserController.js
  • /models/User.js

3. Generate a Custom Route

Add a standalone route without creating a model or controller:

bunx @ccci/run create route <route-name>

Example:

bunx @ccci/run create route product

This creates:

  • /routes/product.js

4. Generate a Controller

Create a new controller file:

bunx @ccci/run create controller <controller-name>

Example:

bunx @ccci/run create controller order

This creates:

  • /controller/OrderController.js

5. Generate a Model

Create a new Sequelize model:

bunx @ccci/run create model <model-name>

Example:

bunx @ccci/run create model Order

This creates:

  • /models/Order.js

Configuration (WIP)

The tool can be configured using a .microserver-helper.config.js file in the project root. Example configuration:

module.exports = {
  templates: {
    route: './templates/route.js',
    controller: './templates/controller.js',
    model: './templates/model.js',
  },
};

Default Templates

Default templates are used for generating files. Modify these templates to suit your project requirements.


Examples

Initialize a Project

bunx @ccci/run init my-new-project

This creates a new project in the current working directory with the following structure:

my-new-project/
├── /routes
├── /controller
├── /models
├── app.ts
├── package.json

Add a New Endpoint

cd my-new-project
bunx @ccci/run create api task

Creates the necessary files for managing a task API endpoint.


Scripts

  • bunx @ccci/run init: Initialize a new project.
  • bunx @ccci/run create: Generate components (endpoint, route, controller, model).

License

This tool is licensed under the MIT License.


Contributing

Contributions are welcome! Submit a pull request or open an issue to share your ideas or report bugs.

1.2.29

11 months ago

1.2.28

2 years ago

1.2.27

2 years ago

1.2.26

2 years ago

1.2.25

2 years ago

1.2.24

2 years ago

1.2.23

2 years ago

1.2.22

2 years ago

1.2.21

2 years ago

1.2.20

2 years ago

1.2.19

2 years ago

1.2.18

2 years ago

1.2.17

2 years ago

1.2.16

2 years ago

1.2.15

2 years ago

1.2.14

2 years ago

1.2.13

2 years ago

1.2.12

2 years ago

1.2.11

2 years ago

1.2.10

2 years ago

1.2.9

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago