From e665882d25562ac5f0d71d24bf57be9e9534f792 Mon Sep 17 00:00:00 2001 From: sudoooooo Date: Wed, 13 Dec 2023 21:42:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Ddocker=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/package.json | 12 ++++++------ server/scripts/run-local.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/package.json b/server/package.json index 429fcea4..fa489deb 100644 --- a/server/package.json +++ b/server/package.json @@ -6,14 +6,14 @@ "scripts": { "copy": "mkdir -p ./build/ && cp -rf ./src/* ./build/", "build": "tsc", - "launch:local": "npm run build && SERVER_ENV=local node ./build/index.js", - "launch:dev": "npm run build && SERVER_ENV=dev node ./build/index.js", - "start:stable": "SERVER_ENV=stable node ./build/index.js", - "start:preonline": "SERVER_ENV=preonline node ./build/index.js", - "start:online": "SERVER_ENV=online node ./build/index.js", + "launch:local": "SERVER_ENV=local npx ts-node ./src/index.ts", + "launch:dev": "SERVER_ENV=dev npx ts-node ./src/index.ts", + "start:stable": "npm run copy && npm run build && SERVER_ENV=stable node ./build/index.js", + "start:preonline": "npm run copy && npm run build && SERVER_ENV=preonline node ./build/index.js", + "start:online": "npm run copy && npm run build && SERVER_ENV=online node ./build/index.js", "start": "npm run start:online", "local": "npx ts-node scripts/run-local.ts", - "dev": "npm run copy && nodemon -e js,mjs,json,ts --exec 'npm run launch:dev' --watch ./src" + "dev": "nodemon -e js,mjs,json,ts --exec 'npm run launch:dev' --watch ./src" }, "devDependencies": { "@types/crypto-js": "^4.2.1", diff --git a/server/scripts/run-local.ts b/server/scripts/run-local.ts index 700be218..6d8caa9f 100644 --- a/server/scripts/run-local.ts +++ b/server/scripts/run-local.ts @@ -9,7 +9,7 @@ async function startServerAndRunScript() { console.log('MongoDB Memory Server started:', mongoUri); // 通过 nodemon 运行另一个脚本,并传递 MongoDB 连接 URL 作为环境变量 - const nodemon = exec(`npm run copy && nodemon -e js,mjs,json,ts --exec 'xiaojuSurveyMongoUrl=${mongoUri} npm run launch:local' --watch ./src`); + const nodemon = exec(`nodemon -e js,mjs,json,ts --exec 'xiaojuSurveyMongoUrl=${mongoUri} npm run launch:local' --watch ./src`); nodemon.stdout?.on('data', (data) => { console.log(data);