Serve the build tool and a library bundle per content type at /bundles/

Merged
AL
21h ago
+195-10

Closes #14.

The h5p-author skill, as of author 0.6.0 (missing-elements/h5p-offline-player#166), builds where npm is unreachable from two files fetched from this site: the build tool, and the bundle of the source's content type. ChatGPT's sandbox runs Node and its download tool takes a file the browsing tool has opened, so the chat builds, sees every problem itself, fixes its source and hands over the package. The build page stays for a chat that can fetch nothing.

What /bundles/ serves

PathWhat it holds
/bundles/<type>.zipOne per content type in the pack, 55 with pack 1.1.0: parts/, the pack's whole index with the parts a build of that type can read, and libraries.txt. Written by writeBundles, which is h5p-author bundle --all
/bundles/parts/<part>.h5pEvery part of the pack under its own name, and its index. No bundle holds an addon: a source with math stops the build, which names H5P.MathDisplay-1.0.h5p to fetch from here
/bundles/h5p-author.mjsThe command line as one file (575 kB), everything it imports bundled in by Vite's own SSR build (Rolldown; no esbuild added), so it runs with nothing installed. It takes --libraries; --version does not work in it, so index.json carries the versions
/bundles/index.jsonThe author's and the pack's versions, and each bundle's file, size and parts
/bundles/libraries.txtThe pack's licence list

A bundles() plugin in vite.config.ts writes them after the pages, from the packages the lockfile pins, so a Dependabot update of h5p-author or h5p-libraries moves them. They are in dist/ only: 113 MB (the site 136 MB), within GitHub Pages' 1 GB; the build takes about two seconds longer. @missing-elements/h5p-author moves to ^0.6.0, for writeBundles.

Tested

e2e/bundles.spec.ts, through the preview server, as a chat would:

  • index.json lists the bundles, and each is served at its listed size; every part in parts/index.json is served; the licences and the tool are there.
  • The tool and H5P.QuestionSet.zip are fetched into an empty folder outside the project, so nothing installed is found, then unzipped with unzip, and a quiz is built with node h5p-author.mjs build … --libraries parts. A source with $$3^2$$ then stops, the part is read from the build's own message, fetched from /bundles/parts/, and the build succeeds.

The whole suite passes locally, 13 tests, typecheck clean.

After merge

The deploy publishes /bundles/, and the skill's step 3 starts finding its files; until then it falls back to the build page's link. Then the check only ChatGPT can do: the download tool on a zip from github.io, unzip or python3 -m zipfile, Node 22.16 running the tool.


Summary by cubic

Closes #14. Serves the h5p-author build tool and a library bundle per content type at /bundles/, so an AI chat that runs Node and fetches files but reaches no npm registry can build H5P packages itself. The build page stays for a chat that can fetch nothing.

What /bundles/ serves

  • A zip per content type, every library part individually under parts/ for addons a build names, index.json, and libraries.txt.
  • h5p-author.mjs, the command line bundled into a single file by Vite so it runs with nothing installed.
  • Bundles are written into dist/ only (113 MB), from the lockfile-pinned packages, so a Dependabot update of @missing-elements/h5p-author or @missing-elements/h5p-libraries moves them.

Testing

  • e2e fetches the tool and a bundle into an empty folder and builds a quiz with Node alone, then fetches the math addon the failed build names.
  • @missing-elements/h5p-author moves to ^0.6.0 for writeBundles; the build takes about two seconds longer.