Skip to content

Commit d0acdd5

Browse files
committed
Pin h5p-author 0.9.8, check the tool's --version, and name Node.js 22 for offline builds
The archive now carries 0.9.8's one-file tool, whose --version prints the versions instead of crashing; the site's build runs it and stops unless it prints the pinned author and pack versions. The guide's offline paragraph says Node.js 22 or later, which the tool needs. From cubic's review of #48.
1 parent 8cf0599 commit d0acdd5

4 files changed

Lines changed: 16 additions & 9 deletions

File tree

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@codemirror/state": "6.7.6",
2929
"@codemirror/view": "6.43.15",
3030
"@lezer/highlight": "1.2.5",
31-
"@missing-elements/h5p-author": "0.9.7",
31+
"@missing-elements/h5p-author": "0.9.8",
3232
"@missing-elements/h5p-libraries": "1.1.0",
3333
"@missing-elements/h5p-offline-player": "1.6.0",
3434
"@missing-elements/h5p-runtime": "1.0.1",

‎pnpm-lock.yaml‎

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/h5p/create-with-ai/index.njk‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ csp: "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self'; o
269269
needs.
270270
</p>
271271
<p>
272-
With Node.js on your own computer, the whole build can stay offline. Install the skill in an
273-
agent with a terminal that runs a local model, from Ollama or LM Studio, and download
272+
With Node.js 22 or later on your own computer, the whole build can stay offline. Install the
273+
skill in an agent with a terminal that runs a local model, from Ollama or LM Studio, and download
274274
<a href="/h5p/bundles/h5p-author-build.tar.gz" download>h5p-author-build.tar.gz</a> once.
275275
Then tell the agent where the archive is. It builds the <code>.h5p</code> file on your
276276
computer, with no internet and nothing sent anywhere.

‎vite.config.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { execFileSync } from 'node:child_process'
12
import { readdirSync, readFileSync } from 'node:fs'
23
import { copyFile, mkdir, readFile, rm, writeFile } from 'node:fs/promises'
34
import { basename, join, resolve } from 'node:path'
@@ -153,7 +154,9 @@ function sample(): Plugin {
153154
* so a build whose text calls for one stops and names its part, which the chat fetches from here.
154155
* - `h5p-author.mjs`: the command line as one file, everything it imports bundled in by Vite, so it
155156
* runs with nothing installed. It takes `--libraries`: the npm package's pinned pack is not with
156-
* it, nor the package.json `--version` reads, so `index.json` says the versions.
157+
* it. Since 0.9.8 its `--version` prints the versions from copies of the two package.json files
158+
* Vite writes in (h5p-offline-player#198); before, it crashed, finding neither beside it. The
159+
* build runs it and stops where it does not print the versions `index.json` says.
157160
* - `index.json`: the author's and the pack's versions, and each bundle's file, size and parts.
158161
* - `libraries.txt`: the pack's licence list, which asks to travel with its libraries.
159162
*
@@ -196,6 +199,10 @@ function bundles(): Plugin {
196199
},
197200
ssr: { noExternal: true, target: 'node' }
198201
})
202+
// The tool says its own versions, as a model checking it first asks: those this site pins.
203+
const expected = `@missing-elements/h5p-author ${await version(author)}, library pack ${await version(libraries)}`
204+
const printed = execFileSync(process.execPath, [join(folder, 'h5p-author.mjs'), '--version'], { encoding: 'utf8' }).trim()
205+
if (printed !== expected) throw new Error(`h5p-author.mjs --version printed "${printed}", not "${expected}"`)
199206
// The archive lays them out as a build from the bundles does: `tar -xzf`, then `--libraries parts`.
200207
const archive = tarGz([
201208
['h5p-author.mjs', await readFile(join(folder, 'h5p-author.mjs'))],

0 commit comments

Comments
 (0)