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
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.
@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.
sapi g model src/models/SomeModel
This will create:
src/models/some-model.ts
src/models/some-model.spec.ts
sapi g routable src/api/SomeApi
This will create:
src/api/some-api.ts
src/api/some-api.spec.ts
sapi g service src/services/SomeService
This will create:
src/services/some-service.ts
src/services/some-service.spec.ts
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
.
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.
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.