Releasing a 2.8.x Patch
A release of v2 reaches people in four forms, all made from one tagged commit:
- the npm package
@monogatari/core, for games built with a bundler; - the starter game,
https://storage.monogatari.io/releases/monogatari-v<version>.zip: thedist/folder at the tag, zipped flat, which is what most people download; - the GitHub release for the tag, with the same zip attached and short notes;
- the docs, published as the
v2feed of monogatari.io.
This page goes through a release (2.9.0 to 2.9.1, say) in the order it’s made. Each step was run up to the point where it publishes something; the commands that publish are marked.
NOTE
A release needs accounts this page can't give you: an npm account allowed to publish @monogatari/core, write access to the GitHub repository, the keys of the storage.monogatari.io bucket, and a restless-dreams token for the monogatari site. Everything before the publishing commands works without them.
The release at a glance
The version
The engine’s version is the version field of the root package.json, and nothing else holds it: src/monogatari.ts imports it (import { version } from '../package.json') into Monogatari.version, so the build writes it into dist/engine/core/monogatari.js and lib/monogatari.module.js. A release that only fixes bugs without changing what a game sees raises the last number (2.9.0 becomes 2.9.1); one that changes behaviour games can notice, or adds to the API, raises the middle one and resets the last, as 2.9.0 did after 2.8.1.
These versions are not the engine’s, and a release leaves them alone:
dist/package.json’sversion(0.1.0) and theVersionsetting indist/js/options.jsbelong to the sample game; a game developer sets them for their own game.VERSIONindist/service-worker.js(0.1.1) names the sample game’s offline cache.version: '1.0.0'indebug/index.jsis the debug module’s own.
Build and check the release commit
On an up-to-date develop, with node_modules matching bun.lock:
git switch develop
git pull
bun installSet the version in package.json, then build and look at what changed:
bun run build
git status --shortDone at the v2.8.1 tag with the version set to 2.8.2, it lists exactly these files:
M dist/engine/core/monogatari.js
M dist/engine/core/monogatari.js.map
M lib/monogatari.module.js
M lib/monogatari.module.js.map
M package.jsonThe bundles changed because they contain the version. Anything else in the list means a change on develop was merged without its rebuilt files: commit those on their own first, with a message that says so, then build again.
Run every spec, in a browser close to what players use:
bunx cypress run --browser chromiumA release shouldn’t add failures: the whole suite passes on develop since 2.9.0. A test that fails for a reason unrelated to your change, such as the test-asset host being slow to answer, passes when you run its spec again on its own (Known failures).
Then commit the release on its own:
git add package.json dist/engine/core lib
git commit -m "Release 2.9.1"Tag it
Merge the release into master, which holds the latest release, and tag the commit. Earlier releases use lightweight tags named v<version>:
git switch master
git merge --ff-only develop
git tag v2.9.1
git push origin develop master v2.9.1Tag the commit you’ll publish, and don’t amend it afterwards. npm records the commit a package was packed from as gitHead: the 2.8.1 package names b14ca639…, a commit that isn’t in the repository because the release commit was amended after publishing, and the 2.8.0 package names f6bf8beb, one commit before the v2.8.0 tag (89045f59, which only rebuilt the source maps). npm view @monogatari/core@2.8.1 gitHead shows it.
The npm package
The package has no prepack script: npm pack and npm publish pack the files on disk without building. So pack from the tagged commit, right after the build above, and read what goes in:
npm pack --dry-runIt lists every file, then the summary. At 2.9.0:
npm notice Tarball Details
npm notice name: @monogatari/core
npm notice version: 2.9.0
npm notice filename: monogatari-core-2.9.0.tgz
npm notice package size: 5.4 MB
npm notice unpacked size: 20.1 MB
npm notice shasum: …
npm notice integrity: …
npm notice total files: 552Read the list, not only the count. files names each file and folder of the starter game (Building and Packaging), so a dist/node_modules/ or dist/build/ from desktop work, or a zip, stays out; a new file in the starter game is left out too, until it’s added to files. Until 2.9.0 files took everything in dist/: the 2.8.1 package on npm has 540 files, the extra one being dist/monogatari-v2.8.0.zip, the previous release’s zip, made inside dist/ and left there. The 2.8.0 package had no lib/ and no declarations, which the list would also have shown.
npm publish --dry-run shows where it would go: Publishing to https://registry.npmjs.org/ with tag latest and default access (dry-run), then + @monogatari/core@2.9.1. Then, logged in with an account that can publish the package:
npm publish # publishes
npm view @monogatari/core dist-tagslatest now names the new version, and bun add @monogatari/core or npm install @monogatari/core gets it.
The starter game
Make the zip
The download is the dist/ folder at the tag, with no top folder: unzipped, its files land straight in the folder the player chose. Make it with git archive, outside the repository, so only committed files go in and nothing lands in dist/:
mkdir -p /tmp/monogatari-release
git archive --format=zip -o /tmp/monogatari-release/monogatari-v2.9.1.zip v2.9.1:distv2.9.1:dist names the dist/ tree at the tag, so paths in the zip start at index.html, js/, assets/… Made from v2.8.1, this command gives a zip with the same 417 entries as the published monogatari-v2.8.1.zip (2.9.0’s has 427), and unzipped, diff -r finds no difference between the two (stage 7 of the learning path does the comparison).
The zip holds the whole folder: types/, the desktop hosts, serve.ts, build-web.ts, bun.lock, the source map. That’s what 2.8.0 and 2.8.1 shipped.
Check it like a player
Unzip it into an empty folder, serve it (python3 -m http.server 8080 in that folder), open it, and play the sample story to the end: the main menu, the name input, a choice, a save and a load. Then type monogatari.version in the console: it must print the new version.
Upload it
Upload the zip to the releases/ folder of the storage.monogatari.io bucket, with the bucket’s own tools and credentials (publishes). Then check it’s served:
curl -sSI https://storage.monogatari.io/releases/monogatari-v2.9.1.zipIt answers HTTP/2 200 with content-type: application/zip. Keep the older zips, so links to them keep working.
The GitHub release
Create a release for the tag on GitHub (publishes), named Monogatari v2.9.1, with the zip attached. The 2.8.1 release’s notes are two sentences, one per fix, and a link to a longer release post; write them from the pull requests the release includes, for game developers: what they’ll notice, and anything they have to do.
The docs
The docs name the version in the download link (the Start Here pages link https://storage.monogatari.io/releases/monogatari-v2.9.0.zip) and in a few statements of fact. Find them, update them in a docs commit, and publish (Writing and Publishing the Docs):
grep -rln "2\.8\.1" docs
restless-dreams docs lint docs
restless-dreams docs publish docs --feed v2 --version-group monogatari-docs --dry-run
restless-dreams docs publish docs --feed v2 --version-group monogatari-docs # publishesNot every match is the current version: the maintainer pages describe 2.8.1’s history and its known failures. Update what describes the current release, and leave history as history.
The checklist
develophas every fix, each with its spec and rebuilt files.package.jsonhas the new version.bun run build;git statuslists onlypackage.jsonand the four bundle files.- Every Cypress spec passes, except failures known before the release.
- Commit “Release 2.8.x”, fast-forward
master, tagv2.8.x, push the branches and the tag. npm pack --dry-run: read the list; nothing fromdist/node_modules,dist/buildor a zip.npm publish;npm view @monogatari/core dist-tagsshows the newlatest.git archive --format=zip -o /tmp/monogatari-release/monogatari-v2.8.x.zip v2.8.x:dist; unzip it, serve it, play it, checkmonogatari.version.- Upload the zip to
storage.monogatari.io/releases/;curl -Iit. - GitHub release for the tag, with the zip and the notes.
- Docs: the version in the download links, lint, publish.