From c0d695f68fb0a3057ff99b2b6c9df55bde9b6a43 Mon Sep 17 00:00:00 2001 From: nocontribute <> Date: Sun, 13 Aug 2023 18:10:52 +0900 Subject: [PATCH 1/2] =?UTF-8?q?build:=20nodemon=20=EB=8B=A4=EC=8B=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 7 ++- pnpm-lock.yaml | 145 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 122 insertions(+), 30 deletions(-) diff --git a/backend/package.json b/backend/package.json index 79781028..e18c7896 100644 --- a/backend/package.json +++ b/backend/package.json @@ -12,7 +12,7 @@ "scripts": { "start": "npx vite-node src/server.ts", "build": "pnpm --filter='@jiphyeonjeon-42/contracts' build", - "dev": "vite-node --watch src/server.ts", + "dev": "nodemon --exec vite-node src/server.ts", "standalone": "npm run build && npm run start", "lint": "eslint --fix --ext .js,.ts src", "check": "tsc --project ./tsconfig.prod.json --noEmit", @@ -39,10 +39,11 @@ "eslint-import-resolver-typescript": "^3.5.5", "eslint-plugin-import": "^2.27.5", "jest": "^29.5.0", + "jest-mock-extended": "^3.0.4", + "nodemon": "^3.0.1", "prettier": "^2.8.8", "ts-jest": "^29.1.0", - "typeorm-model-generator": "^0.4.6", - "jest-mock-extended": "^3.0.4" + "typeorm-model-generator": "^0.4.6" }, "dependencies": { "@jiphyeonjeon-42/contracts": "workspace:*", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 49160076..729abcba 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -121,7 +121,7 @@ importers: version: 4.4.7(@types/node@18.16.1) vite-node: specifier: https://github.com/scarf005/vitest/releases/download/v0.33.0-2023-07-30/vite-node-0.33.0.tgz - version: 0.33.0(@types/node@18.16.1) + version: '@github.com/scarf005/vitest/releases/download/v0.33.0-2023-07-30/vite-node-0.33.0.tgz(@types/node@18.16.1)' vite-tsconfig-paths: specifier: ^4.2.0 version: 4.2.0(typescript@5.1.6)(vite@4.4.7) @@ -195,6 +195,9 @@ importers: jest-mock-extended: specifier: ^3.0.4 version: 3.0.4(jest@29.5.0)(typescript@5.1.6) + nodemon: + specifier: ^3.0.1 + version: 3.0.1 prettier: specifier: ^2.8.8 version: 2.8.8 @@ -2193,6 +2196,11 @@ packages: engines: {node: '>=0.6'} dev: true + /binary-extensions@2.2.0: + resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} + engines: {node: '>=8'} + dev: true + /bl@3.0.1: resolution: {integrity: sha512-jrCW5ZhfQ/Vt07WX1Ngs+yn9BDqPL/gw28S7s9H6QK/gupnizNzJAss5akW20ISgOrbLTlXOOCTJeNUQqruAWQ==} dependencies: @@ -2423,6 +2431,21 @@ packages: resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} dev: true + /chokidar@3.5.3: + resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} + engines: {node: '>= 8.10.0'} + dependencies: + anymatch: 3.1.3 + braces: 3.0.2 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.2 + dev: true + /chownr@2.0.0: resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==} engines: {node: '>=10'} @@ -2661,7 +2684,7 @@ packages: ms: 2.0.0 dev: false - /debug@3.2.7: + /debug@3.2.7(supports-color@5.5.0): resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} peerDependencies: supports-color: '*' @@ -2670,6 +2693,7 @@ packages: optional: true dependencies: ms: 2.1.3 + supports-color: 5.5.0 dev: true /debug@4.3.4: @@ -3010,7 +3034,7 @@ packages: /eslint-import-resolver-node@0.3.7: resolution: {integrity: sha512-gozW2blMLJCeFpBwugLTGyvVjNoeo1knonXAcatC6bjPBZitotxdWf7Gimr25N4c0AAOo4eOUfaG82IJPDpqCA==} dependencies: - debug: 3.2.7 + debug: 3.2.7(supports-color@5.5.0) is-core-module: 2.12.1 resolve: 1.22.2 transitivePeerDependencies: @@ -3063,7 +3087,7 @@ packages: optional: true dependencies: '@typescript-eslint/parser': 6.1.0(eslint@8.45.0)(typescript@5.1.6) - debug: 3.2.7 + debug: 3.2.7(supports-color@5.5.0) eslint: 8.45.0 eslint-import-resolver-node: 0.3.7 eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@6.1.0)(eslint-plugin-import@2.27.5)(eslint@8.45.0) @@ -3085,7 +3109,7 @@ packages: array-includes: 3.1.6 array.prototype.flat: 1.3.1 array.prototype.flatmap: 1.3.1 - debug: 3.2.7 + debug: 3.2.7(supports-color@5.5.0) doctrine: 2.1.0 eslint: 8.45.0 eslint-import-resolver-node: 0.3.7 @@ -3870,6 +3894,10 @@ packages: /ieee754@1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + /ignore-by-default@1.0.1: + resolution: {integrity: sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==} + dev: true + /ignore@5.2.4: resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} engines: {node: '>= 4'} @@ -3979,6 +4007,13 @@ packages: has-bigints: 1.0.2 dev: true + /is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + dependencies: + binary-extensions: 2.2.0 + dev: true + /is-boolean-object@1.1.2: resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} engines: {node: '>= 0.4'} @@ -5191,6 +5226,30 @@ packages: sorted-array-functions: 1.3.0 dev: false + /nodemon@3.0.1: + resolution: {integrity: sha512-g9AZ7HmkhQkqXkRc20w+ZfQ73cHLbE8hnPbtaFbFtCumZsjyMhKk9LajQ07U5Ux28lvFjZ5X7HvWR1xzU8jHVw==} + engines: {node: '>=10'} + hasBin: true + dependencies: + chokidar: 3.5.3 + debug: 3.2.7(supports-color@5.5.0) + ignore-by-default: 1.0.1 + minimatch: 3.1.2 + pstree.remy: 1.1.8 + semver: 7.5.4 + simple-update-notifier: 2.0.0 + supports-color: 5.5.0 + touch: 3.1.0 + undefsafe: 2.0.5 + dev: true + + /nopt@1.0.10: + resolution: {integrity: sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==} + hasBin: true + dependencies: + abbrev: 1.1.1 + dev: true + /nopt@5.0.0: resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==} engines: {node: '>=6'} @@ -5764,6 +5823,10 @@ packages: ipaddr.js: 1.9.1 dev: false + /pstree.remy@1.1.8: + resolution: {integrity: sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==} + dev: true + /punycode@2.3.0: resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==} engines: {node: '>=6'} @@ -5808,6 +5871,13 @@ packages: string_decoder: 1.3.0 util-deprecate: 1.0.2 + /readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + dependencies: + picomatch: 2.3.1 + dev: true + /reflect-metadata@0.1.13: resolution: {integrity: sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==} @@ -6083,6 +6153,13 @@ packages: is-arrayish: 0.3.2 dev: false + /simple-update-notifier@2.0.0: + resolution: {integrity: sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==} + engines: {node: '>=10'} + dependencies: + semver: 7.5.4 + dev: true + /sisteransi@1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} dev: true @@ -6481,6 +6558,13 @@ packages: engines: {node: '>=0.6'} dev: false + /touch@3.1.0: + resolution: {integrity: sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==} + hasBin: true + dependencies: + nopt: 1.0.10 + dev: true + /tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} @@ -6845,6 +6929,10 @@ packages: which-boxed-primitive: 1.0.2 dev: true + /undefsafe@2.0.5: + resolution: {integrity: sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==} + dev: true + /underscore@1.13.6: resolution: {integrity: sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==} dev: true @@ -6950,28 +7038,6 @@ packages: engines: {node: '>= 0.8'} dev: false - /vite-node@0.33.0(@types/node@18.16.1): - resolution: {integrity: sha512-19FpHYbwWWxDr73ruNahC+vtEdza52kA90Qb3La98yZ0xULqV8A5JLNPUff0f5zID4984tW7l3DH2przTJUZSw==} - engines: {node: '>=v14.18.0'} - hasBin: true - dependencies: - cac: 6.7.14 - debug: 4.3.4 - mlly: 1.4.0 - pathe: 1.1.1 - picocolors: 1.0.0 - vite: 4.4.7(@types/node@18.16.1) - transitivePeerDependencies: - - '@types/node' - - less - - lightningcss - - sass - - stylus - - sugarss - - supports-color - - terser - dev: false - /vite-tsconfig-paths@4.2.0(typescript@5.1.6)(vite@4.4.7): resolution: {integrity: sha512-jGpus0eUy5qbbMVGiTxCL1iB9ZGN6Bd37VGLJU39kTDD6ZfULTTb1bcc5IeTWqWJKiWV5YihCaibeASPiGi8kw==} peerDependencies: @@ -7291,3 +7357,28 @@ packages: /zod@3.21.4: resolution: {integrity: sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==} + + '@github.com/scarf005/vitest/releases/download/v0.33.0-2023-07-30/vite-node-0.33.0.tgz(@types/node@18.16.1)': + resolution: {tarball: https://github.com/scarf005/vitest/releases/download/v0.33.0-2023-07-30/vite-node-0.33.0.tgz} + id: '@github.com/scarf005/vitest/releases/download/v0.33.0-2023-07-30/vite-node-0.33.0.tgz' + name: vite-node + version: 0.33.0 + engines: {node: '>=v14.18.0'} + hasBin: true + dependencies: + cac: 6.7.14 + debug: 4.3.4 + mlly: 1.4.0 + pathe: 1.1.1 + picocolors: 1.0.0 + vite: 4.4.7(@types/node@18.16.1) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + dev: false From 569d3a0bfd1286171d554108656d7a9388f88866 Mon Sep 17 00:00:00 2001 From: scarf Date: Sun, 13 Aug 2023 18:14:27 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20hmr=20=EC=82=AC=EC=9A=A9=20=EC=A4=91?= =?UTF-8?q?=EC=A7=80,=20nodemon=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/server.ts | 7 ------- backend/vite.config.ts | 1 + 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/backend/package.json b/backend/package.json index e18c7896..19d60bcc 100644 --- a/backend/package.json +++ b/backend/package.json @@ -12,7 +12,7 @@ "scripts": { "start": "npx vite-node src/server.ts", "build": "pnpm --filter='@jiphyeonjeon-42/contracts' build", - "dev": "nodemon --exec vite-node src/server.ts", + "dev": "nodemon --watch src --watch ../contracts/dist --exec vite-node src/server.ts", "standalone": "npm run build && npm run start", "lint": "eslint --fix --ext .js,.ts src", "check": "tsc --project ./tsconfig.prod.json --noEmit", diff --git a/backend/src/server.ts b/backend/src/server.ts index 9a9d40f1..59b26adc 100644 --- a/backend/src/server.ts +++ b/backend/src/server.ts @@ -1,5 +1,3 @@ -/// - import { createHttpTerminator } from 'http-terminator'; import jipDataSource from '~/app-data-source'; import { gracefulTerminationTimeout } from '~/config'; @@ -43,8 +41,3 @@ const attemptGracefulShutdown = async (signal: string) => { const signals = ['SIGTERM', 'SIGINT', 'SIGUSR2']; signals.forEach((signal) => process.on(signal, () => attemptGracefulShutdown(signal))); - -if (import.meta.hot) { - import.meta.hot.on('vite:beforeFullReload', releaseResources); - import.meta.hot.dispose(releaseResources); -} diff --git a/backend/vite.config.ts b/backend/vite.config.ts index 3ec65c09..d65f8ffa 100644 --- a/backend/vite.config.ts +++ b/backend/vite.config.ts @@ -4,4 +4,5 @@ import tsconfigPaths from 'vite-tsconfig-paths'; export default defineConfig({ plugins: [tsconfigPaths()], + server: { hmr: false }, });