iching-broker-level2/start-local.sh
Christopher Hase 628855b5d9
All checks were successful
ci / build (push) Successful in 1m11s
add config.json again
2025-04-17 14:46:32 +02:00

38 lines
838 B
Bash
Executable file

# build
#npm install
#npx tsc -p tsconfig.backend.json
#npx tsc -p tsconfig.frontend.json
#npm run start:local
#!/bin/bash
# Exit on error
set -e
# 1. Install dependencies
npm install
# 2. Compile backend and frontend
npx tsc -p tsconfig.backend.json
npx tsc -p tsconfig.frontend.json
# 3. Ensure dist/frontend exists and copy index.html
mkdir -p dist/frontend
cp frontend/index.html dist/frontend/
mkdir -p dist/backend
cp backend/config.json dist/backend/
# 4. Rename compiled frontend event.js → event.mjs
find dist/frontend -name "event.js" -exec bash -c 'mv "$0" "${0%.js}.mjs"' {} \;
# 5. Inject deploy mode
echo "window.DEPLOY_MODE = 'local';" > dist/frontend/deploy.js
# 6. Start backend
node dist/backend/server.js &
# 7. Start frontend
npx http-server dist/frontend -p 8080 --cors --mime application/javascript=js