Add El source files for all client-side JS
Recovers original JS from git history and ports it into proper El source files under src/js/. Each file wraps the original JS in a native_js call inside a main() function, making it valid El that compiles to a self-contained IIFE via elc --target=js --bundle. Files added: src/js/account-auth.el - Supabase OTP magic-link (sendMagicLink) src/js/account-dashboard.el - Account dashboard: session, plan card, family src/js/chat-widget.el - Demo chat widget (neuronDemoToggle/Send/Reset) src/js/checkout-auth.el - Checkout auth: OAuth, email sign-in/up src/js/checkout-free.el - Free plan: auth-badge watch -> payment reveal src/js/checkout-stripe.el - Stripe Payment Element (reads NEURON_CFG) src/js/enterprise.el - Enterprise inquiry form + headcount filter src/js/environmental.el - Efficiency calculator slider src/js/gallery.el - Gallery nav, search/sort, Supabase voting src/js/main.el - Share page voting + copyForPlatform src/js/marketplace.el - Developer interest form src/js/nav.el - Nav hamburger + Mission dropdown src/js/styles.el - Landing: nav scroll, reveal, founding counter
This commit is contained in:
+32
-19
@@ -4,23 +4,22 @@
|
||||
#
|
||||
# Pipeline:
|
||||
# 1. Stage the foundation El runtime into ./runtime/.
|
||||
# 2. Concatenate src/*.el into dist/main-combined.el (component-first,
|
||||
# 2. Compile client-side El sources (src/js/*.el) to dist/js/*.js using
|
||||
# the JS-capable elc binary at bin/elc-linux-amd64 (CI) or the local
|
||||
# elc (dev). Output is gitignored and rebuilt every run.
|
||||
# 3. Concatenate src/*.el into dist/main-combined.el (component-first,
|
||||
# main.el last; matches the historical order from build-local.sh).
|
||||
# 3. Compile dist/main-combined.el → dist/main.c using the canonical
|
||||
# 4. Compile dist/main-combined.el → dist/main.c using the canonical
|
||||
# native elc at foundation/el/dist/platform/elc.
|
||||
# 4. Inject the host-side stub forward declarations into dist/main.c
|
||||
# 5. Inject the host-side stub forward declarations into dist/main.c
|
||||
# (sed header rewrite, same set as the prior in-Dockerfile sed).
|
||||
# 5. docker buildx build --platform linux/amd64 -f Dockerfile.stage.
|
||||
# 6. docker buildx build --platform linux/amd64 -f Dockerfile.stage.
|
||||
#
|
||||
# bootstrap.py is no longer in the build path. The container image now
|
||||
# expects dist/main.c to be a finished C source — it just runs cc on it.
|
||||
#
|
||||
# Inline-JS extraction is gated by EXTRACT_JS=1 just like build-local.sh
|
||||
# was. Production deploys should always extract.
|
||||
#
|
||||
# Usage:
|
||||
# ./build-stage.sh <tag> — build marketing:<tag>
|
||||
# EXTRACT_JS=1 ./build-stage.sh X — also extract inline JS to assets
|
||||
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
@@ -32,6 +31,17 @@ EL_HOME="${EL_HOME:-${LANDING_DIR}/../../foundation/el}"
|
||||
ELC="${EL_HOME}/dist/platform/elc"
|
||||
RUNTIME_SRC="${EL_HOME}/el-compiler/runtime"
|
||||
|
||||
# JS-capable elc: prefer committed bin/elc-linux-amd64 on CI (linux/amd64),
|
||||
# fall back to the local elc from the El checkout on macOS dev.
|
||||
if [ -f "${LANDING_DIR}/bin/elc-linux-amd64" ] && uname -m | grep -q x86_64; then
|
||||
ELC_JS="${LANDING_DIR}/bin/elc-linux-amd64"
|
||||
elif [ -x "${ELC}" ]; then
|
||||
ELC_JS="${ELC}"
|
||||
else
|
||||
echo "elc for JS compilation not found — expected bin/elc-linux-amd64 or ${ELC}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -x "${ELC}" ]; then
|
||||
echo "elc not found at ${ELC}" >&2
|
||||
exit 1
|
||||
@@ -42,17 +52,20 @@ mkdir -p runtime dist
|
||||
cp "${RUNTIME_SRC}/el_runtime.c" runtime/
|
||||
cp "${RUNTIME_SRC}/el_runtime.h" runtime/
|
||||
|
||||
# Optional inline-JS extraction. Off by default for fast dev iteration; the
|
||||
# script is idempotent so flipping the flag on a prior tree just reuses
|
||||
# previously-extracted assets.
|
||||
if [[ "${EXTRACT_JS:-0}" == "1" ]]; then
|
||||
echo "==> Extracting inline JS → src/assets/js/"
|
||||
if [ ! -x "node_modules/.bin/terser" ] || [ ! -x "node_modules/.bin/javascript-obfuscator" ]; then
|
||||
echo " installing terser + javascript-obfuscator (no-save)..."
|
||||
npm install --no-save --silent terser javascript-obfuscator
|
||||
fi
|
||||
python3 scripts/extract-js.py
|
||||
fi
|
||||
# The JS compiler looks for el_runtime.js in the same directory as the
|
||||
# source file being compiled. Copy it there so --bundle can inline it.
|
||||
cp "${RUNTIME_SRC}/el_runtime.js" "${LANDING_DIR}/src/js/"
|
||||
|
||||
echo "==> Compiling client-side El (src/js/*.el) → dist/js/"
|
||||
mkdir -p dist/js
|
||||
for f in "${LANDING_DIR}/src/js/"*.el; do
|
||||
name=$(basename "$f" .el)
|
||||
"${ELC_JS}" --target=js --bundle --minify --obfuscate "$f" > "${LANDING_DIR}/dist/js/${name}.js"
|
||||
echo " compiled: src/js/${name}.el → dist/js/${name}.js"
|
||||
done
|
||||
|
||||
# Clean up the staged runtime (not a source file)
|
||||
rm -f "${LANDING_DIR}/src/js/el_runtime.js"
|
||||
|
||||
echo "==> Combining El sources → dist/main-combined.el"
|
||||
COMPONENTS=(nav hero pillars how_it_works inference efficiency comparison
|
||||
|
||||
Reference in New Issue
Block a user