From 483867235cf713a0024ff8da0ac431533c72cb13 Mon Sep 17 00:00:00 2001 From: Randy Syring Date: Sun, 6 Sep 2026 23:58:10 -0400 Subject: [PATCH] Adjust js related tasks and fix CI --- .github/workflows/nox.yaml | 9 ++++- mise.lock | 44 +++++++++------------ mise.toml | 33 +--------------- package.json | 2 +- prek.toml | 2 +- readme.md | 11 ++++-- specs/2026-09-06-javascript-source-build.md | 20 ++++++---- src/flask_hypergen/static/hypergen.js | 2 +- tasks/finalize-js-build.mjs | 2 +- tasks/js-build | 8 ++++ tasks/js-check | 9 +++++ tasks/js-verify | 14 +++++++ tasks/js-watch | 8 ++++ 13 files changed, 91 insertions(+), 73 deletions(-) create mode 100755 tasks/js-build create mode 100755 tasks/js-check create mode 100755 tasks/js-verify create mode 100755 tasks/js-watch diff --git a/.github/workflows/nox.yaml b/.github/workflows/nox.yaml index 1c91fa5..514edc0 100644 --- a/.github/workflows/nox.yaml +++ b/.github/workflows/nox.yaml @@ -23,13 +23,20 @@ jobs: - uses: actions/checkout@v6 - uses: jdx/mise-action@v4 + with: + install_args: node aube - - run: mise run check-js + - run: tasks/js-check # JOB nox-other: runs-on: ubuntu-latest + # JavaScript verification runs in the dedicated job with its required toolchain. + # The audit matrix entry does not run Prek, so this variable has no effect there. + env: + SKIP: verify-generated-javascript + strategy: fail-fast: false matrix: diff --git a/mise.lock b/mise.lock index b509ac7..c6c6c59 100644 --- a/mise.lock +++ b/mise.lock @@ -1,44 +1,38 @@ # @generated - this file is auto-generated by `mise lock` https://mise.jdx.dev/dev-tools/mise-lock.html [[tools.aube]] -version = "1.32.0" +version = "1.33.1" backend = "aqua:jdx/aube" [tools.aube."platforms.linux-arm64"] -checksum = "sha256:df67dc7a5de64e64d929431401f922ed73b7460f6e34af401d3f0c9b63abfb63" -url = "https://github.com/jdx/aube/releases/download/v1.32.0/aube-v1.32.0-aarch64-unknown-linux-gnu.tar.gz" -url_api = "https://api.github.com/repos/jdx/aube/releases/assets/485347368" -provenance = "github-attestations" +checksum = "sha256:e830a24d96205ad92b7dbb8ec1794f959cb37765bbbf7de61c5a6c06ee020c24" +url = "https://github.com/jdx/aube/releases/download/v1.33.1/aube-v1.33.1-aarch64-unknown-linux-gnu.tar.gz" +url_api = "https://api.github.com/repos/jdx/aube/releases/assets/489853573" [tools.aube."platforms.linux-arm64-musl"] -checksum = "sha256:6ffb9e4d33054859a708856fe2ddd585888bc03dabbcd9d6ac3311963f6b2e96" -url = "https://github.com/jdx/aube/releases/download/v1.32.0/aube-v1.32.0-aarch64-unknown-linux-musl.tar.gz" -url_api = "https://api.github.com/repos/jdx/aube/releases/assets/485320976" -provenance = "github-attestations" +checksum = "sha256:a96078f649e521bc099c4b15a49ecaee281cb3e0480bd6c4357d88f7850421b1" +url = "https://github.com/jdx/aube/releases/download/v1.33.1/aube-v1.33.1-aarch64-unknown-linux-musl.tar.gz" +url_api = "https://api.github.com/repos/jdx/aube/releases/assets/489824334" [tools.aube."platforms.linux-x64"] -checksum = "sha256:5419e7dbba887a4c1f7ae5675d86dd5d71fa3daa66053d16788e986c66078126" -url = "https://github.com/jdx/aube/releases/download/v1.32.0/aube-v1.32.0-x86_64-unknown-linux-gnu.tar.gz" -url_api = "https://api.github.com/repos/jdx/aube/releases/assets/485325644" -provenance = "github-attestations" +checksum = "sha256:c6e739a72bd3789bf0a1024b76b3290b709ff62ca9aa52771f0c59b644d51a9c" +url = "https://github.com/jdx/aube/releases/download/v1.33.1/aube-v1.33.1-x86_64-unknown-linux-gnu.tar.gz" +url_api = "https://api.github.com/repos/jdx/aube/releases/assets/489831452" [tools.aube."platforms.linux-x64-musl"] -checksum = "sha256:bc74918c2adf8899b87599b1a43e3be001f42bed3fb44589f6955bca70657559" -url = "https://github.com/jdx/aube/releases/download/v1.32.0/aube-v1.32.0-x86_64-unknown-linux-musl.tar.gz" -url_api = "https://api.github.com/repos/jdx/aube/releases/assets/485325405" -provenance = "github-attestations" +checksum = "sha256:a1cf4a39253b161f9ae0c39d26acb058c9afdd33c3f1caf3b9384a614e5fec2a" +url = "https://github.com/jdx/aube/releases/download/v1.33.1/aube-v1.33.1-x86_64-unknown-linux-musl.tar.gz" +url_api = "https://api.github.com/repos/jdx/aube/releases/assets/489835066" [tools.aube."platforms.macos-arm64"] -checksum = "sha256:d4c883f6a41f064e587de948645d9128d282b12c3a42eac36920eaf1d63162fe" -url = "https://github.com/jdx/aube/releases/download/v1.32.0/aube-v1.32.0-aarch64-apple-darwin.tar.gz" -url_api = "https://api.github.com/repos/jdx/aube/releases/assets/485361741" -provenance = "github-attestations" +checksum = "sha256:7aa9c39feef648796338ef540fa1af886683d20058691dfb69169fe47aea3d99" +url = "https://github.com/jdx/aube/releases/download/v1.33.1/aube-v1.33.1-aarch64-apple-darwin.tar.gz" +url_api = "https://api.github.com/repos/jdx/aube/releases/assets/489860006" [tools.aube."platforms.windows-x64"] -checksum = "sha256:94fc5c07b56da989f1fafbee24da285ea56451fbb27d9bca27dc558668af4121" -url = "https://github.com/jdx/aube/releases/download/v1.32.0/aube-v1.32.0-x86_64-pc-windows-msvc.zip" -url_api = "https://api.github.com/repos/jdx/aube/releases/assets/485332026" -provenance = "github-attestations" +checksum = "sha256:3f7423b736675ce6d31a4d917ce655bd4c183ce8986fb6ffe9eb6547000e8d38" +url = "https://github.com/jdx/aube/releases/download/v1.33.1/aube-v1.33.1-x86_64-pc-windows-msvc.zip" +url_api = "https://api.github.com/repos/jdx/aube/releases/assets/489840087" [[tools.node]] version = "24.20.0" diff --git a/mise.toml b/mise.toml index 84c5d61..e13e70e 100644 --- a/mise.toml +++ b/mise.toml @@ -3,7 +3,7 @@ enter = "uv sync" [tools] -aube = '1.32.0' +aube = '1.33.1' node = '24.20.0' rumdl = 'latest' @@ -33,37 +33,6 @@ dir = "{{ config_root }}" run = 'pytest --cov --cov-report=html --no-cov-on-fail' -[tasks.build-js] -description = 'Build the packaged Hypergen browser runtime' -dir = "{{ config_root }}" -run = 'aube run build' - - -[tasks.watch-js] -description = 'Watch Hypergen JavaScript source and rebuild the packaged runtime' -dir = "{{ config_root }}" -run = 'aube run watch' - - -[tasks.verify-js] -description = 'Rebuild JavaScript and verify the committed assets are current' -dir = "{{ config_root }}" -run = [ - 'aube run --no-install build', - 'git ls-files --error-unmatch -- src/flask_hypergen/static/hypergen.js src/flask_hypergen/static/hypergen.js.map', - 'git diff --exit-code -- src/flask_hypergen/static/hypergen.js src/flask_hypergen/static/hypergen.js.map', -] - - -[tasks.check-js] -description = 'Verify the frozen JavaScript build is reproducible' -dir = "{{ config_root }}" -run = [ - 'aube ci', - 'mise run verify-js', -] - - [tasks.upgrade-deps] description = 'Upgrade mise, uv, and prek dependencies' dir = "{{ config_root }}" diff --git a/package.json b/package.json index fbd4498..551a202 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "flask-hypergen-client", "private": true, "version": "0.0.0", - "packageManager": "aube@1.32.0", + "packageManager": "aube@1.33.1", "scripts": { "build": "parcel build src/flask_hypergen/static-src/hypergen.js --dist-dir src/flask_hypergen/static --no-cache --no-autoinstall && node tasks/finalize-js-build.mjs", "watch": "parcel watch src/flask_hypergen/static-src/hypergen.js --dist-dir src/flask_hypergen/static --no-autoinstall" diff --git a/prek.toml b/prek.toml index 179ce34..acd8096 100644 --- a/prek.toml +++ b/prek.toml @@ -52,5 +52,5 @@ hooks = [ [[repos]] repo = 'local' hooks = [ - { id = 'verify-generated-javascript', name = 'verify generated javascript', entry = 'mise run verify-js', language = 'system', pass_filenames = false, files = '^(aube-lock\.yaml|aube-workspace\.yaml|mise\.lock|mise\.toml|package\.json|tasks/finalize-js-build\.mjs|src/flask_hypergen/static-src/.*\.js|src/flask_hypergen/static/hypergen\.js(\.map)?)$' }, + { id = 'verify-generated-javascript', name = 'verify generated javascript', entry = 'tasks/js-verify', language = 'system', pass_filenames = false, files = '^(aube-lock\.yaml|aube-workspace\.yaml|mise\.lock|mise\.toml|package\.json|tasks/(finalize-js-build\.mjs|js-(build|check|verify|watch))|src/flask_hypergen/static-src/.*\.js|src/flask_hypergen/static/hypergen\.js(\.map)?)$' }, ] diff --git a/readme.md b/readme.md index c11fc05..ab2f5a0 100644 --- a/readme.md +++ b/readme.md @@ -65,15 +65,18 @@ runtime: ```shell mise install -mise run build-js -mise run watch-js +mise run js-build +mise run js-watch ``` Aube is the project's only JavaScript package installer and script runner. The generated bundle and source map remain committed so Python package users do not need JavaScript tooling. Watch mode produces development output directly in the static directory; run -`mise run build-js` before committing or packaging to apply the production finalization. -Prek automatically rebuilds and checks these assets when related files are committed. +`mise run js-build` before committing or packaging to apply the production finalization. +The JavaScript tasks are executable scripts in `tasks/`, so `tasks/js-build`, +`tasks/js-watch`, `tasks/js-verify`, and `tasks/js-check` can also be called without Mise +when the pinned Node and Aube tools are already on `PATH`. Prek automatically rebuilds and +checks these assets when related files are committed. ### Versions diff --git a/specs/2026-09-06-javascript-source-build.md b/specs/2026-09-06-javascript-source-build.md index 12e5c94..e8d57af 100644 --- a/specs/2026-09-06-javascript-source-build.md +++ b/specs/2026-09-06-javascript-source-build.md @@ -34,7 +34,7 @@ The repository should: - use Aube, never npm, to install JavaScript dependencies and run package scripts - generate the existing packaged `hypergen.js` asset from that source - keep the generated asset committed and included in Python distributions -- provide straightforward build and watch workflows through `mise` +- provide directly executable JavaScript tasks, with convenient aliases through `mise` - make stale generated assets detectable in automated validation @@ -126,12 +126,16 @@ exotic transitive dependencies and trust downgrades. ## Build behavior -Provide project scripts and `mise` tasks for: +Provide executable project tasks, automatically exposed through `mise`, for: - a production build that writes the packaged bundle and source map - a development watch build for client work - a frozen clean install/build suitable for CI +Name the JavaScript tasks with a consistent `js-` prefix: `js-build`, `js-watch`, +`js-verify`, and `js-check`. CI and Prek should call the executable tasks directly so +they do not require the Mise CLI after their required JavaScript tools are provisioned. + The production build must have deterministic output for a fixed source, toolchain, configuration, and lockfile. Running it twice should not change tracked files after the first successful build. @@ -219,7 +223,7 @@ required generated assets, and contributors no longer need to edit minified Java - **Upstream baseline:** Copied `hypergen.js` and `websocket.js` from Django-Hypergen commit `3b8db56302b3f9f881103ca864b6a289cd10b754`, then applied the repository's standard whitespace normalization without changing behavior. -- **Pinned toolchain:** Node 24.20.0 LTS, Aube 1.32.0, and Parcel 2.9.3. +- **Pinned toolchain:** Node 24.20.0 LTS, Aube 1.33.1, and Parcel 2.9.3. - **Dependency graph:** Converted the upstream npm lock through Aube to preserve its transitive versions, then removed the unused `mousetrap` dependency. The committed project lock is Aube-native. @@ -251,7 +255,9 @@ required generated assets, and contributors no longer need to edit minified Java reachable only through the build-time Parcel dependency. Resolving those advisories requires the dependency-upgrade work intentionally excluded from this behavior-preserving migration. -- **Automation:** `mise` exposes build, watch, local artifact-verification, and clean - reproducibility-check tasks. Prek runs the offline artifact check when related files - change. GitHub CI first performs a frozen Aube install and then runs the same check; - both fail on stale, missing, or untracked generated assets. +- **Automation:** Executable `js-build`, `js-watch`, `js-verify`, and `js-check` tasks are + the canonical automation and are also discovered by `mise`. Prek invokes `js-verify` + directly when related files change. The Python-only Prek CI job skips that hook because + it does not provision the JavaScript toolchain; the dedicated JavaScript job installs + only the Node and Aube versions selected by `mise.toml`, then invokes `js-check` + directly. The dedicated job fails on stale, missing, or untracked generated assets. diff --git a/src/flask_hypergen/static/hypergen.js b/src/flask_hypergen/static/hypergen.js index cfd72a5..d288bda 100644 --- a/src/flask_hypergen/static/hypergen.js +++ b/src/flask_hypergen/static/hypergen.js @@ -1,4 +1,4 @@ -/*! @generated from src/flask_hypergen/static-src; run mise run build-js. */ +/*! @generated from src/flask_hypergen/static-src; run tasks/js-build. */ (()=>{function e(e,t,n,o){Object.defineProperty(e,t,{get:n,set:o,enumerable:!0,configurable:!0})}var t,n,o={};e(o,"morph",()=>b),e(o,"remove",()=>w),e(o,"hide",()=>N),e(o,"display",()=>C),e(o,"visible",()=>T),e(o,"hidden",()=>S),e(o,"redirect",()=>A),e(o,"append",()=>I),e(o,"prepend",()=>k),e(o,"setClientState",()=>O),e(o,"intervalSet",()=>R),e(o,"applyCommands",()=>z),e(o,"intervalClear",()=>B),e(o,"addEventListener",()=>x),e(o,"callback",()=>W),e(o,"keypressToCallback",()=>H),e(o,"keypressToCallbackRemove",()=>P),e(o,"throttle",()=>V),e(o,"partialLoad",()=>X),e(o,"onpushstate",()=>ea),e(o,"cancelThrottle",()=>G),e(o,"event",()=>K),e(o,"coerce",()=>Z),e(o,"read",()=>ee),e(o,"when",()=>et),e(o,"element",()=>en),e(o,"reviver",()=>eo),e(o,"ready",()=>ed);var r="undefined"==typeof document?void 0:document,l=!!r&&"content"in r.createElement("template"),i=!!r&&r.createRange&&"createContextualFragment"in r.createRange();/** * Returns true if two node's names are the same. * diff --git a/tasks/finalize-js-build.mjs b/tasks/finalize-js-build.mjs index 369f8e2..5eb6365 100644 --- a/tasks/finalize-js-build.mjs +++ b/tasks/finalize-js-build.mjs @@ -9,7 +9,7 @@ const sourceMapPath = new URL( import.meta.url, ) const generatedHeader = - '/*! @generated from src/flask_hypergen/static-src; run mise run build-js. */\n' + '/*! @generated from src/flask_hypergen/static-src; run tasks/js-build. */\n' const sourceMapReference = '//# sourceMappingURL=hypergen.js.map' let bundle = await readFile(bundlePath, 'utf8') diff --git a/tasks/js-build b/tasks/js-build new file mode 100755 index 0000000..1dff65c --- /dev/null +++ b/tasks/js-build @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# [MISE] description="Build the packaged Hypergen browser runtime" +set -euo pipefail + +repo_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$repo_root" + +exec aube run build diff --git a/tasks/js-check b/tasks/js-check new file mode 100755 index 0000000..caf6403 --- /dev/null +++ b/tasks/js-check @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# [MISE] description="Verify the frozen JavaScript build is reproducible" +set -euo pipefail + +repo_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$repo_root" + +aube ci +exec tasks/js-verify diff --git a/tasks/js-verify b/tasks/js-verify new file mode 100755 index 0000000..70fbcd5 --- /dev/null +++ b/tasks/js-verify @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# [MISE] description="Rebuild JavaScript and verify the committed assets are current" +set -euo pipefail + +repo_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$repo_root" + +aube run --no-install build +git ls-files --error-unmatch -- \ + src/flask_hypergen/static/hypergen.js \ + src/flask_hypergen/static/hypergen.js.map +git diff --exit-code -- \ + src/flask_hypergen/static/hypergen.js \ + src/flask_hypergen/static/hypergen.js.map diff --git a/tasks/js-watch b/tasks/js-watch new file mode 100755 index 0000000..4b9e1ec --- /dev/null +++ b/tasks/js-watch @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# [MISE] description="Watch Hypergen JavaScript source and rebuild the packaged runtime" +set -euo pipefail + +repo_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$repo_root" + +exec aube run watch