assemble-prod.sh 910 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. # Assemble production artifacts for GROWI app.
  3. # Run from the workspace root.
  4. set -euo pipefail
  5. echo "[1/4] Collecting production dependencies..."
  6. rm -rf out
  7. pnpm deploy out --prod --legacy --filter @growi/app
  8. echo "[1/4] Done."
  9. echo "[2/4] Reorganizing node_modules..."
  10. rm -rf node_modules
  11. mv out/node_modules node_modules
  12. rm -rf apps/app/node_modules
  13. ln -sfn ../../node_modules apps/app/node_modules
  14. rm -rf out
  15. echo "[2/4] Done."
  16. echo "[3/4] Removing build cache..."
  17. rm -rf apps/app/.next/cache
  18. echo "[3/4] Done."
  19. # Provide a CJS runtime config so the production server can load it without TypeScript.
  20. # next.config.js takes precedence over next.config.ts in Next.js, so the .ts file
  21. # is left in place but effectively ignored at runtime.
  22. echo "[4/4] Installing runtime next.config.js..."
  23. cp apps/app/next.config.prod.cjs apps/app/next.config.js
  24. echo "[4/4] Done."
  25. echo "Assembly complete."