26 lines
766 B
Bash
Executable File
26 lines
766 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Pass-through mode: if arguments were provided, execute them directly
|
|
if [ "$#" -gt 0 ]; then
|
|
exec "$@"
|
|
fi
|
|
|
|
# Ensure posts directory data file exists for layout inheritance
|
|
if [ ! -f src/posts/posts.json ]; then
|
|
echo '{"layout": "layouts/post.njk"}' > src/posts/posts.json
|
|
fi
|
|
|
|
# Build static site from mounted or packaged markdown posts
|
|
echo "[blog-engine] Compiling static site with Eleventy..."
|
|
npm run build || exit 1
|
|
|
|
# Optional watch mode for zero-restart live note updates
|
|
if [ "${WATCH:-false}" = "true" ]; then
|
|
echo "[blog-engine] Starting live watch daemon for markdown changes..."
|
|
npx @11ty/eleventy --watch &
|
|
fi
|
|
|
|
# Start production static web server
|
|
echo "[blog-engine] Starting static server on port ${PORT:-8080}..."
|
|
exec node server.js
|