1.0.10 • Published 4 months ago

sasti v1.0.10

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

Sasti CLI

Sasti is a templating tool to make Express applications using only the command line.

Installation

Use the package manager npm to install sasti globally.

npm install sasti -g

Setting Environment Variables

After successfully installing the sasti library, it's important to configure your environment variables to enable seamless usage. Follow the steps below based on your operating system.

For macOS: Open your terminal and run the following command to set the environment variable. Replace cli-path with the actual path where you have installed sasti.

export PATH="/<cli-path>:$PATH"

For a global installation, the path typically is:

export PATH="/usr/local/lib/node_modules/sasti:$PATH"

For Windows and Linux users, set the environment variable appropriately using the method suitable for your platform.

Usage

It is a command line tool that you can use using your terminal.

sasti

CLI Options

Some of the parameters you can pass to the cli.

  • --path <path> (Specify the path replace with desired path where you want this app to be created, default is ./)
  • --name <name> (Specify the name of the project/app replace with the app name that you want to create/update, default expressApp)
  • --envs <variable-name>:<variable-value> (Specify the enviornment variable, replace with the name of the variable you want to put in the .env e.g PORT_NAME, DB_URL and to set the value of the enviroment variable replace with the actual value of the enviroment variable e.g 8080, localhost:27017 etc )
  • --port <port> (Specify the port for your app replace with the actual port, default is 8080)
  • --module <module> (Specify module for your app if you want to create a module replace with the name of the module e.g user, customer, admin etc.)
  • --middleware <middleware> (Specify the middleware for your app if you want to create a middleware replace with actual middleware name)
  • --orm <orm> (Specify the orm you want to use in the application, replace with the name of the orm that you want to use.It can only be monogoose or type-orm)
  • --model <model-name>=(<field-name>:<data-type>,<field-name>:<data-type>) (Specify model name for your database model, replace with the name of your model e.g user, customer, admin etc and to specify fields and datatype replace with field name e.g id, name, age and with data type of the field e.g String, Number, Boolen etc )

Examples

Creating a new template (application)

Create a template with default values

sasti

Create a template with properties like port, app name, path and enviroment variable

sasti --port 8080 --name express --path ../ --envs DB_HOST:"localhost",DB_PORT:"27017"

Create a template with module and middleware

sasti --module user --middleware auth

Create a template with database integration, setting up orm and database model

sasti --orm mongoose --model user{id:Number,name:String,isActive:Boolean}

Updating an existing template (application)

Add new modules, middlewares, models and environment variables by using the sasti command with existing application name.

Add new module and middleware to existing application (express).

sasti --name express --module customer --middleware logger

Add new model to existing application (express).

sasti --name express --model customer --model customer={id:Number,name:String,isAdmin:Boolean}

Add new enviroment variables to existing application (express).

sasti --name express --envs DB_USER:admin,DB_PASSWORD:1122

Usage of shortcuts

All the above properties (options) can also be used with shortcuts

  • -p, --path <project path>
  • -n, --name <project name>
  • -md, --module <module name>
  • -mw, --middleware <middleware name>
  • -e, --envs <enviroments variables>
  • -o, --orm <database orm (mongoose or sequelize)>
  • -ml, --model <database model modelName={fieldName:dataType,fieldName:dataType}>

Example

sasti --n express -p 8080 -md user -mw auth -e PORT:8080 -o mongoose -ml user={id:Number}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change Please make sure to update tests as appropriate.

Developer

linkedin