This commit was merged in pull request #8.
This commit is contained in:
41
web/build.sh
Executable file
41
web/build.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# Install esbuild if not present
|
||||
if ! command -v esbuild >/dev/null 2>&1; then
|
||||
if command -v npx >/dev/null 2>&1; then
|
||||
NPX="npx"
|
||||
else
|
||||
echo "esbuild not found. Install it: npm install -g esbuild"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
NPX=""
|
||||
fi
|
||||
|
||||
mkdir -p dist
|
||||
|
||||
# Build JS bundle
|
||||
${NPX:+$NPX} esbuild src/app.jsx \
|
||||
--bundle \
|
||||
--minify \
|
||||
--jsx-factory=h \
|
||||
--jsx-fragment=Fragment \
|
||||
--define:process.env.NODE_ENV=\"production\" \
|
||||
--external:preact \
|
||||
--outfile=dist/app.js \
|
||||
2>/dev/null || \
|
||||
${NPX:+$NPX} esbuild src/app.jsx \
|
||||
--bundle \
|
||||
--minify \
|
||||
--jsx-factory=h \
|
||||
--jsx-fragment=Fragment \
|
||||
--define:process.env.NODE_ENV=\"production\" \
|
||||
--outfile=dist/app.js
|
||||
|
||||
# Copy static files
|
||||
cp src/index.html dist/index.html
|
||||
cp src/style.css dist/style.css
|
||||
|
||||
echo "Build complete: web/dist/"
|
||||
Reference in New Issue
Block a user