Skip to content

Commit

Permalink
Merge pull request #430 from sparcs-kaist/#159-add-typescript-support
Browse files Browse the repository at this point in the history
#159 TypeScript 마이그레이션
  • Loading branch information
kmc7468 authored Nov 26, 2024
2 parents f89a1ab + 94261d5 commit 51ac4f5
Show file tree
Hide file tree
Showing 112 changed files with 3,550 additions and 1,986 deletions.
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.",
},
],
},
],
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"
}
}
Loading

0 comments on commit 51ac4f5

Please sign in to comment.