typescript-express-starter 8.1.3 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.kr.md +23 -27
- package/README.md +23 -25
- package/lib/default/Makefile +26 -3
- package/lib/default/package.json +9 -12
- package/lib/graphql/.env.development.local +2 -2
- package/lib/graphql/.env.production.local +2 -2
- package/lib/graphql/.env.test.local +2 -2
- package/lib/graphql/Makefile +26 -3
- package/lib/graphql/package.json +8 -11
- package/lib/graphql/src/app.ts +6 -3
- package/lib/graphql/src/config/index.ts +2 -1
- package/lib/graphql/src/entities/users.entity.ts +1 -1
- package/lib/graphql/src/repositories/auth.repository.ts +1 -1
- package/lib/graphql/src/repositories/users.repository.ts +1 -1
- package/lib/knex/Makefile +26 -3
- package/lib/knex/package.json +23 -26
- package/lib/mikro-orm/.dockerignore +18 -0
- package/lib/mikro-orm/.editorconfig +9 -0
- package/lib/mikro-orm/.env.development.local +18 -0
- package/lib/mikro-orm/.env.production.local +18 -0
- package/lib/mikro-orm/.env.test.local +18 -0
- package/lib/mikro-orm/.eslintignore +1 -0
- package/lib/mikro-orm/.eslintrc +18 -0
- package/lib/mikro-orm/.huskyrc +5 -0
- package/lib/mikro-orm/.lintstagedrc.json +5 -0
- package/lib/mikro-orm/.prettierrc +8 -0
- package/lib/mikro-orm/.swcrc +41 -0
- package/lib/mikro-orm/.vscode/launch.json +35 -0
- package/lib/mikro-orm/.vscode/settings.json +6 -0
- package/lib/mikro-orm/Dockerfile +24 -0
- package/lib/mikro-orm/Makefile +29 -0
- package/lib/mikro-orm/docker-compose.yml +46 -0
- package/lib/mikro-orm/ecosystem.config.js +57 -0
- package/lib/mikro-orm/jest.config.js +12 -0
- package/lib/mikro-orm/nginx.conf +40 -0
- package/lib/mikro-orm/nodemon.json +12 -0
- package/lib/mikro-orm/package.json +77 -0
- package/lib/mikro-orm/src/app.ts +98 -0
- package/lib/mikro-orm/src/config/index.ts +5 -0
- package/lib/mikro-orm/src/controllers/auth.controller.ts +46 -0
- package/lib/mikro-orm/src/controllers/index.controller.ts +13 -0
- package/lib/mikro-orm/src/controllers/users.controller.ts +65 -0
- package/lib/mikro-orm/src/databases/index.ts +19 -0
- package/lib/mikro-orm/src/dtos/users.dto.ts +9 -0
- package/lib/mikro-orm/src/entities/base.entity.ts +16 -0
- package/lib/mikro-orm/src/entities/users.entity.ts +17 -0
- package/lib/mikro-orm/src/exceptions/HttpException.ts +10 -0
- package/lib/mikro-orm/src/http/auth.http +32 -0
- package/lib/mikro-orm/src/http/users.http +34 -0
- package/lib/mikro-orm/src/interfaces/auth.interface.ts +15 -0
- package/lib/mikro-orm/src/interfaces/routes.interface.ts +6 -0
- package/lib/mikro-orm/src/interfaces/users.interface.ts +5 -0
- package/lib/mikro-orm/src/middlewares/auth.middleware.ts +32 -0
- package/lib/mikro-orm/src/middlewares/error.middleware.ts +17 -0
- package/lib/mikro-orm/src/middlewares/validation.middleware.ts +25 -0
- package/lib/mikro-orm/src/routes/auth.route.ts +24 -0
- package/lib/mikro-orm/src/routes/index.route.ts +19 -0
- package/lib/mikro-orm/src/routes/users.route.ts +25 -0
- package/lib/mikro-orm/src/server.ts +11 -0
- package/lib/mikro-orm/src/services/auth.service.ts +63 -0
- package/lib/mikro-orm/src/services/users.service.ts +68 -0
- package/lib/mikro-orm/src/tests/auth.test.ts +66 -0
- package/lib/mikro-orm/src/tests/index.test.ts +18 -0
- package/lib/mikro-orm/src/tests/users.test.ts +70 -0
- package/lib/mikro-orm/src/utils/logger.ts +65 -0
- package/lib/mikro-orm/src/utils/util.ts +19 -0
- package/lib/mikro-orm/src/utils/validateEnv.ts +10 -0
- package/lib/mikro-orm/swagger.yaml +122 -0
- package/lib/mikro-orm/tsconfig.json +41 -0
- package/lib/mongoose/Makefile +26 -3
- package/lib/mongoose/package.json +7 -10
- package/lib/prisma/Makefile +26 -3
- package/lib/prisma/package.json +7 -10
- package/lib/routing-controllers/Makefile +26 -3
- package/lib/routing-controllers/package.json +8 -10
- package/lib/sequelize/Makefile +26 -3
- package/lib/sequelize/package.json +7 -10
- package/lib/starter.js +30 -8
- package/lib/typegoose/Makefile +26 -3
- package/lib/typegoose/package.json +6 -9
- package/lib/typeorm/Makefile +26 -3
- package/lib/typeorm/package.json +6 -9
- package/package.json +6 -15
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
"scripts": {
|
|
8
8
|
"start": "npm run build && cross-env NODE_ENV=production node dist/server.js",
|
|
9
9
|
"dev": "cross-env NODE_ENV=development nodemon",
|
|
10
|
-
"build": "
|
|
11
|
-
"build:
|
|
10
|
+
"build": "swc src -d dist --source-maps --copy-files",
|
|
11
|
+
"build:tsc": "tsc && tsc-alias",
|
|
12
12
|
"test": "jest --forceExit --detectOpenHandles",
|
|
13
13
|
"lint": "eslint --ignore-path .gitignore --ext .ts src/",
|
|
14
14
|
"lint:fix": "npm run lint -- --fix",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"bcrypt": "^5.0.1",
|
|
20
|
-
"class-transformer": "^0.
|
|
20
|
+
"class-transformer": "^0.5.1",
|
|
21
21
|
"class-validator": "^0.13.1",
|
|
22
22
|
"compression": "^1.7.4",
|
|
23
23
|
"cookie-parser": "^1.4.5",
|
|
@@ -43,11 +43,9 @@
|
|
|
43
43
|
"@types/compression": "^1.7.1",
|
|
44
44
|
"@types/cookie-parser": "^1.4.2",
|
|
45
45
|
"@types/cors": "^2.8.11",
|
|
46
|
-
"@types/dotenv": "^8.2.0",
|
|
47
46
|
"@types/express": "^4.17.13",
|
|
48
|
-
"@types/helmet": "^4.0.0",
|
|
49
47
|
"@types/hpp": "^0.2.1",
|
|
50
|
-
"@types/jest": "
|
|
48
|
+
"@types/jest": "27.4.x",
|
|
51
49
|
"@types/jsonwebtoken": "^8.5.4",
|
|
52
50
|
"@types/morgan": "^1.9.3",
|
|
53
51
|
"@types/node": "^16.0.1",
|
|
@@ -55,7 +53,6 @@
|
|
|
55
53
|
"@types/supertest": "^2.0.11",
|
|
56
54
|
"@types/swagger-jsdoc": "^6.0.1",
|
|
57
55
|
"@types/swagger-ui-express": "^4.1.3",
|
|
58
|
-
"@types/winston": "^2.4.4",
|
|
59
56
|
"@typescript-eslint/eslint-plugin": "^4.28.2",
|
|
60
57
|
"@typescript-eslint/parser": "^4.28.2",
|
|
61
58
|
"cross-env": "^7.0.3",
|
|
@@ -63,7 +60,7 @@
|
|
|
63
60
|
"eslint-config-prettier": "^8.3.0",
|
|
64
61
|
"eslint-plugin-prettier": "^3.4.0",
|
|
65
62
|
"husky": "^7.0.1",
|
|
66
|
-
"jest": "
|
|
63
|
+
"jest": "27.4.x",
|
|
67
64
|
"lint-staged": "^11.0.0",
|
|
68
65
|
"node-config": "^0.0.2",
|
|
69
66
|
"node-gyp": "^8.1.0",
|
|
@@ -71,8 +68,8 @@
|
|
|
71
68
|
"pm2": "^5.1.0",
|
|
72
69
|
"prettier": "^2.3.2",
|
|
73
70
|
"sequelize-cli": "^6.2.0",
|
|
74
|
-
"supertest": "^6.
|
|
75
|
-
"ts-jest": "^27.
|
|
71
|
+
"supertest": "^6.2.2",
|
|
72
|
+
"ts-jest": "^27.1.4",
|
|
76
73
|
"ts-node": "^10.4.0",
|
|
77
74
|
"tsc-alias": "^1.4.1",
|
|
78
75
|
"tsconfig-paths": "^3.10.1",
|
package/lib/starter.js
CHANGED
|
@@ -29,7 +29,8 @@ const createProject = async (projectName) => {
|
|
|
29
29
|
|
|
30
30
|
try {
|
|
31
31
|
const template = await chooseTemplates();
|
|
32
|
-
const
|
|
32
|
+
const isUpdated = await dependenciesUpdates();
|
|
33
|
+
const isDeduped = await dependenciesDeduped();
|
|
33
34
|
|
|
34
35
|
console.log("[ 1 / 3 ] 🔍 copying project...");
|
|
35
36
|
console.log("[ 2 / 3 ] 🚚 fetching node_modules...");
|
|
@@ -91,29 +92,50 @@ const chooseTemplates = async () => {
|
|
|
91
92
|
};
|
|
92
93
|
|
|
93
94
|
/**
|
|
94
|
-
* @method
|
|
95
|
-
* @description
|
|
95
|
+
* @method dependenciesUpdates
|
|
96
|
+
* @description npm dependencies updated.
|
|
96
97
|
*/
|
|
97
|
-
const
|
|
98
|
+
const dependenciesUpdates = async () => {
|
|
98
99
|
const { isUpdated } = await inquirer.prompt([
|
|
99
100
|
{
|
|
100
101
|
type: "confirm",
|
|
101
102
|
name: "isUpdated",
|
|
102
103
|
message:
|
|
103
|
-
"
|
|
104
|
+
"Do you want to update all packages in the node_modules directory and dependency ?"
|
|
104
105
|
},
|
|
105
106
|
]);
|
|
106
107
|
|
|
108
|
+
if (isUpdated) {
|
|
109
|
+
const { isUpdatedReconfirm } = await inquirer.prompt([
|
|
110
|
+
{
|
|
111
|
+
type: "confirm",
|
|
112
|
+
name: "isUpdatedReconfirm",
|
|
113
|
+
message:
|
|
114
|
+
"However, updating to the latest version may cause package dependency issues. Do you still want to update ?"
|
|
115
|
+
},
|
|
116
|
+
]);
|
|
117
|
+
|
|
118
|
+
return isUpdatedReconfirm;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return false;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @method dependenciesDeduped
|
|
126
|
+
* @description npm duplicate dependencies removed.
|
|
127
|
+
*/
|
|
128
|
+
const dependenciesDeduped = async () => {
|
|
107
129
|
const { isDeduped } = await inquirer.prompt([
|
|
108
130
|
{
|
|
109
131
|
type: "confirm",
|
|
110
132
|
name: "isDeduped",
|
|
111
|
-
message: "
|
|
133
|
+
message: "Used to removed duplicate packages at npm. Do you want to ?",
|
|
112
134
|
},
|
|
113
135
|
]);
|
|
114
136
|
|
|
115
|
-
return
|
|
116
|
-
}
|
|
137
|
+
return isDeduped;
|
|
138
|
+
}
|
|
117
139
|
|
|
118
140
|
/**
|
|
119
141
|
* @method copyProjectFiles
|
package/lib/typegoose/Makefile
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
|
+
# app name should be overridden.
|
|
2
|
+
# ex) production-stage: make build APP_NAME=<APP_NAME>
|
|
3
|
+
# ex) development-stage: make build-dev APP_NAME=<APP_NAME>
|
|
4
|
+
|
|
5
|
+
APP_NAME = typescript-express
|
|
6
|
+
APP_NAME := $(APP_NAME)
|
|
7
|
+
|
|
8
|
+
.PHONY: build
|
|
9
|
+
# Build the container image - Dvelopment
|
|
10
|
+
build-dev:
|
|
11
|
+
docker build -t ${APP_NAME}\
|
|
12
|
+
--target development-build-stage\
|
|
13
|
+
-f Dockerfile .
|
|
14
|
+
|
|
15
|
+
# Build the container image - Production
|
|
1
16
|
build:
|
|
2
|
-
docker build -t ${
|
|
17
|
+
docker build -t ${APP_NAME}\
|
|
18
|
+
--target production-build-stage\
|
|
19
|
+
-f Dockerfile .
|
|
20
|
+
|
|
21
|
+
# Clean the container image
|
|
3
22
|
clean:
|
|
4
|
-
docker rmi -f ${
|
|
23
|
+
docker rmi -f ${APP_NAME}
|
|
24
|
+
|
|
25
|
+
# Run the container image
|
|
5
26
|
run:
|
|
6
|
-
docker run -d -p
|
|
27
|
+
docker run -d -it -p 3000:3000 ${APP_NAME}
|
|
28
|
+
|
|
29
|
+
all: build
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
"scripts": {
|
|
8
8
|
"start": "npm run build && cross-env NODE_ENV=production node dist/server.js",
|
|
9
9
|
"dev": "cross-env NODE_ENV=development nodemon",
|
|
10
|
-
"build": "
|
|
11
|
-
"build:
|
|
10
|
+
"build": "swc src -d dist --source-maps --copy-files",
|
|
11
|
+
"build:tsc": "tsc && tsc-alias",
|
|
12
12
|
"test": "jest --forceExit --detectOpenHandles",
|
|
13
13
|
"lint": "eslint --ignore-path .gitignore --ext .ts src/",
|
|
14
14
|
"lint:fix": "npm run lint -- --fix",
|
|
@@ -43,11 +43,9 @@
|
|
|
43
43
|
"@types/compression": "^1.7.1",
|
|
44
44
|
"@types/cookie-parser": "^1.4.2",
|
|
45
45
|
"@types/cors": "^2.8.11",
|
|
46
|
-
"@types/dotenv": "^8.2.0",
|
|
47
46
|
"@types/express": "^4.17.13",
|
|
48
|
-
"@types/helmet": "^4.0.0",
|
|
49
47
|
"@types/hpp": "^0.2.1",
|
|
50
|
-
"@types/jest": "
|
|
48
|
+
"@types/jest": "27.4.x",
|
|
51
49
|
"@types/jsonwebtoken": "^8.5.4",
|
|
52
50
|
"@types/mongoose": "^5.10.1",
|
|
53
51
|
"@types/morgan": "^1.9.3",
|
|
@@ -55,7 +53,6 @@
|
|
|
55
53
|
"@types/supertest": "^2.0.11",
|
|
56
54
|
"@types/swagger-jsdoc": "^6.0.1",
|
|
57
55
|
"@types/swagger-ui-express": "^4.1.3",
|
|
58
|
-
"@types/winston": "^2.4.4",
|
|
59
56
|
"@typescript-eslint/eslint-plugin": "^4.28.2",
|
|
60
57
|
"@typescript-eslint/parser": "^4.28.2",
|
|
61
58
|
"cross-env": "^7.0.3",
|
|
@@ -63,15 +60,15 @@
|
|
|
63
60
|
"eslint-config-prettier": "^8.3.0",
|
|
64
61
|
"eslint-plugin-prettier": "^3.4.0",
|
|
65
62
|
"husky": "^7.0.1",
|
|
66
|
-
"jest": "
|
|
63
|
+
"jest": "27.4.x",
|
|
67
64
|
"lint-staged": "^11.0.0",
|
|
68
65
|
"node-config": "^0.0.2",
|
|
69
66
|
"node-gyp": "^8.1.0",
|
|
70
67
|
"nodemon": "^2.0.9",
|
|
71
68
|
"pm2": "^5.1.0",
|
|
72
69
|
"prettier": "^2.3.2",
|
|
73
|
-
"supertest": "^6.
|
|
74
|
-
"ts-jest": "^27.
|
|
70
|
+
"supertest": "^6.2.2",
|
|
71
|
+
"ts-jest": "^27.1.4",
|
|
75
72
|
"ts-node": "^10.4.0",
|
|
76
73
|
"tsc-alias": "^1.4.1",
|
|
77
74
|
"tsconfig-paths": "^3.10.1",
|
package/lib/typeorm/Makefile
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
|
+
# app name should be overridden.
|
|
2
|
+
# ex) production-stage: make build APP_NAME=<APP_NAME>
|
|
3
|
+
# ex) development-stage: make build-dev APP_NAME=<APP_NAME>
|
|
4
|
+
|
|
5
|
+
APP_NAME = typescript-express
|
|
6
|
+
APP_NAME := $(APP_NAME)
|
|
7
|
+
|
|
8
|
+
.PHONY: build
|
|
9
|
+
# Build the container image - Dvelopment
|
|
10
|
+
build-dev:
|
|
11
|
+
docker build -t ${APP_NAME}\
|
|
12
|
+
--target development-build-stage\
|
|
13
|
+
-f Dockerfile .
|
|
14
|
+
|
|
15
|
+
# Build the container image - Production
|
|
1
16
|
build:
|
|
2
|
-
docker build -t ${
|
|
17
|
+
docker build -t ${APP_NAME}\
|
|
18
|
+
--target production-build-stage\
|
|
19
|
+
-f Dockerfile .
|
|
20
|
+
|
|
21
|
+
# Clean the container image
|
|
3
22
|
clean:
|
|
4
|
-
docker rmi -f ${
|
|
23
|
+
docker rmi -f ${APP_NAME}
|
|
24
|
+
|
|
25
|
+
# Run the container image
|
|
5
26
|
run:
|
|
6
|
-
docker run -d -p
|
|
27
|
+
docker run -d -it -p 3000:3000 ${APP_NAME}
|
|
28
|
+
|
|
29
|
+
all: build
|
package/lib/typeorm/package.json
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
"scripts": {
|
|
8
8
|
"start": "npm run build && cross-env NODE_ENV=production node dist/server.js",
|
|
9
9
|
"dev": "cross-env NODE_ENV=development nodemon",
|
|
10
|
-
"build": "
|
|
11
|
-
"build:
|
|
10
|
+
"build": "swc src -d dist --source-maps --copy-files",
|
|
11
|
+
"build:tsc": "tsc && tsc-alias",
|
|
12
12
|
"test": "jest --forceExit --detectOpenHandles",
|
|
13
13
|
"lint": "eslint --ignore-path .gitignore --ext .ts src/",
|
|
14
14
|
"lint:fix": "npm run lint -- --fix",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"bcrypt": "^5.0.1",
|
|
20
|
-
"class-transformer": "^0.
|
|
20
|
+
"class-transformer": "^0.5.1",
|
|
21
21
|
"class-validator": "^0.13.1",
|
|
22
22
|
"compression": "^1.7.4",
|
|
23
23
|
"cookie-parser": "^1.4.5",
|
|
@@ -44,18 +44,15 @@
|
|
|
44
44
|
"@types/compression": "^1.7.1",
|
|
45
45
|
"@types/cookie-parser": "^1.4.2",
|
|
46
46
|
"@types/cors": "^2.8.11",
|
|
47
|
-
"@types/dotenv": "^8.2.0",
|
|
48
47
|
"@types/express": "^4.17.13",
|
|
49
|
-
"@types/helmet": "^4.0.0",
|
|
50
48
|
"@types/hpp": "^0.2.1",
|
|
51
|
-
"@types/jest": "
|
|
49
|
+
"@types/jest": "27.4.x",
|
|
52
50
|
"@types/jsonwebtoken": "^8.5.4",
|
|
53
51
|
"@types/morgan": "^1.9.3",
|
|
54
52
|
"@types/node": "^16.0.1",
|
|
55
53
|
"@types/supertest": "^2.0.11",
|
|
56
54
|
"@types/swagger-jsdoc": "^6.0.1",
|
|
57
55
|
"@types/swagger-ui-express": "^4.1.3",
|
|
58
|
-
"@types/winston": "^2.4.4",
|
|
59
56
|
"@typescript-eslint/eslint-plugin": "^4.28.2",
|
|
60
57
|
"@typescript-eslint/parser": "^4.28.2",
|
|
61
58
|
"cross-env": "^7.0.3",
|
|
@@ -70,8 +67,8 @@
|
|
|
70
67
|
"nodemon": "^2.0.9",
|
|
71
68
|
"pm2": "^5.1.0",
|
|
72
69
|
"prettier": "^2.3.2",
|
|
73
|
-
"supertest": "^6.
|
|
74
|
-
"ts-jest": "^27.
|
|
70
|
+
"supertest": "^6.2.2",
|
|
71
|
+
"ts-jest": "^27.1.4",
|
|
75
72
|
"ts-node": "^10.4.0",
|
|
76
73
|
"tsc-alias": "^1.4.1",
|
|
77
74
|
"tsconfig-paths": "^3.10.1",
|
package/package.json
CHANGED
|
@@ -1,40 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typescript-express-starter",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.1.0",
|
|
4
4
|
"description": "Quick and Easy TypeScript Express Starter",
|
|
5
5
|
"author": "AGUMON <ljlm0402@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"typescript",
|
|
9
9
|
"express",
|
|
10
|
-
"routing-controllers",
|
|
11
|
-
"routing-controllers-openapi",
|
|
12
10
|
"sequelize",
|
|
13
11
|
"mongoose",
|
|
14
|
-
"typegoose",
|
|
15
12
|
"typeorm",
|
|
16
13
|
"knex",
|
|
17
14
|
"prisma",
|
|
18
15
|
"graphql",
|
|
19
|
-
"
|
|
16
|
+
"typegoose",
|
|
17
|
+
"mikro-orm",
|
|
18
|
+
"routing-controllers",
|
|
19
|
+
"logger",
|
|
20
|
+
"swagger",
|
|
20
21
|
"jest",
|
|
21
22
|
"nodemon",
|
|
22
|
-
"jsonwebtoken",
|
|
23
|
-
"bcrypt",
|
|
24
|
-
"logs",
|
|
25
|
-
"winston",
|
|
26
|
-
"swagger",
|
|
27
23
|
"pm2",
|
|
28
24
|
"eslint",
|
|
29
25
|
"prettier",
|
|
30
26
|
"docker",
|
|
31
27
|
"docker-compose",
|
|
32
28
|
"nginx",
|
|
33
|
-
"huskyrc",
|
|
34
|
-
"mysql",
|
|
35
|
-
"mariadb",
|
|
36
|
-
"mongodb",
|
|
37
|
-
"postgresql",
|
|
38
29
|
"swc"
|
|
39
30
|
],
|
|
40
31
|
"main": "bin/cli.js",
|