Files
pplus-web/scripts/assemble.sh
T
alexm e092cb029c
Build, test, deploy / site (push) Failing after 15m13s
Initial commit
2026-11-12 22:24:02 -05:00

28 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env sh
# SPDX-FileCopyrightText: 2026 Scientific Computing Studio, LLC
# SPDX-License-Identifier: Apache-2.0
# Assemble the deployable site into ./site: what a static host needs (the page, its styles and fonts, dist/, pplus-core's
# core/dist/ that the page's import map points at, and the Quarto extension).
set -eu
cd "$(dirname "$0")/.."
rm -rf site && mkdir -p site
cp -r index.html styles.css styles fonts dist site/
rm -f site/styles/course/README.md # the provenance notes stay in the repository (the fonts' LICENSE.txt goes with them)
# the license and the third-party notices go with the files they cover (CodeMirror's MIT notices among them)
cp LICENSE.md NOTICE.md THIRD_PARTY.md site/
# pplus-core's built modules, without source maps, declarations, or the lesson corpus (a test fixture)
mkdir -p site/core
cp -r core/dist site/core/
find site/core/dist \( -name '*.map' -o -name '*.d.ts' \) -delete
rm -rf site/core/dist/curriculum
# the Quarto extension, which the "With Quarto" page loads (pplus.css, pplus.js) and links to, file by file
mkdir -p site/quarto/_extensions
cp -r quarto/_extensions/pplus site/quarto/_extensions/
rm -rf site/quarto/_extensions/pplus/engine
printf '%s\n' "${GITHUB_SHA:-$(git rev-parse HEAD 2>/dev/null || echo dev)}" > site/VERSION
# the three commits it was built from (web, core, library), their versions and the pinned Mojo (scripts/build-info.mjs)
node scripts/build-info.mjs > site/build.json
# the page names the commit (the footer shows it) and preloads every module its imports reach (scripts/assemble-page.mjs)
node scripts/assemble-page.mjs site
echo "site/ assembled ($(du -sh site | cut -f1))"