fix(build): copy the language files into the demo again - #506
Merged
Merged
Conversation
Since @draggable/formeo-languages 3.5.1 the package ships its files in dist/lang/lang/. copy-assets globbed dist/lang/*, matched only the lang directory, and fs.copyFile threw EISDIR. The catch logged the error and carried on, so npm run build exited 0 and the 2026-08-08 gh-pages deploy removed all 48 files from assets/lang. That URL is the editor's default i18n.location, so every non-English locale 404s on the default config. Copy language files at any depth, flat by basename, skipping directories. A failed copy now sets a non-zero exit code, failing the build. Publish and Deploy check that en-US.lang and de-DE.lang are in the demo build before releasing or deploying. A unit test runs the copy helper against a temp dir and the installed package.
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Empty source matches can still allow an incomplete demo build to deploy.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Restores demo language asset copying after the package layout changed.
Changes:
- Recursively copies language files flat by basename.
- Adds copy-helper tests and propagates copy failures.
- Validates required language files in publish and deploy workflows.
| File | Summary |
|---|---|
tools/copy-assets.mjs |
Updates recursive asset copying and failure handling; empty matches can still report success. |
src/lib/js/copy-assets.test.mjs |
Adds tests for copy behavior and error handling. |
.github/workflows/publish.yaml |
Verifies language files before publishing. |
.github/workflows/deploy.yaml |
Verifies language files before deployment. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
39
to
46
| async function copyFile(src, dest, rename = null) { | ||
| for await (const file of fs.glob(src)) { | ||
| if ((await fs.stat(file)).isDirectory()) continue | ||
| const destPath = rename ? join(dest, rename) : join(dest, basename(file)) | ||
| await fs.mkdir(dirname(destPath), { recursive: true }) | ||
| await fs.copyFile(file, destPath) | ||
| } | ||
| } |
Collaborator
Author
|
🎉 This PR is included in version 5.9.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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
The deployed demo at https://draggable.github.io/formeo/assets/lang/ has no language files. That URL is the editor's default
i18n.location, so every non-English locale 404s for every Formeo install on the default config, whatever its version.Since
@draggable/formeo-languages3.5.1, the package ships its files indist/lang/lang/.tools/copy-assets.mjsglobbeddist/lang/*, so it matched only thelangdirectory andfs.copyFilethrewEISDIR. The catch logged the error and carried on, sonpm run buildstill exited 0. The gh-pages deploy on 2026-08-08 then removed all 48 files fromassets/lang.Changes
tools/copy-assets.mjs:dist/*.jsstill leaves out the.cjsbuilds)src/lib/js/copy-assets.test.mjs: unit tests for the copy helper, run against a temp dir and the installed packagepublish.yamlanddeploy.yaml: after the build, check thaten-US.langandde-DE.langare indist/demo/assets/langbefore releasing or deployingVerification
npm run buildexits 0 with no "Error copying" line (before: oneEISDIRline)dist/demo/assets/langhas 48 files (24.lang+ 24.json) and no subdirectory (before: 0 files)dist/demo/assets/jshas the same files as beforenpm test576/576,npm run lintclean,test:dist5/5, Playwright 149 passed (3 skipped bytest.skipin the suite)Once merged, the release's deploy puts the language files back on gh-pages.