Skip to content

Commit 5305250

Browse files
committed
[add] Releasing configuration of Model Type package
[optimize] merge Validator & Entity of models [optimize] update Upstream packages & Read Me document
1 parent 6af802f commit 5305250

File tree

15 files changed

+616
-486
lines changed

15 files changed

+616
-486
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
ReadMe.md
22
node_modules/
33
dist/
4+
type/
45
.data/
56
start.sh
67
.husky/

.github/workflows/publish-type.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: publish Type Package
2+
on:
3+
push:
4+
tags:
5+
- type-v*
6+
jobs:
7+
Build-and-Publish:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
packages: write
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- uses: pnpm/action-setup@v2
16+
with:
17+
version: 8
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: 18
21+
registry-url: https://npm.pkg.github.com
22+
cache: pnpm
23+
- name: Install, Build & Publish
24+
run: |
25+
cd type/
26+
pnpm i
27+
npm publish
28+
env:
29+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
node_modules/
22
package-lock.json
33
dist/
4+
type/*.d.ts
45
.env
56
.data/
67
.vscode/settings.json

ReadMe.md

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,53 +15,100 @@
1515
5. API document: [Swagger][11]
1616
6. Mock API: [OpenAPI backend][12]
1717

18+
## API Usage
19+
20+
- Entry: http://localhost:8080/
21+
- Document: http://localhost:8080/docs/
22+
- Schema: http://localhost:8080/docs/spec/
23+
24+
### Type package
25+
26+
#### Sign in GitHub packages with NPM
27+
28+
1. Generate a [PAT][13] with `read:packages` authorization
29+
2. Run Sign-in command in your terminal:
30+
31+
```shell
32+
npm login --scope=@your-org --registry=https://npm.pkg.github.com
33+
```
34+
35+
#### Installation
36+
37+
```shell
38+
npm i pnpm -g
39+
40+
pnpm i @your-org/rest-node-ts
41+
```
42+
1843
## Environment variables
1944

2045
| Name | Usage |
2146
| :------------: | :--------------------------: |
2247
| `APP_SECRET` | encrypt Password & Token |
2348
| `DATABASE_URL` | PostgreSQL connection string |
2449

25-
## Usage
50+
## Development
2651

27-
### Development
28-
29-
Execute a command:
52+
### Installation
3053

3154
```shell
3255
npm i pnpm -g
56+
pnpm i
57+
```
58+
59+
### Start Development environment
60+
61+
```shell
3362
pnpm dev
3463
```
3564

36-
or just press <kbd>F5</kbd> key in [VS Code][13].
65+
or just press <kbd>F5</kbd> key in [VS Code][14].
3766

38-
#### Migration
67+
### Migration
3968

4069
```shell
4170
pnpm upgrade:dev
4271
```
4372

44-
### Deployment
73+
## Deployment
4574

46-
Execute a command:
75+
### Start Production environment
4776

4877
```shell
4978
npm start
5079
```
5180

52-
#### Migration
81+
### Migration
5382

5483
```shell
5584
pnpm upgrade:pro
5685
```
5786

58-
#### Docker
87+
### Docker
5988

6089
```shell
6190
pnpm pack-image
6291
pnpm container
6392
```
6493

94+
## Releasing
95+
96+
### Deploy Application
97+
98+
```shell
99+
git checkout master
100+
git tag v0.6.0 # this version tag comes from ./package.json
101+
git push origin master --tags
102+
```
103+
104+
### Publish Type Package
105+
106+
```shell
107+
git checkout master
108+
git tag type-v0.6.0 # this version tag comes from ./type/package.json
109+
git push origin master --tags
110+
```
111+
65112
[1]: https://en.wikipedia.org/wiki/Representational_state_transfer
66113
[2]: https://nodejs.org/
67114
[3]: https://www.typescriptlang.org/
@@ -74,4 +121,5 @@ pnpm container
74121
[10]: https://typeorm.io/
75122
[11]: https://swagger.io/
76123
[12]: https://github.com/anttiviljami/openapi-backend
77-
[13]: https://code.visualstudio.com/
124+
[13]: https://github.com/settings/tokens
125+
[14]: https://code.visualstudio.com/

package.json

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@idea2app/rest-node-ts",
3-
"version": "0.5.0",
3+
"version": "0.6.0",
44
"license": "LGPL-3.0",
55
"author": "shiy2008@gmail.com",
66
"description": "RESTful API service scaffold based on Node.js & TypeScript",
@@ -15,7 +15,7 @@
1515
"source": "source/index.ts",
1616
"main": "dist/index.js",
1717
"engines": {
18-
"node": ">=16"
18+
"node": ">=18"
1919
},
2020
"dependencies": {
2121
"@koa/cors": "^4.0.0",
@@ -25,38 +25,39 @@
2525
"class-validator": "^0.14.0",
2626
"cross-env": "^7.0.3",
2727
"dotenv": "^16.3.1",
28-
"jsonwebtoken": "^9.0.1",
28+
"jsonwebtoken": "^9.0.2",
2929
"koa": "^2.14.2",
3030
"koa-bodyparser": "^4.4.1",
3131
"koa-jwt": "^4.0.4",
3232
"koa-logger": "^3.2.1",
3333
"koa-mount": "^4.0.0",
34+
"koa2-swagger-ui": "^5.9.0",
3435
"koagger": "^0.3.0",
35-
"mobx-restful": "^0.6.5",
36-
"pg": "^8.11.2",
36+
"mobx-restful": "^0.6.11",
37+
"pg": "^8.11.3",
3738
"pg-connection-string": "^2.6.2",
3839
"reflect-metadata": "^0.1.13",
3940
"routing-controllers": "^0.10.4",
4041
"routing-controllers-openapi": "^4.0.0",
41-
"tslib": "^2.6.1",
42+
"tslib": "^2.6.2",
4243
"typeorm": "^0.3.17",
43-
"web-utility": "^4.1.0"
44+
"web-utility": "^4.1.3"
4445
},
4546
"devDependencies": {
46-
"@types/jsonwebtoken": "^9.0.2",
47-
"@types/koa": "^2.13.8",
48-
"@types/koa-logger": "^3.1.2",
49-
"@types/node": "^18.17.5",
50-
"@typescript-eslint/eslint-plugin": "^6.3.0",
51-
"@typescript-eslint/parser": "^6.3.0",
52-
"eslint": "^8.47.0",
47+
"@types/jsonwebtoken": "^9.0.3",
48+
"@types/koa": "^2.13.9",
49+
"@types/koa-logger": "^3.1.3",
50+
"@types/node": "^18.17.17",
51+
"@typescript-eslint/eslint-plugin": "^6.7.0",
52+
"@typescript-eslint/parser": "^6.7.0",
53+
"eslint": "^8.49.0",
5354
"eslint-plugin-simple-import-sort": "^10.0.0",
5455
"husky": "^8.0.3",
55-
"lint-staged": "^13.3.0",
56+
"lint-staged": "^14.0.1",
5657
"prettier": "^3.0.1",
5758
"sqlite3": "^5.1.6",
5859
"ts-node-dev": "^2.0.0",
59-
"typescript": "~5.1.6"
60+
"typescript": "~5.2.2"
6061
},
6162
"prettier": {
6263
"singleQuote": true,
@@ -71,7 +72,7 @@
7172
"prepare": "husky install",
7273
"dev": "ts-node-dev source/",
7374
"test": "lint-staged",
74-
"build": "rm -rf dist/ && tsc",
75+
"build": "rm -rf dist/ type/*.d.ts && tsc && mv dist/model/*.d.ts type/",
7576
"start": "cross-env NODE_ENV=production node dist/",
7677
"typeorm": "typeorm-ts-node-commonjs -d source/model/index.ts",
7778
"migration:generate": "npm run typeorm -- migration:generate",

0 commit comments

Comments
 (0)