fix: 修复docker启动问题

This commit is contained in:
sudoooooo 2023-12-13 21:42:56 +08:00
parent 96ca8b55ed
commit e665882d25
2 changed files with 7 additions and 7 deletions

View File

@ -6,14 +6,14 @@
"scripts": { "scripts": {
"copy": "mkdir -p ./build/ && cp -rf ./src/* ./build/", "copy": "mkdir -p ./build/ && cp -rf ./src/* ./build/",
"build": "tsc", "build": "tsc",
"launch:local": "npm run build && SERVER_ENV=local node ./build/index.js", "launch:local": "SERVER_ENV=local npx ts-node ./src/index.ts",
"launch:dev": "npm run build && SERVER_ENV=dev node ./build/index.js", "launch:dev": "SERVER_ENV=dev npx ts-node ./src/index.ts",
"start:stable": "SERVER_ENV=stable node ./build/index.js", "start:stable": "npm run copy && npm run build && SERVER_ENV=stable node ./build/index.js",
"start:preonline": "SERVER_ENV=preonline node ./build/index.js", "start:preonline": "npm run copy && npm run build && SERVER_ENV=preonline node ./build/index.js",
"start:online": "SERVER_ENV=online node ./build/index.js", "start:online": "npm run copy && npm run build && SERVER_ENV=online node ./build/index.js",
"start": "npm run start:online", "start": "npm run start:online",
"local": "npx ts-node scripts/run-local.ts", "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": { "devDependencies": {
"@types/crypto-js": "^4.2.1", "@types/crypto-js": "^4.2.1",

View File

@ -9,7 +9,7 @@ async function startServerAndRunScript() {
console.log('MongoDB Memory Server started:', mongoUri); console.log('MongoDB Memory Server started:', mongoUri);
// 通过 nodemon 运行另一个脚本,并传递 MongoDB 连接 URL 作为环境变量 // 通过 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) => { nodemon.stdout?.on('data', (data) => {
console.log(data); console.log(data);