Repository navigation
h5p-author: a library bundle per content type, for a build where npm is unreachable - #167
Merged
Merged
Conversation
…m is unreachable `h5p-author bundle <type> <out.zip>` writes the parts a build of one content type can read: what the type can hold, as the build's own rules plan it (planPack, installClosure), with the pack's whole index and its licence list, and no addon. `bundle --all <folder>` writes one per content type. Where npx cannot install, as in ChatGPT's sandbox, the skill builds from a type's bundle and the command line as one file, served by embed-my.github.io (embed-my/embed-my.github.io#14), and falls back to the build page's link. Closes #166
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 11 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
…s the source's own type A later content type that failed left the bundles before it in the folder, and running the command again then refused them: those this call wrote are now taken away again. The skill's step 3 wrote H5P.QuestionSet.zip as if every source were a quiz; it now writes <type>, the source's own, since another type's bundle lacks what this one needs. The README's and the design note's "stops naming the part" now say the build stops and names it.
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 5 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
…l made The rollback removed each earlier bundle by its name, so a file another process had put at that name since was taken away with them. Each bundle's device and inode are now recorded as it is created, and the rollback, like a single bundle's own cleanup, removes a name only while it still holds that file.
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 #166.
Where
npxcannot install, as in ChatGPT's sandbox, the h5p-author skill handed the user a link to the build page and left the rest to them. ChatGPT's sandbox runs Node and can download a file its browsing tool has opened, so with the libraries and the build tool as files the chat builds, and fixes its own source, itself. The skill chooses the content type first, so the files come one bundle per type.What changes
bundleLibraries(pack, type)(./core): the parts a build of one content type can read, whatever its source holds. It applies the build's own rules to the most a source of the type can name: the type and every library its library fields offer or default to, recursively; thenplanPack, the player's plan, over all of them as roots, as the build plans one package; theninstallClosureover that. Both rules only ever add for more roots, so any one source's libraries are within.contentTypes(pack)lists the pack's content types, andschemaOfnow uses it for its unknown-name message.h5p-author bundle <type> <out.zip>andbundle --all <folder>(writeBundle,writeBundles): a zip ofparts/, the parts folderbuild --libraries partsreads, pluslibraries.txt. The output is the same bytes every time (fixed entry dates), never written over an existing file, and refused for a pack with no licence list beside its parts.--allwrites every bundle or none: one that fails takes those written before it away again, each only while its name still holds the file this call made, so a file another process has put there since stays.The parts folder … has no H5P.MathDisplay-1.0.h5p, which this build needs: add it from the library pack's parts/.https://embed-my.github.io/bundles/h5p-author.mjsand…/bundles/<type>.zip, unzip, thennode h5p-author.mjs build source.json course.h5p --libraries parts. A missing part comes from…/bundles/parts/. The package is handed over unverified, with the build page's link for the user to play it. The link stays the fallback where nothing can be fetched.Where it differs from the issue
--allwrites every content type in the pack, 55 of them, not only the types with a layout or a type file. A chat may build any of them.Checked
tests/bundle.test.tscovers: Question Set's bundle holds every question it offers and its editor libraries; every content type's bundle is complete for the upload check (missingForInstallempty) and holds no addon; a bundle builds what the pack builds; the math source stops at MathDisplay, then builds with it; the byte-identical rewrite; a failed--allleaves nothing behind (and fails on the first commit's code, with 32 zips left); a rollback spares a file another process has replaced (and fails with the guard taken out); the refusals; and the command.node_modulesanywhere.Order
The skill's new step points at files embed-my#14 will serve. Until then a download fails and the skill falls back to the build page's link, as today. After merge: release author 0.6.0, then embed-my#14 deploys the bundles, then a test in ChatGPT (the three checks listed in #166).
Summary by cubic
Adds a
bundlecommand toh5p-authorso a build can run where npm is unreachable, as in ChatGPT's sandbox (#166). The skill now fetches the build tool and a content type's bundle and builds from them, with the build page's link as the fallback.What changed
h5p-author bundle <type> <out.zip>(andbundle --all <folder>, one per content type) writes a zip ofparts/, buildable with--libraries parts, plus the pack's wholeindex.jsonandlibraries.txt; it never writes over an existing file, and a failed--allrolls back only the files this call made, leaving a file another process has put at a name since.bundleLibrariesapplies the build's own rules — the type's library fields, the player'splanPack,installClosure— to everything a source of the type can name.parts/.Deployment depends on embed-my.github.io serving the bundles (embed-my/embed-my.github.io#14); until then the download fails and the skill falls back to today's behavior.
Written for commit c480fc2. Summary will update on new commits.