Skip to content

Commit 2a1cbe4

Browse files
authored
Merge pull request #177 from samchon/features/webpack
Webpack 설정 변경.
2 parents 4b94072 + c1390b3 commit 2a1cbe4

File tree

17 files changed

+92
-117
lines changed

17 files changed

+92
-117
lines changed

packages/fake-iamport-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fake-iamport-server",
3-
"version": "5.1.0",
3+
"version": "5.1.1",
44
"description": "Fake iamport server for testing",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",

packages/fake-toss-payments-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fake-toss-payments-server",
3-
"version": "5.1.0",
3+
"version": "5.1.1",
44
"description": "Fake toss-payments server for testing",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",

packages/iamport-server-api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iamport-server-api",
3-
"version": "5.1.0",
3+
"version": "5.1.1",
44
"description": "API for Iamport Server",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",

packages/iamport-server-api/swagger.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"info": {
1414
"title": "Iamport API",
1515
"description": "Built by [fake-iamport-server](https://github.com/samchon/payments/tree/master/packages/fake-iamport-server) with [nestia](https://github.com/samchon/nestia)",
16-
"version": "5.1.0",
16+
"version": "5.1.1",
1717
"license": {
1818
"name": "MIT"
1919
}

packages/payment-api/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@samchon/payment-api",
3-
"version": "5.1.0",
3+
"version": "5.1.1",
44
"description": "API for Payment Backend",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",
@@ -35,8 +35,8 @@
3535
},
3636
"dependencies": {
3737
"@nestia/fetcher": "^2.3.9",
38-
"iamport-server-api": "^5.1.0",
39-
"toss-payments-server-api": "^5.1.0",
38+
"iamport-server-api": "^5.1.1",
39+
"toss-payments-server-api": "^5.1.1",
4040
"typia": "^5.2.6"
4141
}
4242
}

