1.0.0-beta.12 • Published 6 years ago

ts-restful-cli v1.0.0-beta.12

Weekly downloads
4
License
MIT
Repository
-
Last release
6 years ago

ts-restful-cli

Installation

First step is to install node js and npm from this webpage.

After installing node js the next step is to install ts-restful-cli executing the next command:

npm install -g ts-restful-cli

Commands

This cli tool allows you to create, compile and run a ts-restful application.

There are 9 main commands that will help you to execute this actions throught the tsr cli command:

CommandDescriptionExample
projectCreates a ts-restful framework project.tsr project
controllerCreates a ts-restful controller.tsr controller ./my-subfolder/my-controller
domainCreates a ts-restful domain validation layer.tsr domain ./my-subfolder/my-domain
repositoryCreates a ts-restful repository layer.tsr repository ./my-subfolder/my-repository
modelCreates a ts-restful database model.tsr model ./my-subfolder/my-model
crudCreates a ts-restful completed CRUD, based on received info.tsr crud ./my-subfolder/user-comments
buildCompiles the application for it execution in non development environments.tsr build
serveRuns the application for it development execution.tsr serve
environmentAdds a environment variable to the environments files.tsr environment myKey myValue

The tsr project command has optional parameters:

ParameterDescriptionExample
--nameSets the name of the package/project.tsr project --name my-project

The tsr project creates a folder structure as this:

.
+-- environments/
    +-- development.json
    +-- production.json
    +-- test.json
+-- node_modules/
+-- src/
    +-- controllers/
        +-- main.controller.ts
        +-- index.ts
    +-- index.ts
+-- .gitignore
+-- .metadata
+-- .tsrestful
+-- tsconfig.json
+-- packacge.json

This could be considered as the project root.

The controller, domain, repository and model commands, will create a file inside controllers, domains, repositories or models folder respectively, with the respective code. None of this commands has option parameters.

The command serve has no optional parameters, just by tsr serve in the root of your project, the cli tool will run a development server with the environment variables placed in environments/development.json and create a dist/development folder with the builder version of the app, by the way, you can manually run the compiled applications that are located at the folder dist.

ParameterDescriptionExample
--just-buildIt builds the application for development, but not turn on server.tsr serve --just-build

The command build will generate a dist/test or dist/production folder depending on what environment you want to build for, this can be choosed throught the optional parameter --prod.

ParameterDescriptionExample
--prodIt builds the application for production environment, using environments/production.json.tsr build --prod and for test build tsr build

Contribute

Send email to justdevelopitmx@gmail.com, I'll like to find people interested in making this tool grow.

MIT License

Copyright (c) 2018 Carlos Gonzalez

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.