sakuraapi / cli

Command Line Interface for Scaffolding and Managing SakuraAPI Projects
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link
cli javascript nodejs sakuraapi typescript

Installing

SakuraAPI CLI helps you scaffold new projects.

NOTE: sapi is currently behind sakuraapi/core by many versions. This unfortunately renders it useless. Apologies for the inconvenience. We are accepting volunteers if anyone would like to take over the maintenance of the sapi cli :).

npm install -g @sakuraapi/cli

sapi --help

Scaffolding a SakuraAPI project

sapi init [dir] where dir is the path to the directory in which you want to initialize the project.

You can also run sapi init within a directory and it will initialize the project there.

You can also run sapi init over an existing project and it will give you the option to diff changes file by file.

sapi init supports setting up the server without authentication, as a JWT issuer and as a JWT audience server.

Generating Models, Routables and Services

@Model, @Routable and @Injectable files can be scaffolded individually to save you the hassle of setting them up.

The example below assume you are in the root of your project's directory.

Currently, generated output still needs to be manually injected when you instantiate SakuraApi. Don't forget or it won't work.

Models

sapi g model src/models/SomeModel

This will create:

Routables

sapi g routable src/api/SomeApi

This will create:

Services (Injectables)

sapi g service src/services/SomeService

This will create:

Updating outdated dependencies

Managing the never ending process of updating your package.json dependencies can be tedious. sapi outdated will take you through your list of outdated dependencies, giving you the option for each dependency to either skip it, update it to the wanted version, or updated it to the latest version. After each update, sapi runs your unit-tests to make sure that particular update did not break your build. It also properly saves the new version in either dependencies or devDependencies in your package.json file. It's still a tedious process... but hopefully a little less so.

To get help with other options for outdated, use sapi outdated --help.

Some Caution

sapi cli is pretty early in its development. Make sure you have a backup of your files before you use it to update an existing project.

Bugs and requests:

Please report bugs and reports here: https://github.com/sakuraapi/cli/issues

You can get debug output. For example: DEBUG=sapi:* sapi --help. Replace --help with whatever sapi command you want. This might help you report more accurate bugs... it might not.

Contribution

CLA assistant