packages/payment-api/swagger.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
}
88
],
99
"info": {
10-
"version": "5.1.0",
10+
"version": "5.1.1",
1111
"title": "@samchon/payment-backend",
1212
"description": "Payment Backend Server",
1313
"license": {

packages/payment-backend/package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
{
22
"name": "@samchon/payment-backend",
3-
"version": "5.1.0",
3+
"version": "5.1.1",
44
"description": "Payment Backend Server",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",
77
"scripts": {
8-
"----------------------------------------------": "",
98
"build": "npm run build:sdk && npm run build:main && npm run build:test",
109
"build:api": "rimraf packages/api/lib && nestia sdk && tsc -p packages/api/tsconfig.json",
11-
"build:main": "npm run build:prisma && rimraf lib && tsc",
10+
"build:main": "rimraf lib && tsc",
1211
"build:prisma": "prisma generate --schema=src/schema.prisma",
1312
"build:sdk": "rimraf src/api/functional && nestia sdk",
1413
"build:swagger": "nestia swagger",
15-
"build:test": "npm run build:prisma && rimraf bin && tsc -p test/tsconfig.json",
14+
"build:test": "rimraf bin && tsc -p test/tsconfig.json",
1615
"dev": "npm run build:test -- --watch",
1716
"eslint": "eslint src && eslint test",
1817
"eslint:fix": "eslint src --fix && eslint test --fix",
@@ -36,7 +35,9 @@
3635
"stop:updator:master": "pm2 delete payments-server-backend-updator-master",
3736
"stop:updator:slave": "pm2 delete payments-server-backend-updator-slave",
3837
"update": "node lib/executable/update",
39-
"-------------------------------------------------": ""
38+
"-------------------------------------------------": "",
39+
"webpack": "webpack",
40+
"prune": "npm ci --omit=dev --ignore-scripts && npm run build:prisma"
4041
},
4142
"repository": {
4243
"type": "git",
@@ -56,29 +57,27 @@
5657
"@types/cli": "^0.11.19",
5758
"@types/express": "^4.17.12",
5859
"@types/inquirer": "^8.2.5",
59-
"@types/node": "^15.6.1",
60+
"@types/node": "^15.14.9",
6061
"@types/pg": "^8.6.5",
6162
"@types/uuid": "^8.3.0",
6263
"@typescript-eslint/eslint-plugin": "^5.26.0",
6364
"@typescript-eslint/parser": "^5.26.0",
6465
"cli": "^1.0.1",
65-
"copy-webpack-plugin": "^11.0.0",
6666
"copyfiles": "^2.4.1",
67-
"iamport-server-api": "^5.1.0",
67+
"iamport-server-api": "^5.1.1",
6868
"nestia": "^5.0.3",
6969
"pm2": "^4.5.6",
70-
"prisma-markdown": "^1.0.7",
7170
"rimraf": "^3.0.2",
7271
"sloc": "^0.2.1",
73-
"toss-payments-server-api": "^5.1.0",
72+
"toss-payments-server-api": "^5.1.1",
7473
"ts-loader": "^9.5.0",
7574
"ts-node": "^10.9.1",
7675
"ts-patch": "^3.0.2",
7776
"typescript": "^5.2.2",
7877
"typescript-transform-paths": "^3.4.6",
7978
"webpack": "^5.89.0",
8079
"webpack-cli": "^5.1.4",
81-
"write-file-webpack-plugin": "^4.5.1"
80+
"webpack-node-externals": "^3.0.0"
8281
},
8382
"dependencies": {
8483
"@nestia/core": "^2.3.9",
@@ -89,13 +88,14 @@
8988
"bcryptjs": "^2.4.3",
9089
"dotenv": "^16.3.1",
9190
"dotenv-expand": "^10.0.0",
92-
"fake-iamport-server": "^5.1.0",
93-
"fake-toss-payments-server": "^5.1.0",
91+
"fake-iamport-server": "^5.1.1",
92+
"fake-toss-payments-server": "^5.1.1",
9493
"fastify": "^4.24.3",
9594
"git-last-commit": "^1.0.0",
9695
"inquirer": "^8.2.5",
9796
"mutex-server": "^0.3.1",
9897
"prisma": "^5.3.1",
98+
"prisma-markdown": "^1.0.7",
9999
"serialize-error": "^4.1.0",
100100
"source-map-support": "^0.5.19",
101101
"tstl": "^2.5.13",

packages/payment-backend/src/PaymentConfiguration.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
} from "@nestjs/common";
88
import { PrismaClientKnownRequestError } from "@prisma/client/runtime/library";
99
import { IIamportUser } from "iamport-server-api/lib/structures/IIamportUser";
10+
import path from "path";
1011

1112
import { PaymentGlobal } from "./PaymentGlobal";
1213

@@ -89,7 +90,13 @@ export namespace PaymentConfiguration {
8990
/**
9091
* @internal
9192
*/
92-
export const ROOT = __dirname.split("\\").join("/") + "/..";
93+
export const ROOT = (() => {
94+
const splitted: string[] = __dirname.split(path.sep);
95+
return splitted[splitted.length - 1] === "src" &&
96+
splitted[splitted.length - 2] === "bin"
97+
? path.resolve(__dirname + "/../..")
98+
: path.resolve(__dirname + "/..");
99+
})();
93100

94101
/**
95102
* @internal

packages/payment-backend/src/PaymentGlobal.ts

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -70,51 +70,53 @@ export namespace PaymentGlobal {
7070
* 없으니, 이 점을 착각하지 말기 바란다.
7171
*/
7272
export let testing: boolean = false;
73-
}
7473

75-
interface IMode {
76-
value?: "local" | "dev" | "real";
77-
}
78-
const modeWrapper: IMode = {};
74+
export interface IEnvironments {
75+
// DEFAULT CONFIGURATIONS
76+
PAYMENT_MODE: "local" | "dev" | "real";
77+
PAYMENT_API_PORT: `${number}`;
78+
PAYMENT_UPDATOR_PORT: `${number}`;
79+
PAYMENT_SYSTEM_PASSWORD: string;
7980

80-
interface IEnvironments {
81-
// DEFAULT CONFIGURATIONS
82-
PAYMENT_MODE: "local" | "dev" | "real";
83-
PAYMENT_API_PORT: `${number}`;
84-
PAYMENT_UPDATOR_PORT: `${number}`;
85-
PAYMENT_SYSTEM_PASSWORD: string;
81+
// POSTGRES CONNECTION INFO
82+
PAYMENT_POSTGRES_HOST: string;
83+
PAYMENT_POSTGRES_PORT: `${number}`;
84+
PAYMENT_POSTGRES_DATABASE: string;
85+
PAYMENT_POSTGRES_SCHEMA: string;
86+
PAYMENT_POSTGRES_USERNAME: string;
87+
PAYMENT_POSTGRES_USERNAME_READONLY: string;
88+
PAYMENT_POSTGRES_PASSWORD: string;
89+
PAYMENT_POSTGRES_URL: string;
8690

87-
// POSTGRES CONNECTION INFO
88-
PAYMENT_POSTGRES_HOST: string;
89-
PAYMENT_POSTGRES_PORT: `${number}`;
90-
PAYMENT_POSTGRES_DATABASE: string;
91-
PAYMENT_POSTGRES_SCHEMA: string;
92-
PAYMENT_POSTGRES_USERNAME: string;
93-
PAYMENT_POSTGRES_USERNAME_READONLY: string;
94-
PAYMENT_POSTGRES_PASSWORD: string;
95-
PAYMENT_POSTGRES_URL: string;
91+
// ENCRYPTION KEYS
92+
PAYMENT_CONNECTION_ENCRYPTION_KEY: string;
93+
PAYMENT_CONNECTION_ENCRYPTION_IV: string;
94+
PAYMENT_HISTORY_ENCRYPTION_KEY: string;
95+
PAYMENT_HISTORY_ENCRYPTION_IV: string;
96+
PAYMENT_RESERVATION_ENCRYPTION_KEY: string;
97+
PAYMENT_RESERVATION_ENCRYPTION_IV: string;
98+
PAYMENT_CANCEL_HISTORY_ENCRYPTION_KEY: string;
99+
PAYMENT_CANCEL_HISTORY_ENCRYPTION_IV: string;
96100

97-
// ENCRYPTION KEYS
98-
PAYMENT_CONNECTION_ENCRYPTION_KEY: string;
99-
PAYMENT_CONNECTION_ENCRYPTION_IV: string;
100-
PAYMENT_HISTORY_ENCRYPTION_KEY: string;
101-
PAYMENT_HISTORY_ENCRYPTION_IV: string;
102-
PAYMENT_RESERVATION_ENCRYPTION_KEY: string;
103-
PAYMENT_RESERVATION_ENCRYPTION_IV: string;
104-
PAYMENT_CANCEL_HISTORY_ENCRYPTION_KEY: string;
105-
PAYMENT_CANCEL_HISTORY_ENCRYPTION_IV: string;
101+
// VENDOR'S SECRETS
102+
PAYMENT_IAMPORT_KEY: string;
103+
PAYMENT_IAMPORT_SECRET: string;
104+
PAYMENT_TOSS_PAYMENTS_SECRET: string;
105+
}
106+
}
106107

107-
// VENDOR'S SECRETS
108-
PAYMENT_IAMPORT_KEY: string;
109-
PAYMENT_IAMPORT_SECRET: string;
110-
PAYMENT_TOSS_PAYMENTS_SECRET: string;
108+
interface IMode {
109+
value?: "local" | "dev" | "real";
111110
}
111+
const modeWrapper: IMode = {};
112112

113-
const environments: Singleton<IEnvironments> = new Singleton(() => {
114-
const env = dotenv.config();
115-
dotenvExpand.expand(env);
116-
return typia.assert<IEnvironments>(process.env);
117-
});
113+
const environments: Singleton<PaymentGlobal.IEnvironments> = new Singleton(
114+
() => {
115+
const env = dotenv.config();
116+
dotenvExpand.expand(env);
117+
return typia.assert<PaymentGlobal.IEnvironments>(process.env);
118+
},
119+
);
118120

119121
const prismaClient = new Singleton(
120122
() =>

packages/payment-backend/src/PaymentSetupWizard.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import cp from "child_process";
22

3+
import { PaymentConfiguration } from "./PaymentConfiguration";
34
import { PaymentGlobal } from "./PaymentGlobal";
45

56
export namespace PaymentSetupWizard {
@@ -12,7 +13,10 @@ export namespace PaymentSetupWizard {
1213
const execute = (type: string) => (argv: string) =>
1314
cp.execSync(
1415
`npx prisma migrate ${type} --schema=src/schema.prisma ${argv}`,
15-
{ stdio: "ignore" },
16+
{
17+
stdio: "ignore",
18+
cwd: PaymentConfiguration.ROOT,
19+
},
1620
);
1721
execute("reset")("--force");
1822
execute("dev")("--name init");

0 commit comments

Comments
 (0)