website/render.bash
Michael Bradley 8d180285a9
All checks were successful
/ build (push) Successful in 50s
/ build (pull_request) Successful in 41s
Change Bash directive style
Oops, it wasn't that it wasn't finding the file, it was that the first line failed.
2025-02-19 18:43:25 -05:00

25 lines
518 B
Bash
Executable file

#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
set -o xtrace
yarn "build:targets"
PROD='dist/prod'
if [[ -d "$PROD" ]]; then
rm -r "$PROD"
fi
mkdir -p "$PROD"
echo 'Rendering webpage...'
node -e 'import("./dist/server/entry-server.js").then(({render}) => console.log(render().html))' > "$PROD"/index.html
echo "Preparing $PROD..."
# Copy used assets
cp -r dist/client/assets "$PROD"/
cp public/* "$PROD"/
# Not needed: Pre-rendered
rm "$PROD"/assets/*.js
# Not needed: Inlined
rm "$PROD"/assets/*.css