Repository navigation
build: emit font assets without a parent-traversal assetNames - #16
Merged
Merged
Conversation
The bundled CSS step used outfile plus assetNames: '../webfonts/[name]' to
place Font Awesome fonts in static/webfonts/. That works on macOS and Linux
but emitted nothing on the Windows CI runner, so static/webfonts/ was never
created and the backend's go:embed directive failed:
main.go:53:29: pattern web/static/webfonts: no matching files found
Resolve asset paths relative to an outdir instead, which is the documented
way and does not depend on parent traversal:
entryPoints: { 'css/style.min': 'static/css/style.css' }
outdir: 'static'
assetNames: 'webfonts/[name]'
Output is identical: fonts land in static/webfonts/, CSS in
static/css/style.min.css, and the generated url() values are
'../webfonts/...' as before, which the browser resolves to
/static/webfonts/. Non-CSS builds keep the outfile form.
Verified on macOS: all four woff2 files are emitted to static/webfonts/,
style.min.css is byte-comparable in structure to the previous output, and
the backend then passes go vet and go build. The Windows path cannot be
exercised locally, so CI is the real test.
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.
Fixes the last thing keeping the backend's Windows CI red, and it is a real cross-platform build bug rather than a CI quirk.
Problem
The bundled CSS step used
outfileplus a parent-traversal asset name:That emits Font Awesome's fonts to
static/webfonts/on macOS and Linux, but nothing at all on the Windows runner.static/webfonts/was therefore never created, and the backend failed with:The error points at Go and at a
go:embeddirective, which is why it was worth chasing to the actual cause: the frontend build silently produced no font files on one platform.Worth noting what was ruled out first:
bun.lockwas gitignored, so CI pulled Font Awesome 7.3.1 instead of 7.2.0; 7.3.1 droppedwebfonts/). Fixed by committing the lockfile. After that fix the Windows log confirmed@fortawesome/fontawesome-free@7.2.0installed correctly — andwebfonts/was still missing, which is what pointed here.node_modules. The fonts are present after install on every platform.path.win32.resolvecomputes the right target.Fix
Resolve asset paths relative to an
outdirinstead of traversing out of anoutfile— the documented approach, with no parent traversal:Non-CSS builds keep the simple
outfileform.Output is unchanged
static/webfonts/(all four woff2 files)static/css/style.min.cssurl()values are../webfonts/..., exactly as before, which the browser resolves to/static/webfonts/Verified on macOS: clean build emits all four fonts,
style.min.cssis structurally identical, and the backend then passesgo vet ./...andgo build.Honest limitation
I cannot exercise the Windows path locally. This change removes the construct that failed there (parent traversal in
assetNames), and the output shape is the documented one, but CI on the backend Windows job is the real test. If it still fails, the next step is to check whether the asset is emitted under a differently-cased or differently-separated path on that runner rather than to guess again.Merge note
This is a prerequisite for
telecloud-go#52(backend CI), which bumps theweb/submodule. Merge order: this PR → then the backend PR picks up a pointer containing both the lockfile and this fix.