Skip to content

Commit

Permalink
Merge pull request #155 from ljlm0402/development
Browse files Browse the repository at this point in the history
🌼 Update Version - v8.1.7
  • Loading branch information
ljlm0402 authored Mar 29, 2022
2 parents ae9eebb + bc8d29c commit 081a66a
Show file tree
Hide file tree
Showing 28 changed files with 300 additions and 67 deletions.
29 changes: 26 additions & 3 deletions lib/default/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
# app name should be overridden.
# ex) production-stage: make build APP_NAME=<APP_NAME>
# ex) development-stage: make build-dev APP_NAME=<APP_NAME>

APP_NAME = typescript-express
APP_NAME := $(APP_NAME)

.PHONY: build
# Build the container image - Dvelopment
build-dev:
docker build -t ${APP_NAME}\
--target development-build-stage\
-f Dockerfile .

# Build the container image - Production
build:
docker build -t ${tag} .
docker build -t ${APP_NAME}\
--target production-build-stage\
-f Dockerfile .

# Clean the container image
clean:
docker rmi -f ${tag}
docker rmi -f ${APP_NAME}

# Run the container image
run:
docker run -d -p ${port}:${port} --name ${name} ${tag}
docker run -d -it -p 3000:3000 ${APP_NAME}

all: build
4 changes: 2 additions & 2 deletions lib/default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"scripts": {
"start": "npm run build && cross-env NODE_ENV=production node dist/server.js",
"dev": "cross-env NODE_ENV=development nodemon",
"build": "tsc && tsc-alias",
"build:swc": "swc src -d dist --source-maps --copy-files",
"build": "swc src -d dist --source-maps --copy-files",
"build:tsc": "tsc && tsc-alias",
"test": "jest --forceExit --detectOpenHandles",
"lint": "eslint --ignore-path .gitignore --ext .ts src/",
"lint:fix": "npm run lint -- --fix",
Expand Down
4 changes: 2 additions & 2 deletions lib/graphql/.env.development.local
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PORT = 3000

# DATABASE
DB_HOST = localhost
DB_PORT = 3306
DB_PORT = 5432
DB_USER = root
DB_PASSWORD = password
DB_DATABASE = test
Expand All @@ -16,5 +16,5 @@ LOG_FORMAT = dev
LOG_DIR = ../logs

# CORS
ORIGIN = *
ORIGIN = true
CREDENTIALS = true
4 changes: 2 additions & 2 deletions lib/graphql/.env.production.local
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PORT = 3000

# DATABASE
DB_HOST = localhost
DB_PORT = 3306
DB_PORT = 5432
DB_USER = root
DB_PASSWORD = password
DB_DATABASE = test
Expand All @@ -16,5 +16,5 @@ LOG_FORMAT = combined
LOG_DIR = ../logs

# CORS
ORIGIN = your.domain.com
ORIGIN = false
CREDENTIALS = true
4 changes: 2 additions & 2 deletions lib/graphql/.env.test.local
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PORT = 3000

# DATABASE
DB_HOST = localhost
DB_PORT = 3306
DB_PORT = 5432
DB_USER = root
DB_PASSWORD = password
DB_DATABASE = test
Expand All @@ -16,5 +16,5 @@ LOG_FORMAT = dev
LOG_DIR = ../logs

# CORS
ORIGIN = *
ORIGIN = true
CREDENTIALS = true
29 changes: 26 additions & 3 deletions lib/graphql/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
# app name should be overridden.
# ex) production-stage: make build APP_NAME=<APP_NAME>
# ex) development-stage: make build-dev APP_NAME=<APP_NAME>

APP_NAME = typescript-express
APP_NAME := $(APP_NAME)

.PHONY: build
# Build the container image - Dvelopment
build-dev:
docker build -t ${APP_NAME}\
--target development-build-stage\
-f Dockerfile .

# Build the container image - Production
build:
docker build -t ${tag} .
docker build -t ${APP_NAME}\
--target production-build-stage\
-f Dockerfile .

# Clean the container image
clean:
docker rmi -f ${tag}
docker rmi -f ${APP_NAME}

# Run the container image
run:
docker run -d -p ${port}:${port} --name ${name} ${tag}
docker run -d -it -p 3000:3000 ${APP_NAME}

all: build
4 changes: 2 additions & 2 deletions lib/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"scripts": {
"start": "npm run build && cross-env NODE_ENV=production node dist/server.js",
"dev": "cross-env NODE_ENV=development nodemon",
"build": "tsc && tsc-alias",
"build:swc": "swc src -d dist --source-maps --copy-files",
"build": "swc src -d dist --source-maps --copy-files",
"build:tsc": "tsc && tsc-alias",
"test": "jest --forceExit --detectOpenHandles",
"lint": "eslint --ignore-path .gitignore --ext .ts src/",
"lint:fix": "npm run lint -- --fix",
Expand Down
9 changes: 6 additions & 3 deletions lib/graphql/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ class App {
}

private initializeMiddlewares() {
if (this.env === 'production') {
this.app.use(hpp());
this.app.use(helmet());
}

this.app.use(cors({ origin: ORIGIN, credentials: CREDENTIALS }));
this.app.use(hpp());
this.app.use(helmet());
this.app.use(compression());
this.app.use(express.json());
this.app.use(express.urlencoded({ extended: true }));
Expand All @@ -68,7 +71,7 @@ class App {
const apolloServer = new ApolloServer({
schema: schema,
plugins: [
NODE_ENV === 'production'
this.env === 'production'
? ApolloServerPluginLandingPageProductionDefault({ footer: false })
: ApolloServerPluginLandingPageLocalDefault({ footer: false }),
],
Expand Down
3 changes: 2 additions & 1 deletion lib/graphql/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ import { config } from 'dotenv';
config({ path: `.env.${process.env.NODE_ENV || 'development'}.local` });

export const CREDENTIALS = process.env.CREDENTIALS === 'true';
export const { NODE_ENV, PORT, DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_DATABASE, SECRET_KEY, LOG_FORMAT, LOG_DIR, ORIGIN } = process.env;
export const ORIGIN = process.env.ORIGIN === 'true';
export const { NODE_ENV, PORT, DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_DATABASE, SECRET_KEY, LOG_FORMAT, LOG_DIR } = process.env;
2 changes: 1 addition & 1 deletion lib/graphql/src/entities/users.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class UserEntity extends BaseEntity implements User {

@Column()
@IsNotEmpty()
@Unique()
@Unique(['email'])
email: string;

@Column()
Expand Down
2 changes: 1 addition & 1 deletion lib/graphql/src/repositories/auth.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class AuthRepository {
if (findUser) throw new HttpException(409, `You're email ${userData.email} already exists`);

const hashedPassword = await hash(userData.password, 10);
const createUserData: User = await UserEntity.save({ ...userData, password: hashedPassword });
const createUserData: User = await UserEntity.create({ ...userData, password: hashedPassword }).save();

return createUserData;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/graphql/src/repositories/users.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class UserRepository {
if (findUser) throw new HttpException(409, `You're email ${userData.email} already exists`);

const hashedPassword = await hash(userData.password, 10);
const createUserData: User = await UserEntity.save({ ...userData, password: hashedPassword });
const createUserData: User = await UserEntity.create({ ...userData, password: hashedPassword }).save();

return createUserData;
}
Expand Down
29 changes: 26 additions & 3 deletions lib/knex/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
# app name should be overridden.
# ex) production-stage: make build APP_NAME=<APP_NAME>
# ex) development-stage: make build-dev APP_NAME=<APP_NAME>

APP_NAME = typescript-express
APP_NAME := $(APP_NAME)

.PHONY: build
# Build the container image - Dvelopment
build-dev:
docker build -t ${APP_NAME}\
--target development-build-stage\
-f Dockerfile .

# Build the container image - Production
build:
docker build -t ${tag} .
docker build -t ${APP_NAME}\
--target production-build-stage\
-f Dockerfile .

# Clean the container image
clean:
docker rmi -f ${tag}
docker rmi -f ${APP_NAME}

# Run the container image
run:
docker run -d -p ${port}:${port} --name ${name} ${tag}
docker run -d -it -p 3000:3000 ${APP_NAME}

all: build
4 changes: 2 additions & 2 deletions lib/knex/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"scripts": {
"start": "npm run build && cross-env NODE_ENV=production node dist/server.js",
"dev": "cross-env NODE_ENV=development nodemon",
"build": "tsc && tsc-alias",
"build:swc": "swc src -d dist --source-maps --copy-files",
"build": "swc src -d dist --source-maps --copy-files",
"build:tsc": "tsc && tsc-alias",
"test": "jest --forceExit --detectOpenHandles",
"lint": "eslint --ignore-path .gitignore --ext .ts src/",
"lint:fix": "npm run lint -- --fix",
Expand Down
29 changes: 26 additions & 3 deletions lib/mongoose/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
# app name should be overridden.
# ex) production-stage: make build APP_NAME=<APP_NAME>
# ex) development-stage: make build-dev APP_NAME=<APP_NAME>

APP_NAME = typescript-express
APP_NAME := $(APP_NAME)

.PHONY: build
# Build the container image - Dvelopment
build-dev:
docker build -t ${APP_NAME}\
--target development-build-stage\
-f Dockerfile .

# Build the container image - Production
build:
docker build -t ${tag} .
docker build -t ${APP_NAME}\
--target production-build-stage\
-f Dockerfile .

# Clean the container image
clean:
docker rmi -f ${tag}
docker rmi -f ${APP_NAME}

# Run the container image
run:
docker run -d -p ${port}:${port} --name ${name} ${tag}
docker run -d -it -p 3000:3000 ${APP_NAME}

all: build
4 changes: 2 additions & 2 deletions lib/mongoose/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"scripts": {
"start": "npm run build && cross-env NODE_ENV=production node dist/server.js",
"dev": "cross-env NODE_ENV=development nodemon",
"build": "tsc && tsc-alias",
"build:swc": "swc src -d dist --source-maps --copy-files",
"build": "swc src -d dist --source-maps --copy-files",
"build:tsc": "tsc && tsc-alias",
"test": "jest --forceExit --detectOpenHandles",
"lint": "eslint --ignore-path .gitignore --ext .ts src/",
"lint:fix": "npm run lint -- --fix",
Expand Down
29 changes: 26 additions & 3 deletions lib/prisma/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
# app name should be overridden.
# ex) production-stage: make build APP_NAME=<APP_NAME>
# ex) development-stage: make build-dev APP_NAME=<APP_NAME>

APP_NAME = typescript-express
APP_NAME := $(APP_NAME)

.PHONY: build
# Build the container image - Dvelopment
build-dev:
docker build -t ${APP_NAME}\
--target development-build-stage\
-f Dockerfile .

# Build the container image - Production
build:
docker build -t ${tag} .
docker build -t ${APP_NAME}\
--target production-build-stage\
-f Dockerfile .

# Clean the container image
clean:
docker rmi -f ${tag}
docker rmi -f ${APP_NAME}

# Run the container image
run:
docker run -d -p ${port}:${port} --name ${name} ${tag}
docker run -d -it -p 3000:3000 ${APP_NAME}

all: build
4 changes: 2 additions & 2 deletions lib/prisma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"scripts": {
"start": "npm run build && cross-env NODE_ENV=production node dist/server.js",
"dev": "cross-env NODE_ENV=development nodemon",
"build": "tsc && tsc-alias",
"build:swc": "swc src -d dist --source-maps --copy-files",
"build": "swc src -d dist --source-maps --copy-files",
"build:tsc": "tsc && tsc-alias",
"test": "jest --forceExit --detectOpenHandles",
"lint": "eslint --ignore-path .gitignore --ext .ts src/",
"lint:fix": "npm run lint -- --fix",
Expand Down
29 changes: 26 additions & 3 deletions lib/routing-controllers/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
# app name should be overridden.
# ex) production-stage: make build APP_NAME=<APP_NAME>
# ex) development-stage: make build-dev APP_NAME=<APP_NAME>

APP_NAME = typescript-express
APP_NAME := $(APP_NAME)

.PHONY: build
# Build the container image - Dvelopment
build-dev:
docker build -t ${APP_NAME}\
--target development-build-stage\
-f Dockerfile .

# Build the container image - Production
build:
docker build -t ${tag} .
docker build -t ${APP_NAME}\
--target production-build-stage\
-f Dockerfile .

# Clean the container image
clean:
docker rmi -f ${tag}
docker rmi -f ${APP_NAME}

# Run the container image
run:
docker run -d -p ${port}:${port} --name ${name} ${tag}
docker run -d -it -p 3000:3000 ${APP_NAME}

all: build
4 changes: 2 additions & 2 deletions lib/routing-controllers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"scripts": {
"start": "npm run build && cross-env NODE_ENV=production node dist/server.js",
"dev": "cross-env NODE_ENV=development nodemon",
"build": "tsc && tsc-alias",
"build:swc": "swc src -d dist --source-maps --copy-files",
"build": "swc src -d dist --source-maps --copy-files",
"build:tsc": "tsc && tsc-alias",
"test": "jest --forceExit --detectOpenHandles",
"lint": "eslint --ignore-path .gitignore --ext .ts src/",
"lint:fix": "npm run lint -- --fix",
Expand Down
Loading

0 comments on commit 081a66a

Please sign in to comment.