Repository navigation
feat(author): build the one-file tool in the package, not on the organisation's site - #250
Merged
Merged
Conversation
…nisation's site (#247) prepack runs scripts/build-tool.mjs: Vite bundles the command line and everything it imports into dist/h5p-author.mjs, with dist/h5p-author-LICENSES.txt, as the site's own build did, and checks its --version. The npm package then covers the bytes route 3 runs, with its provenance once publishing moves to CI, and the site serves them as shipped.
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 9 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
…e site serves when (#247) The two dist files are exported by their paths, and a test resolves them by the package's name. Packing on Node before 22.12 stops with a message before Vite fails to load; engines stays >=22, since installing runs none of it. The design, the README and the comments no longer say the site serves the shipped file already: its pin copies it from the first release that ships it.
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.
Closes #247.
Route 3 runs
h5p-author.mjs, the command line as one file. Until now the organisation's site built that file with its own Vite when it built itself. So the site's build tools and their Dependabot updates were in the path of every byte a chat runs, and nothing published covered the file. With this PR, the author package builds the file and ships it, so the npm package covers it, and its provenance will once #246 is in. From the first release that ships it, the site's pin copies it instead of building it.What changes
scripts/build-tool.mjsbuildsdist/h5p-author.mjsanddist/h5p-author-LICENSES.txt. Its Vite build is the site's, unchanged: a server-side build ofbin/h5p-author.mjs, everything bundled in, not minified, one file, with Vite's licence list. It then checks that the tool's--versionnames this package's version and its pack's.node scripts/build-tool.mjs <folder>writes the two files elsewhere.package.json:build:toolbuilds the player's plan, which the tool imports, then runs the script.prepackends with it.filesgainsdist.exportsnames the two files,./dist/h5p-author.mjsand./dist/h5p-author-LICENSES.txt, so they resolve by the package's name.enginesstays>=22, since installing it runs none of this, and raising it would make an unversionednpxon Node 22.0 to 22.11 quietly install an older release.ownVersionandpackVersionno longer say the site builds the file.design/author.mdhas a new rule with its reason: when the site switches, why packing needs Node 22.12 whileenginesstays, and why the skill names no hash of the file.design/layout.mdname the two files and the script.Tested
The new test builds the tool into a temporary folder, unzips a Question Set bundle where no
package.jsonis above and nothing is installed, as a chat's sandbox has it, and checks two things:--libraries parts.It also checks that the licence list names zip.js under BSD-3-Clause, and resolves both files by the package's name through
exports.Suites:
pnpm typecheckand the author's node suite (266 tests) pass.The packed package:
pnpm packranprepackthrough to the tool. The tarball holds the two files (94 entries, 383 kB packed), and its tool, extracted alone, prints@missing-elements/h5p-author 0.13.0, library pack 1.1.0.Sizes: the tool is 756 kB, 213 kB gzipped. The package grows from 0.60 MB unpacked to about 1.36 MB.
After the next release
The site's pin PR replaces its Vite build of the tool (
bundles()invite.config.ts) with a copy of the two files fromnode_modules/@missing-elements/h5p-author/dist/, and keeps its--versioncheck. Until then it builds the tool as before, from 0.13.0, which does not ship it.Summary by cubic
Closes #247. The author package now builds the one-file command-line tool and ships it in
dist/, so the npm package covers the bytes route 3 runs and the organisation's site will serve the file as shipped instead of building it with its own Vite.scripts/build-tool.mjsbundles the command line and everything it imports intodist/h5p-author.mjs, writesdist/h5p-author-LICENSES.txtbeside it, and checks that--versionnames this package's and its pack's versions;prepackruns it.enginesstays>=22since installing runs none of this.Migration
After the next release, the site's pin PR replaces its Vite build of the tool with a copy of the two files from
node_modules/@missing-elements/h5p-author/dist/and keeps its--versioncheck; until then it builds from 0.13.0, which does not ship them.Written for commit 4c36491. Summary will update on new commits.