Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/nox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
44 changes: 19 additions & 25 deletions mise.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 1 addition & 32 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ enter = "uv sync"


[tools]
aube = '1.32.0'
aube = '1.33.1'
node = '24.20.0'
rumdl = 'latest'

Expand Down Expand Up @@ -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 }}"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion prek.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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)?)$' },
]
11 changes: 7 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 13 additions & 7 deletions specs/2026-09-06-javascript-source-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
2 changes: 1 addition & 1 deletion src/flask_hypergen/static/hypergen.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tasks/finalize-js-build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
8 changes: 8 additions & 0 deletions tasks/js-build
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions tasks/js-check
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions tasks/js-verify
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions tasks/js-watch
Original file line number Diff line number Diff line change
@@ -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
Loading