Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#159 TypeScript 마이그레이션 #430

Merged
merged 71 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
c15495f
Fix: skip validation for trust proxy setting in rate-limit middleware
withSang Oct 6, 2023
ae339d2
Merge remote-tracking branch 'origin/dev' into #159-add-typescript-su…
withSang Nov 7, 2023
07f181a
Merge branch 'origin/main'
withSang Nov 7, 2023
387aee7
Fix: validate proxy in rateLimit middleware
withSang Nov 7, 2023
318bb33
Merge remote-tracking branch 'origin/dev' into #159-add-typescript-su…
withSang Nov 15, 2023
b054052
fix(github): disable unit test
withSang Nov 15, 2023
cf5da43
feat(typescript): init typescript project
withSang Nov 15, 2023
9723665
feat(typescript): type index.ts
withSang Nov 15, 2023
5dfb074
Refactor: add path alias
withSang Nov 28, 2023
f8cbff8
Add: add rules for typescript-eslint
withSang Nov 28, 2023
e1155ab
Add: type definitions for some middlewares
withSang Nov 28, 2023
052d144
Add: type definitions for templates
withSang Nov 28, 2023
d3bc2f0
Merge branch 'dev' into #159-add-typescript-support
kmc7468 Jan 23, 2024
7624238
Fix: compile error
kmc7468 Jan 24, 2024
f5ece38
Refactor: migrate middlewares/ajv to TS
kmc7468 Jan 25, 2024
5deedf9
Refactor: migrate modules/stores/mongo to TS
kmc7468 Jan 26, 2024
ea89f43
Refactor: mongo.ts
kmc7468 Feb 1, 2024
db8ce7e
Refactor: migrate modules/stores/aws to TS
kmc7468 Feb 1, 2024
b6cdd88
Refactor: migrate modules/stores/sessionStore to TS
kmc7468 Feb 2, 2024
94daf70
Refactor: migrate some files in modules directory to TS
kmc7468 Feb 2, 2024
2a7c55f
Refactor: move types directory into src directory
kmc7468 Feb 3, 2024
3a2ab65
Refactor: update tsconfig.json
kmc7468 Feb 3, 2024
7795c73
Refactor: migrate modules/fcm to TS
kmc7468 Feb 3, 2024
8d58a79
Refactor: migrate populate directory to TS
kmc7468 Feb 3, 2024
a5e5739
Merge branch 'dev' into #159-add-typescript-support
kmc7468 Feb 6, 2024
73fc564
Fix: prettier TypeScript parsing error
kmc7468 Feb 6, 2024
4af19ff
Refactor: apply prettier
kmc7468 Feb 6, 2024
2fc3a0e
Merge branch 'dev' into #159-add-typescript-support
kmc7468 Mar 20, 2024
86f8b4a
Remove: all references to lottery module from outside lottery module
kmc7468 Mar 20, 2024
2a32d96
Fix: runtime errors
kmc7468 Mar 20, 2024
9cfa9dc
Merge branch 'dev' into #159-add-typescript-support
kmc7468 Apr 23, 2024
da9de88
Refactor: merge two package.json files into one file
kmc7468 Apr 30, 2024
decef9b
Fix: dumpDB and restoreDB scripts
kmc7468 May 12, 2024
9f72dc7
Add: ts-node dev dependency
kmc7468 May 12, 2024
8804b00
Fix: test script
kmc7468 May 12, 2024
21ea160
Fix: test error in TypeScript environment
kmc7468 May 14, 2024
87eaf2e
Refactor: migrate routes/users and services/users to ts
MinjaeKimmm Nov 5, 2024
a6db7d9
Fix: Updated one import in users
MinjaeKimmm Nov 5, 2024
dd6e851
Merge branch 'dev' into #159-add-typescript-support
kmc7468 Nov 12, 2024
226435b
Fix: merge conflicts
kmc7468 Nov 12, 2024
1c8dac4
Refactor: enable CI
kmc7468 Nov 12, 2024
7e17d5f
Fix: loadenv 를 As-Is에서 사용하던 Nested object로 변경하였습니다
cokia Nov 19, 2024
3ce5406
Refactor: middlewares
kmc7468 Nov 19, 2024
0d61e46
Merge branch '#159-add-typescript-support' of https://github.com/spar…
kmc7468 Nov 19, 2024
d90f28c
Revert "Fix: loadenv 를 As-Is에서 사용하던 Nested object로 변경하였습니다"
kmc7468 Nov 19, 2024
63d0891
Refactor: use ts-node for local development
kmc7468 Nov 19, 2024
6b6670b
Refactor: ts conversion
TaehyeonPark Nov 19, 2024
9fa30bf
Merge branch '#159-add-typescript-support' of https://github.com/spar…
TaehyeonPark Nov 19, 2024
68ea4b6
Refactor: ts conversion
TaehyeonPark Nov 19, 2024
4fea34d
Refactor: apply new coding conventions on loadenv.ts
kmc7468 Nov 26, 2024
c29b428
Refactor: convention
kmc7468 Nov 26, 2024
97487fb
Refactor: import convention
TaehyeonPark Nov 26, 2024
b14e48e
Refactor: convention 2
kmc7468 Nov 26, 2024
1c396a2
Refactor: convention 3
kmc7468 Nov 26, 2024
327ba68
Refactor: esm convention
TaehyeonPark Nov 26, 2024
2f60fd9
Refactor: tsconfig.json
kmc7468 Nov 26, 2024
b3b17b5
Refactor: convention 4
kmc7468 Nov 26, 2024
99430cd
Refactor: @ convention
TaehyeonPark Nov 26, 2024
e93d89b
Fix: redis undefined error
kmc7468 Nov 26, 2024
84a732e
Fix: jwt undefiend error
kmc7468 Nov 26, 2024
e0e99c6
Fix: minor bugs
kmc7468 Nov 26, 2024
d8c6919
Refactor: type
TaehyeonPark Nov 26, 2024
378add6
Merge branch '#159-add-typescript-support' of https://github.com/spar…
TaehyeonPark Nov 26, 2024
8bf1599
Refactor: es6
TaehyeonPark Nov 26, 2024
5172ea5
Fix: scripts
kmc7468 Nov 26, 2024
7e5b85c
Refactor: unused fs
TaehyeonPark Nov 26, 2024
8d8bac8
fix: user null
MinjaeKimmm Nov 26, 2024
be4159d
fix: change 500 to 400
MinjaeKimmm Nov 26, 2024
5b32009
fix: matched response to test case
MinjaeKimmm Nov 26, 2024
74ba7d2
fix: add space
MinjaeKimmm Nov 26, 2024
94261d5
fix: minor stuff
MinjaeKimmm Nov 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/node_modules
/dist
.env
.env.test
.env.production
.env.development
.DS_store
*.code-workspace
*.swp
/logs/*.log
.vscode

# AdminJS 관련 디렉토리
.adminjs
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
dist/
package.json
tsconfig.json
.prettierrc.json
.eslintrc.cjs
nodemon.json
80 changes: 80 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
module.exports = {
env: {
es2021: true,
node: true,
},
extends: [
"plugin:@typescript-eslint/recommended",
"airbnb-base",
"airbnb-typescript/base",
"plugin:mocha/recommended",
"prettier",
],
overrides: [
{
env: {
node: true,
mocha: true,
},
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
},
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: "./tsconfig.json",
},
plugins: ["import", "@typescript-eslint", "mocha"],
rules: {
"import/extensions": [
"error",
"ignorePackages",
{
js: "never", // temporary fix for #159
ts: "never",
},
],
"import/named": "error",
"import/no-extraneous-dependencies": [
"error",
{
packageDir: "./",
},
],
"mocha/no-mocha-arrows": "off",
"no-console": "error",
"no-restricted-imports": [
"error",
{
patterns: [
{
group: ["../*"],
message:
"Usage of relative parent imports is not allowed. Use path alias instead.",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:+1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 blame하니까 저네요.. 미안합니다

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아.. lint 생각을 못하고 있었네요. CI에 lint도 같이 넣어버려야겠습니다!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

추후 별도의 이슈/PR을 통해 작업하기로 결정하였습니다.

},
],
},
],
radix: ["error", "as-needed"],
"@typescript-eslint/consistent-type-imports": [
"error",
{
prefer: "type-imports",
},
],
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts"],
},
"import/resolver": {
typescript: {
project: ["./tsconfig.json"],
},
},
},
};
15 changes: 0 additions & 15 deletions .eslintrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/node_modules
/dist
/dump
.env
.env.test
.env.production
.env.development
Expand Down
7 changes: 5 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
node_modules
build
node_modules/
dist/
package.json
tsconfig.json
nodemon.json
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"trailingComma": "es5",
"useTabs": false,
"vueIndentScriptAndStyle": false,
"parser": "babel"
"parser": "typescript"
}
91 changes: 0 additions & 91 deletions app.js

This file was deleted.

62 changes: 0 additions & 62 deletions loadenv.js

This file was deleted.

15 changes: 9 additions & 6 deletions nodemon.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"ignore": ["node_modules/*"],
"env": {
"TZ": "Asia/Seoul",
"NODE_ENV": "development"
}
}
"ignore": ["node_modules"],
"watch": ["src", ".env.development"],
"ext": "js,json,ts",
"exec": "ts-node --require tsconfig-paths/register src",
"env": {
"TZ": "Asia/Seoul",
"NODE_ENV": "development"
}
}
42 changes: 32 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
"main": "app.js",
"scripts": {
"preinstall": "npx only-allow pnpm",
"start": "cross-env TZ='Asia/Seoul' npx nodemon app.js",
"test": "npm run sample && cross-env TZ='Asia/Seoul' npm run mocha",
"mocha": "cross-env TZ='Asia/Seoul' NODE_ENV=test mocha --recursive --reporter spec --exit",
"serve": "cross-env TZ='Asia/Seoul' NODE_ENV=production node app.js",
"runscript": "cross-env TZ='Asia/Seoul' NODE_ENV=production node",
"lint": "npx eslint --fix .",
"sample": "cd src/sampleGenerator && npm start && cd .."
"start": "nodemon",
"mocha": "cross-env TZ='Asia/Seoul' NODE_ENV=test mocha --require ts-node/register --require tsconfig-paths/register --recursive --reporter spec --exit",
"test": "pnpm run sample && cross-env TZ='Asia/Seoul' pnpm run mocha",
"build": "tsc --project tsconfig.build.json && tsc-alias",
"clean": "rimraf dist/",
"serve": "cross-env TZ='Asia/Seoul' NODE_ENV=production node dist/index.js",
"lint": "pnpm eslint .",
"runscript": "cross-env TZ='Asia/Seoul' NODE_ENV=production ts-node --require tsconfig-paths/register",
"sample": "cross-env NODE_ENV=test ts-node --require tsconfig-paths/register src/sampleGenerator/index.js",
"dumpDB": "cross-env NODE_ENV=test ts-node --require tsconfig-paths/register src/sampleGenerator/tools/dump.js",
"restoreDB": "cross-env NODE_ENV=test ts-node --require tsconfig-paths/register src/sampleGenerator/tools/restore.js"
},
"engines": {
"node": ">=18.0.0",
Expand All @@ -27,12 +31,11 @@
"axios": "^0.27.2",
"ci": "^2.2.0",
"connect-mongo": "^4.6.0",
"connect-redis": "^6.1.3",
"connect-redis": "^7.1.1",
"cookie-parser": "^1.4.5",
"cors": "^2.8.5",
"cross-env": "^7.0.3",
"dotenv": "^16.0.1",
"eslint-config-prettier": "^8.3.0",
"express": "^4.17.1",
"express-formidable": "^1.2.0",
"express-rate-limit": "^7.1.0",
Expand All @@ -56,12 +59,31 @@
"zod-to-json-schema": "^3.22.4"
},
"devDependencies": {
"@types/cookie-parser": "^1.4.6",
"@types/cors": "^2.8.16",
"@types/express": "^4.17.21",
"@types/express-session": "^1.17.10",
"@types/jsonwebtoken": "^9.0.5",
"@types/node": "^20.9.0",
"@types/node-cron": "^3.0.11",
"@types/response-time": "^2.3.8",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"chai": "^4.3.10",
"eslint": "^8.22.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^8.3.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-mocha": "^10.1.0",
"mocha": "^10.2.0",
"mongodb": "^4.1.0",
"nodemon": "^3.0.1",
"supertest": "^6.2.4"
"rimraf": "^5.0.5",
"supertest": "^6.2.4",
"ts-node": "^10.9.2",
"tsc-alias": "^1.8.8",
"typescript": "^5.2.2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dockerfile에서 2 Stage Build 같은거 써봐도 재밌을 것 같네요!

}
}
Loading
Loading