typescript-express-starter 8.1.3 โ 8.1.7
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 +19 -22
- package/README.md +19 -22
- package/lib/default/Makefile +26 -3
- package/lib/default/package.json +2 -2
- 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 +2 -2
- 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 +2 -2
- package/lib/mongoose/Makefile +26 -3
- package/lib/mongoose/package.json +2 -2
- package/lib/prisma/Makefile +26 -3
- package/lib/prisma/package.json +2 -2
- package/lib/routing-controllers/Makefile +26 -3
- package/lib/routing-controllers/package.json +2 -2
- package/lib/sequelize/Makefile +26 -3
- package/lib/sequelize/package.json +2 -2
- package/lib/starter.js +30 -8
- package/lib/typegoose/Makefile +26 -3
- package/lib/typegoose/package.json +2 -2
- package/lib/typeorm/Makefile +26 -3
- package/lib/typeorm/package.json +2 -2
- package/package.json +1 -1
package/README.kr.md
CHANGED
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
<h4 align="center">๐ ํ์
์คํฌ๋ฆฝํธ ๊ธฐ๋ฐ์ ์ต์คํ๋ ์ค ๋ณด์ผ๋ฌ ํ๋ ์ดํธ ์คํํฐ ํจํค์ง</h4>
|
|
11
11
|
|
|
12
|
+
<p align ="center">
|
|
13
|
+
<a href="https://nodei.co/npm/typescript-express-starter" target="_blank">
|
|
14
|
+
<img src="https://nodei.co/npm/typescript-express-starter.png" alt="npm ์ ๋ณด" />
|
|
15
|
+
</a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
12
18
|
<p align="center">
|
|
13
19
|
<a href="http://npm.im/typescript-express-starter" target="_blank">
|
|
14
20
|
<img src="https://img.shields.io/npm/v/typescript-express-starter.svg" alt="npm ๋ฒ์ " />
|
|
@@ -46,16 +52,6 @@
|
|
|
46
52
|
- [๐บ๐ธ ์์ด](https://github.com/ljlm0402/typescript-express-starter/blob/master/README.md)
|
|
47
53
|
- [๐ฐ๐ท ํ๊ตญ์ด](https://github.com/ljlm0402/typescript-express-starter/blob/master/README.kr.md)
|
|
48
54
|
|
|
49
|
-
> ๋ฒ์ญ์ ๋์์ฃผ์ค ๋ถ์ [์ด์](https://github.com/ljlm0402/typescript-express-starter/issues/new?assignees=ljlm0402&labels=%F0%9F%92%B1+Translations&template=translations-language---.md&title=) ๋จ๊ฒจ์ฃผ์๊ธฐ ๋ฐ๋๋๋ค. ๐
|
|
50
|
-
|
|
51
|
-
<br />
|
|
52
|
-
|
|
53
|
-
## ์น ์ฌ์ดํธ - ํ๋ก์ ํธ ์๊ฐ ๋ฐ ํ๋ณด
|
|
54
|
-
|
|
55
|
-
- [๐๐ปโโ๏ธ Dylan Iqbal :: A TypeScript Express Starter App](https://bit.ly/3rrZFZ9)
|
|
56
|
-
|
|
57
|
-
> ์น ์ฌ์ดํธ ๋ฐ ๋ธ๋ก๊ทธ์ ์๊ฐ๋ฅผ ์ํ์๋ ๋ถ์ [์ด์](https://github.com/ljlm0402/typescript-express-starter/issues/new?assignees=ljlm0402&labels=%F0%9F%91%80+Introducetion&template=introducetion-project---.md&title=) ๋จ๊ฒจ์ฃผ์๊ธฐ ๋ฐ๋๋๋ค. ๐
|
|
58
|
-
|
|
59
55
|
<br />
|
|
60
56
|
|
|
61
57
|
## ๐ ํ๋ก์ ํธ๋ฅผ ์๊ฐํฉ๋๋ค.
|
|
@@ -96,18 +92,19 @@ $ npx typescript-express-starter "project name"
|
|
|
96
92
|
|
|
97
93
|
#### ํ
ํ๋ฆฟ ์ข
๋ฅ
|
|
98
94
|
|
|
99
|
-
| ์ด๋ฆ
|
|
100
|
-
|
|
|
101
|
-
| Default
|
|
102
|
-
| Routing Controllers
|
|
103
|
-
| Sequelize
|
|
104
|
-
| Mongoose
|
|
105
|
-
| TypeORM
|
|
106
|
-
| Prisma
|
|
107
|
-
| Knex
|
|
108
|
-
| GraphQL
|
|
109
|
-
| Typegoose
|
|
110
|
-
| mikro-orm (๊ฐ๋ฐ์ค)
|
|
95
|
+
| ์ด๋ฆ | ์ค๋ช
|
|
|
96
|
+
| :-------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
97
|
+
| Default | Express ๊ธฐ๋ณธ |
|
|
98
|
+
| [Routing Controllers](https://github.com/typestack/routing-controllers) | ๋ฐ์ฝ๋ ์ดํฐ ์ฌ์ฉ๋์ด ๋ง์ ๊ตฌ์กฐํ๋๊ณ ์ ์ธ์ ์ด๋ฉฐ ์๋ฆ๋ต๊ฒ ๊ตฌ์ฑ๋ ํด๋์ค ๊ธฐ๋ฐ ์ปจํธ๋กค๋ฌ ์์ฑ |
|
|
99
|
+
| [Sequelize](https://github.com/sequelize/sequelize) | PostgreSQL, MySQL, MariaDB, SQLite, Microsoft SQL Server๋ฅผ ์ง์ํ๋ Promise ํจํด ๊ธฐ๋ฐ์ Node.js ORM |
|
|
100
|
+
| [Mongoose](https://github.com/Automattic/mongoose) | Node.js์ MongoDB๋ฅผ ์ํ ODM(Object Data Mapping) ๋ผ์ด๋ธ๋ฌ๋ฆฌ |
|
|
101
|
+
| [TypeORM](https://github.com/typeorm/typeorm) | ์๋ฐ์คํฌ๋ฆฝํธ, ํ์
์คํฌ๋ฆฝํธ๊ณผ ํจ๊ป ์ฌ์ฉ๋์ด Node.js, React Native, Expo์์ ์คํ๋ ์ ์๋ ORM |
|
|
102
|
+
| [Prisma](https://github.com/prisma/prisma) | ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ๋ฐ์ดํฐ๋ฅผ ํ๋ก๊ทธ๋๋ฐ ์ธ์ด์ ๊ฐ์ฒด์ ๋งคํํ์ฌ ๊ธฐ์กด์ SQL๋ก ์์ฑํ๋ ๋ฐ์ดํฐ๋ฅผ ์์ , ํ
์ด๋ธ ๊ตฌ์กฐ ๋ณ๊ฒฝ๋ฑ์ ์์
์ ๊ฐ์ฒด๋ฅผ ํตํด ํ๋ก๊ทธ๋๋ฐ์ ์ผ๋ก ํ ์ ์๋๋ก ํด์ฃผ๋ ORM |
|
|
103
|
+
| [Knex](https://github.com/knex/knex) | ์ฟผ๋ฆฌ ๋น๋๋ฅผ ์ํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ |
|
|
104
|
+
| [GraphQL](https://github.com/graphql/graphql-js) | API ์ฉ ์ฟผ๋ฆฌ ์ธ์ด์ด๋ฉฐ ๊ธฐ์กด ๋ฐ์ดํฐ๋ก ์ด๋ฌํ ์ฟผ๋ฆฌ๋ฅผ ์ํํ๊ธฐ์ํ ๋ฐํ์ |
|
|
105
|
+
| [Typegoose](https://github.com/typegoose/typegoose) | ํ์
์คํฌ๋ฆฝํธ ํด๋์ค๋ฅผ ์ฌ์ฉํ์ฌ ๋ชฝ๊ตฌ์ค ๋ชจ๋ธ ์ ์ |
|
|
106
|
+
| [Mikro ORM](https://github.com/mikro-orm/mikro-orm) (๊ฐ๋ฐ์ค) | ๋ฐ์ดํฐ ๋งคํผ, ์์
๋จ์ ๋ฐ ์์ด๋ดํฐํฐ ๋งต ํจํด์ ๊ธฐ๋ฐ์ผ๋ก ํ๋ Node.js์ฉ TypeScript ORM. MongoDB, MySQL, MariaDB, PostgreSQL ๋ฐ SQLite ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ฅผ ์ง์ |
|
|
107
|
+
| [Sequelize Typescript](https://github.com/RobinBuschmann/sequelize-typescript) (๊ฐ๋ฐ์ค) | ๋ฐ์ฝ๋ ์ดํฐ ๋ฐ Sequelize๋ฅผ ์ํ ๋ช ๊ฐ์ง ๊ธฐ๋ฅ |
|
|
111
108
|
|
|
112
109
|
## ๐ Script ๋ช
๋ น์ด
|
|
113
110
|
|
package/README.md
CHANGED
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
<h4 align="center">๐ Express RESTful API Boilerplate Using TypeScript</h4>
|
|
11
11
|
|
|
12
|
+
<p align ="center">
|
|
13
|
+
<a href="https://nodei.co/npm/typescript-express-starter" target="_blank">
|
|
14
|
+
<img src="https://nodei.co/npm/typescript-express-starter.png" alt="npm Info" />
|
|
15
|
+
</a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
12
18
|
<p align="center">
|
|
13
19
|
<a href="http://npm.im/typescript-express-starter" target="_blank">
|
|
14
20
|
<img src="https://img.shields.io/npm/v/typescript-express-starter.svg" alt="npm Version" />
|
|
@@ -46,16 +52,6 @@
|
|
|
46
52
|
- [๐บ๐ธ English](https://github.com/ljlm0402/typescript-express-starter/blob/master/README.md)
|
|
47
53
|
- [๐ฐ๐ท Korean](https://github.com/ljlm0402/typescript-express-starter/blob/master/README.kr.md)
|
|
48
54
|
|
|
49
|
-
> Want to translate to your own language? please open an [issue](https://github.com/ljlm0402/typescript-express-starter/issues/new?assignees=ljlm0402&labels=%F0%9F%92%B1+Translations&template=translations-language---.md&title=) ๐
|
|
50
|
-
|
|
51
|
-
<br />
|
|
52
|
-
|
|
53
|
-
## Web Site - Project Introduction
|
|
54
|
-
|
|
55
|
-
- [๐๐ปโโ๏ธ Dylan Iqbal :: A TypeScript Express Starter App](https://bit.ly/3rrZFZ9)
|
|
56
|
-
|
|
57
|
-
> Want to be featured on your blog or site? please open an [issue](https://github.com/ljlm0402/typescript-express-starter/issues/new?assignees=ljlm0402&labels=%F0%9F%91%80+Introducetion&template=introducetion-project---.md&title=) ๐
|
|
58
|
-
|
|
59
55
|
<br />
|
|
60
56
|
|
|
61
57
|
## ๐ Introducing The Project
|
|
@@ -100,18 +96,19 @@ Start your typescript-express-starter app in development mode at `http://localho
|
|
|
100
96
|
|
|
101
97
|
#### Template Type
|
|
102
98
|
|
|
103
|
-
| Name
|
|
104
|
-
|
|
|
105
|
-
| Default
|
|
106
|
-
| Routing Controllers
|
|
107
|
-
| Sequelize
|
|
108
|
-
| Mongoose
|
|
109
|
-
| TypeORM
|
|
110
|
-
| Prisma
|
|
111
|
-
| Knex
|
|
112
|
-
| GraphQL
|
|
113
|
-
| Typegoose
|
|
114
|
-
| mikro-orm (Develop)
|
|
99
|
+
| Name | Description |
|
|
100
|
+
| :--------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
101
|
+
| Default | Express Default |
|
|
102
|
+
| [Routing Controllers](https://github.com/typestack/routing-controllers) | Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage |
|
|
103
|
+
| [Sequelize](https://github.com/sequelize/sequelize) | Easy to use multi SQL dialect ORM for Node.js |
|
|
104
|
+
| [Mongoose](https://github.com/Automattic/mongoose) | MongoDB Object Modeling(ODM) designed to work in an asynchronous environment |
|
|
105
|
+
| [TypeORM](https://github.com/typeorm/typeorm) | An ORM that can run in Node.js and Others |
|
|
106
|
+
| [Prisma](https://github.com/prisma/prisma) | Modern Database Access for TypeScript & Node.js |
|
|
107
|
+
| [Knex](https://github.com/knex/knex) | SQL query builder for Postgres, MySQL, MariaDB, SQLite3 and Oracle |
|
|
108
|
+
| [GraphQL](https://github.com/graphql/graphql-js) | query language for APIs and a runtime for fulfilling those queries with your existing data |
|
|
109
|
+
| [Typegoose](https://github.com/typegoose/typegoose) | Define Mongoose models using TypeScript classes |
|
|
110
|
+
| [Mikro ORM](https://github.com/mikro-orm/mikro-orm) (Develop) | TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite databases |
|
|
111
|
+
| [Sequelize Typescript](https://github.com/RobinBuschmann/sequelize-typescript) (Develop) | Decorators and some other features for sequelize |
|
|
115
112
|
|
|
116
113
|
## ๐ Available Commands for the Server
|
|
117
114
|
|
package/lib/default/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/default/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",
|
|
@@ -3,7 +3,7 @@ PORT = 3000
|
|
|
3
3
|
|
|
4
4
|
# DATABASE
|
|
5
5
|
DB_HOST = localhost
|
|
6
|
-
DB_PORT =
|
|
6
|
+
DB_PORT = 5432
|
|
7
7
|
DB_USER = root
|
|
8
8
|
DB_PASSWORD = password
|
|
9
9
|
DB_DATABASE = test
|
|
@@ -16,5 +16,5 @@ LOG_FORMAT = dev
|
|
|
16
16
|
LOG_DIR = ../logs
|
|
17
17
|
|
|
18
18
|
# CORS
|
|
19
|
-
ORIGIN =
|
|
19
|
+
ORIGIN = true
|
|
20
20
|
CREDENTIALS = true
|
|
@@ -3,7 +3,7 @@ PORT = 3000
|
|
|
3
3
|
|
|
4
4
|
# DATABASE
|
|
5
5
|
DB_HOST = localhost
|
|
6
|
-
DB_PORT =
|
|
6
|
+
DB_PORT = 5432
|
|
7
7
|
DB_USER = root
|
|
8
8
|
DB_PASSWORD = password
|
|
9
9
|
DB_DATABASE = test
|
|
@@ -16,5 +16,5 @@ LOG_FORMAT = combined
|
|
|
16
16
|
LOG_DIR = ../logs
|
|
17
17
|
|
|
18
18
|
# CORS
|
|
19
|
-
ORIGIN =
|
|
19
|
+
ORIGIN = false
|
|
20
20
|
CREDENTIALS = true
|
|
@@ -3,7 +3,7 @@ PORT = 3000
|
|
|
3
3
|
|
|
4
4
|
# DATABASE
|
|
5
5
|
DB_HOST = localhost
|
|
6
|
-
DB_PORT =
|
|
6
|
+
DB_PORT = 5432
|
|
7
7
|
DB_USER = root
|
|
8
8
|
DB_PASSWORD = password
|
|
9
9
|
DB_DATABASE = test
|
|
@@ -16,5 +16,5 @@ LOG_FORMAT = dev
|
|
|
16
16
|
LOG_DIR = ../logs
|
|
17
17
|
|
|
18
18
|
# CORS
|
|
19
|
-
ORIGIN =
|
|
19
|
+
ORIGIN = true
|
|
20
20
|
CREDENTIALS = true
|
package/lib/graphql/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/graphql/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",
|
package/lib/graphql/src/app.ts
CHANGED
|
@@ -50,9 +50,12 @@ class App {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
private initializeMiddlewares() {
|
|
53
|
+
if (this.env === 'production') {
|
|
54
|
+
this.app.use(hpp());
|
|
55
|
+
this.app.use(helmet());
|
|
56
|
+
}
|
|
57
|
+
|
|
53
58
|
this.app.use(cors({ origin: ORIGIN, credentials: CREDENTIALS }));
|
|
54
|
-
this.app.use(hpp());
|
|
55
|
-
this.app.use(helmet());
|
|
56
59
|
this.app.use(compression());
|
|
57
60
|
this.app.use(express.json());
|
|
58
61
|
this.app.use(express.urlencoded({ extended: true }));
|
|
@@ -68,7 +71,7 @@ class App {
|
|
|
68
71
|
const apolloServer = new ApolloServer({
|
|
69
72
|
schema: schema,
|
|
70
73
|
plugins: [
|
|
71
|
-
|
|
74
|
+
this.env === 'production'
|
|
72
75
|
? ApolloServerPluginLandingPageProductionDefault({ footer: false })
|
|
73
76
|
: ApolloServerPluginLandingPageLocalDefault({ footer: false }),
|
|
74
77
|
],
|
|
@@ -2,4 +2,5 @@ import { config } from 'dotenv';
|
|
|
2
2
|
config({ path: `.env.${process.env.NODE_ENV || 'development'}.local` });
|
|
3
3
|
|
|
4
4
|
export const CREDENTIALS = process.env.CREDENTIALS === 'true';
|
|
5
|
-
export const
|
|
5
|
+
export const ORIGIN = process.env.ORIGIN === 'true';
|
|
6
|
+
export const { NODE_ENV, PORT, DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_DATABASE, SECRET_KEY, LOG_FORMAT, LOG_DIR } = process.env;
|
|
@@ -18,7 +18,7 @@ export default class AuthRepository {
|
|
|
18
18
|
if (findUser) throw new HttpException(409, `You're email ${userData.email} already exists`);
|
|
19
19
|
|
|
20
20
|
const hashedPassword = await hash(userData.password, 10);
|
|
21
|
-
const createUserData: User = await UserEntity.
|
|
21
|
+
const createUserData: User = await UserEntity.create({ ...userData, password: hashedPassword }).save();
|
|
22
22
|
|
|
23
23
|
return createUserData;
|
|
24
24
|
}
|
|
@@ -30,7 +30,7 @@ export default class UserRepository {
|
|
|
30
30
|
if (findUser) throw new HttpException(409, `You're email ${userData.email} already exists`);
|
|
31
31
|
|
|
32
32
|
const hashedPassword = await hash(userData.password, 10);
|
|
33
|
-
const createUserData: User = await UserEntity.
|
|
33
|
+
const createUserData: User = await UserEntity.create({ ...userData, password: hashedPassword }).save();
|
|
34
34
|
|
|
35
35
|
return createUserData;
|
|
36
36
|
}
|
package/lib/knex/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/knex/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",
|
package/lib/mongoose/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",
|
package/lib/prisma/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/prisma/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",
|
|
@@ -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",
|
package/lib/sequelize/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",
|
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",
|
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",
|