build.sh 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. set -e
  3. echo "Building New API Electron App..."
  4. echo "Step 1: Building frontend..."
  5. cd ../web
  6. DISABLE_ESLINT_PLUGIN='true' bun run build
  7. cd ../electron
  8. echo "Step 2: Building Go backend..."
  9. cd ..
  10. if [[ "$OSTYPE" == "darwin"* ]]; then
  11. echo "Building for macOS..."
  12. CGO_ENABLED=1 go build -ldflags="-s -w" -o new-api
  13. cd electron
  14. npm install
  15. npm run build:mac
  16. elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
  17. echo "Building for Linux..."
  18. CGO_ENABLED=1 go build -ldflags="-s -w" -o new-api
  19. cd electron
  20. npm install
  21. npm run build:linux
  22. elif [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" || "$OSTYPE" == "win32" ]]; then
  23. echo "Building for Windows..."
  24. CGO_ENABLED=1 go build -ldflags="-s -w" -o new-api.exe
  25. cd electron
  26. npm install
  27. npm run build:win
  28. else
  29. echo "Unknown OS, building for current platform..."
  30. CGO_ENABLED=1 go build -ldflags="-s -w" -o new-api
  31. cd electron
  32. npm install
  33. npm run build
  34. fi
  35. echo "Build complete! Check electron/dist/ for output."