Add Node version detection + yarn build:production to build.sh
- Node <16 fails fast with helpful error - Node 17+ gets --openssl-legacy-provider for CSS module compat - yarn build:production runs automatically after all injections - Graceful fallback if yarn missing or build fails (admin + console still work) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1e9c7fbeeb
commit
0311249938
@@ -0,0 +1,39 @@
|
||||
# Chronicler Dispatch — Add Badge Build Now
|
||||
|
||||
**Date:** 2026-04-12
|
||||
**From:** Chronicler #84 — The Meridian
|
||||
**To:** Code
|
||||
|
||||
---
|
||||
|
||||
## Decision: Add it now
|
||||
|
||||
Michael wants to test on the live panel (which has additional Blueprint modules) as the real-world validation. If `yarn build:production` succeeds there, badges ship in v1.0.0 — not v1.1.0.
|
||||
|
||||
Go ahead and add the Node version detection + badge build to build.sh now. Use the exact implementation from the Gemini consult:
|
||||
|
||||
```bash
|
||||
# Node version detection
|
||||
NODE_MAJOR_VERSION=$(node -v | grep -oE '[0-9]+' | head -1)
|
||||
echo "Detected Node.js version: v$NODE_MAJOR_VERSION"
|
||||
|
||||
# Fail fast on Node < 16
|
||||
if [ "$NODE_MAJOR_VERSION" -lt 16 ]; then
|
||||
echo "ERROR: ModpackChecker requires Node.js 16 or higher."
|
||||
echo "Please upgrade Node.js on your panel and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Apply OpenSSL legacy provider for Node 17+
|
||||
if [ "$NODE_MAJOR_VERSION" -ge 17 ]; then
|
||||
echo "Applying OpenSSL legacy provider for Node 17+ compatibility..."
|
||||
export NODE_OPTIONS=--openssl-legacy-provider
|
||||
fi
|
||||
```
|
||||
|
||||
Make sure `yarn build:production` runs at the end of build.sh after all injections.
|
||||
|
||||
Push when ready and I'll rebuild on Dev Panel to confirm it compiles, then we test on the live panel.
|
||||
|
||||
*— Chronicler #84, The Meridian*
|
||||
**Fire + Frost + Foundation** 💙🔥❄️
|
||||
@@ -27,6 +27,23 @@ fi
|
||||
|
||||
echo "Using extension directory: $EXT_DIR"
|
||||
|
||||
# ===========================================
|
||||
# 0. NODE VERSION DETECTION
|
||||
# ===========================================
|
||||
NODE_MAJOR_VERSION=$(node -v | grep -oE '[0-9]+' | head -1)
|
||||
echo "Detected Node.js version: v$NODE_MAJOR_VERSION"
|
||||
|
||||
if [ "$NODE_MAJOR_VERSION" -lt 16 ]; then
|
||||
echo "ERROR: ModpackChecker requires Node.js 16 or higher."
|
||||
echo "Please upgrade Node.js on your panel and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$NODE_MAJOR_VERSION" -ge 17 ]; then
|
||||
echo "Applying OpenSSL legacy provider for Node 17+ compatibility..."
|
||||
export NODE_OPTIONS=--openssl-legacy-provider
|
||||
fi
|
||||
|
||||
# ===========================================
|
||||
# 1. CONSOLE WIDGET INJECTION (Right Column)
|
||||
# ===========================================
|
||||
@@ -131,13 +148,24 @@ echo ""
|
||||
echo "--- Cache Clear ---"
|
||||
php artisan optimize:clear 2>/dev/null && echo "✓ Laravel caches cleared" || echo "⚠ Cache clear skipped (non-fatal)"
|
||||
|
||||
# ===========================================
|
||||
# 6. COMPILE FRONTEND ASSETS
|
||||
# ===========================================
|
||||
echo ""
|
||||
echo "--- Frontend Build ---"
|
||||
if command -v yarn &>/dev/null; then
|
||||
echo "Running yarn build:production (this may take 2-5 minutes)..."
|
||||
yarn build:production 2>&1 && echo "✓ Frontend assets compiled" || echo "⚠ Frontend build failed — dashboard badges will not render, but admin + console features work fine"
|
||||
else
|
||||
echo "⚠ yarn not found — skipping frontend build. Dashboard badges require manual yarn build:production"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo "ModpackChecker injection complete!"
|
||||
echo "ModpackChecker build complete!"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " 1. Run: yarn build:production"
|
||||
echo " 2. Restart: systemctl restart php8.3-fpm"
|
||||
echo " 3. Test cron: php artisan modpackchecker:check"
|
||||
echo " 1. Restart: systemctl restart php8.3-fpm"
|
||||
echo " 2. Test cron: php artisan modpackchecker:check"
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user