iching-broker-level2/start-local.sh
Christopher Hase 1d62a62f33
All checks were successful
ci / build (push) Successful in 1m6s
run locally part 1.0
2025-04-16 15:37:16 +02:00

35 lines
764 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/
# 4. Rename compiled frontend .js → .mjs
find dist/frontend -name "*.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