diff --git a/nodemon.json b/nodemon.json index 561ca51..7748fd3 100644 --- a/nodemon.json +++ b/nodemon.json @@ -1,7 +1,3 @@ { - "events": { - "restart": "kill-port 8080", - "crash": "kill-port 8080" - }, - "delay": "500" + "delay": "100" } diff --git a/package-lock.json b/package-lock.json index 27ec6db..92638e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "@koa/router": "^10.1.1", "@sealcode/sealgen": "^0.5.3", "@sealcode/ts-predicates": "^0.4.0", + "@types/kill-port": "^2.0.0", "hint": "^7.0.1", "locreq": "^2.0.2", "multiple-scripts-tmux": "^1.0.4", @@ -3101,6 +3102,15 @@ "@types/node": "*" } }, + "node_modules/@types/kill-port": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/kill-port/-/kill-port-2.0.0.tgz", + "integrity": "sha512-AegaqABFauES4++49NeNX7TyZJ7t48t10+qJn4QGVGQqDogEk89M0iI4W0HXS+TEUk/hYAtEsgJ+6nyuSyYxlw==", + "dependencies": { + "@types/node": "*", + "shell-exec": "^1" + } + }, "node_modules/@types/koa": { "version": "2.13.5", "resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.13.5.tgz", @@ -12926,8 +12936,7 @@ "node_modules/shell-exec": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/shell-exec/-/shell-exec-1.0.2.tgz", - "integrity": "sha512-jyVd+kU2X+mWKMmGhx4fpWbPsjvD53k9ivqetutVW/BQ+WIZoDoP4d8vUMGezV6saZsiNoW2f9GIhg9Dondohg==", - "dev": true + "integrity": "sha512-jyVd+kU2X+mWKMmGhx4fpWbPsjvD53k9ivqetutVW/BQ+WIZoDoP4d8vUMGezV6saZsiNoW2f9GIhg9Dondohg==" }, "node_modules/shelljs": { "version": "0.8.5", @@ -17345,6 +17354,15 @@ "@types/node": "*" } }, + "@types/kill-port": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/kill-port/-/kill-port-2.0.0.tgz", + "integrity": "sha512-AegaqABFauES4++49NeNX7TyZJ7t48t10+qJn4QGVGQqDogEk89M0iI4W0HXS+TEUk/hYAtEsgJ+6nyuSyYxlw==", + "requires": { + "@types/node": "*", + "shell-exec": "^1" + } + }, "@types/koa": { "version": "2.13.5", "resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.13.5.tgz", @@ -24663,8 +24681,7 @@ "shell-exec": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/shell-exec/-/shell-exec-1.0.2.tgz", - "integrity": "sha512-jyVd+kU2X+mWKMmGhx4fpWbPsjvD53k9ivqetutVW/BQ+WIZoDoP4d8vUMGezV6saZsiNoW2f9GIhg9Dondohg==", - "dev": true + "integrity": "sha512-jyVd+kU2X+mWKMmGhx4fpWbPsjvD53k9ivqetutVW/BQ+WIZoDoP4d8vUMGezV6saZsiNoW2f9GIhg9Dondohg==" }, "shelljs": { "version": "0.8.5", diff --git a/package.json b/package.json index ef4c47c..2e4fe25 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "@koa/router": "^10.1.1", "@sealcode/sealgen": "^0.5.3", "@sealcode/ts-predicates": "^0.4.0", + "@types/kill-port": "^2.0.0", "hint": "^7.0.1", "locreq": "^2.0.2", "multiple-scripts-tmux": "^1.0.4", diff --git a/src/back/index.ts b/src/back/index.ts index 58bb58a..980ea17 100644 --- a/src/back/index.ts +++ b/src/back/index.ts @@ -1,3 +1,4 @@ +import kill from "kill-port"; import _locreq from "locreq"; import TheApp from "./app"; import { mainRouter } from "./routes"; @@ -5,7 +6,8 @@ const locreq = _locreq(__dirname); const app = new TheApp(); -app.start() +kill(app.config["www-server"].port) + .then(() => app.start()) .then(async () => { if (process.env.SEALIOUS_SANITY === "true") { console.log("Exiting with error code 0");