手写一个 koa-ts-cli 脚手架(英文版)

发布 : 2019-11-13 分类 : nodejs 浏览 :

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 three template has the following three common features.

✓ koa v2

✓ Typescript

✓ Jest

✓ APIDOC

✓ Docker

✓ Eslint

✓ Husky

Installation

1
npm i -g koa-ts-cli

Create Project

1
2
3
4
5
koats create myProject
# Choose your favorite template.

cd myProject
npm install

In Development Mode

1
2
cd myProject
npm run dev

NOTE: If you choose koa-ts-full-template or koa-ts-full-stack-template, you need to do some configuration.

In Porduction Mode

1
2
3
npm run build
cd myProject/dist
npm run prod

NOTE: If you choose koa-ts-full-template or koa-ts-full-stack-template, you need to do some configuration.

Run In Docker

1
2
3
4
5
cd myProject
npm install
npm run build
sudo docker build -t koa-ts-api-server .
sudo docker run -it --name koa-ts-api-server -p 8080:8080 koa-ts-api-server

Test

1
2
cd myProject
npm run test
本文作者 : Simple
原文链接 : https://simplecodecx.github.io/blog/20191113/9d06116e.html
版权声明 : 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明出处!
留下足迹