手写一个 koa-ts-cli 脚手架(英文版)
koa-ts-cli
A simple CLI for create koa + ts project: koats create myProject
.
Templates
koats provide three templates that are all based on ts.
-
This is a basic of koa project structure, integrated with ts. If you want to custom the structure of the project, this template is for you.
For more details, please see https://github.com/SimpleCodeCX/koa-ts-base-template
-
This is a full project structure, integrated with ts.This project has been configured with a mysql database, support different environment(dev,prod,testing) configuration, some custom koa middleware have configured, and it has been the definition of a unified api response format.
For more details, please see https://github.com/SimpleCodeCX/koa-ts-full-template
-
This is a full-stack project structure based on koa-ts-full-template.
It contains three parts:
- client: This directory is the front-end code.
- server: This directory is the back-end code.
common: This directory is the common code for front-end and back-end.
For more details, please see https://github.com/SimpleCodeCX/koa-ts-full-stack-server
This three template has the following three common features.
✓ koa v2
✓ Jest
✓ APIDOC
✓ Docker
✓ Eslint
✓ Husky
Installation
1 | npm i -g koa-ts-cli |
Create Project
1 | koats create myProject |
In Development Mode
1 | cd myProject |
NOTE: If you choose koa-ts-full-template or koa-ts-full-stack-template, you need to do some configuration.
In Porduction Mode
1 | npm run build |
NOTE: If you choose koa-ts-full-template or koa-ts-full-stack-template, you need to do some configuration.
Run In Docker
1 | cd myProject |
Test
1 | cd myProject |
本文作者 : Simple
原文链接 : https://simplecodecx.github.io/blog/20191113/9d06116e.html
版权声明 : 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明出处!