Repository navigation
fix: fail the build with instructions when compiled front-end assets are missing - #404
Merged
Merged
Conversation
…are missing output.css and editor.bundle.js are generated by npm and gitignored, so builds from git clones and source tarballs (e.g. the Arch package) ship binaries whose web UI renders unstyled pages - rust-embed silently embeds nothing when the files are absent. A build.rs guard now fails compilation with instructions to run the npm builds (or install from crates.io, whose package ships the assets prebuilt). Also reorders the Playwright CI job to build CSS/JS before cargo build, ships build.rs in the crates.io package, and documents npm run build-js in the README build-from-source steps. Closes #233
ReviewReviewed the diff ( Verified correct:
Minor/non-blocking observations:
Security: No concerns — the script only does local path existence checks and printing; no untrusted input, no shell invocation. Performance: Negligible — two Nice fix — good root-cause diagnosis (rust-embed silently embedding nothing rather than failing) and the error message is genuinely actionable for someone hitting this from a fresh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (#233)
static/css/output.cssandstatic/js/editor.bundle.jsare generated by npm and gitignored. rust-embed does not fail when files are absent fromstatic/— it silently embeds nothing — so any build from git source produces a binary whose web UI (cook server,cook build web) renders unstyled pages:pacman -S cookclibuilds from the GitHub tag tarball, which never contains gitignored files (verified:v0.32.1.tar.gzhas neither asset).cargo buildwithout the npm steps reproduces it on current main (the "fresh cargo build today" report).Fix
A
build.rsguard fails compilation with actionable instructions when either asset is missing:The
cargo:rerun-if-changedlines also mean editing/creating the compiled assets correctly triggers a rebuild of the embedded files.Also:
npm run build-css/build-jsbeforecargo build(the only CI spot that built cargo first)./build.rsto theincludelist so the published crate carries it (verified viacargo package --list).npm run build-jsin the README build-from-source steps.Verification
cargo checkfails with the message above.cargo fmt,cargo clippy --all-targets --all-features(no warnings),cargo test(all pass).Closes #233