Build and Release
Keeping the code Lua 5.1 compatible for the web build, and running scripts/release.sh to package Mac, Windows, web and .love builds and push them to itch.io.
One script, scripts/release.sh, does the whole release: it regenerates the marketing art, builds the .love, packages Mac and Windows from the official LÖVE 11.5 runtime with the generated icon baked in, builds the web version with love.js and a favicon, pushes every channel to itch.io with butler, then prints the page images you still have to upload by hand. Before any of that matters, the code has to parse under Lua 5.1, because the web build does not run on LuaJIT.
Lua 5.1 compatibility
Desktop LÖVE runs LuaJIT, but love.js runs the game on PUC Lua 5.1. Game and engine code must stay within the subset both accept:
- no
gotoor::label:: - no
ffi,jitorbitmodules outsideengine/dev - no
table.pack,table.unpackormath.tointeger - no
\zor\xstring escapes
Three layers enforce this:
| Layer | What it does |
|---|---|
.luarc.json |
Sets Lua.runtime.version to Lua 5.1, so LuaLS flags the constructs above as syntax errors in the editor. |
scripts/lint-lua51.sh [files...] |
Parses files with a real luac 5.1 (luac -p, no execution). With no arguments it checks every tracked .lua file (git ls-files '*.lua'). |
.githooks/pre-commit |
Runs the lint over staged .lua files and blocks the commit on a parse error. Enable it once per clone with git config core.hooksPath .githooks. |
Homebrew no longer ships lua@5.1, so on first run scripts/lint-lua51.sh downloads the official Lua 5.1.5 tarball and builds it into ~/.cache/love-release/ (override the location with LOVE_RELEASE_CACHE). scripts/release.sh also runs the lint over the exact files inside the built .love, so the web build cannot ship something only LuaJIT accepts.
scripts/lint-lua51.sh # every tracked .lua file
scripts/lint-lua51.sh engine/ui/UIBox.lua # specific files
git config core.hooksPath .githooks # enable the pre-commit hook
Prerequisites
scripts/release.sh checks for each of these at the start and exits if one is missing.
| Tool | Where it comes from | Used for |
|---|---|---|
love |
/Applications/love.app/Contents/MacOS/love (the LOVE variable) |
love . --export-assets; the script also prepends its directory to PATH for love-release |
love-release |
Installed separately | Building the .love with its exclude list |
love.js |
Installed separately | The web build |
butler |
https://itch.io/docs/butler/ (the Homebrew butler cask is an unrelated app) |
Pushing channels to itch.io; run butler login once in a real terminal |
node, npm |
Node.js | scripts/patch-win-icon.mjs, with dependencies from scripts/package.json (pe-library, png-to-ico, resedit) |
iconutil, sips, plutil, codesign |
macOS | .icns creation, icon resizing, Info.plist edits, ad-hoc signing |
zip, unzip, curl, perl |
macOS | Packaging, fetching runtimes, {{TITLE}} substitution |
Configuring the script
Fill in the variables at the top of scripts/release.sh. init.sh rewrites them when scaffolding a new game.
| Variable | Default | Meaning |
|---|---|---|
TITLE |
"New Game" |
Display name; names the .love, the .app and the zips |
PKG |
newgame |
Package slug; names releases/<PKG>/ and the Windows .exe |
UTI |
com.example.newgame |
Bundle identifier written to CFBundleIdentifier |
AUTHOR |
"Your Name" |
Passed to love-release -a |
ITCH |
your-itch-username/your-game-slug |
butler target; channels are appended as ${ITCH}:mac and so on |
ITCH_EDIT_URL |
https://your-itch-username.itch.io/your-game-slug/edit |
Opened after a push |
Other values near the top are not meant to change per game: LOVE_RUNTIME_VERSION=11.5, RUNTIME_CACHE="$HOME/.cache/love-release", OUT=releases/$PKG, GEN=assets/generated.
Running a release
scripts/release.sh # full release: build everything and push to itch.io
scripts/release.sh --no-push # everything except the butler pushes
love . --export-assets # only regenerate assets/generated/*.png
The script runs with set -euo pipefail from the repo root and uses a temporary work directory that is removed on exit. A full run does the following, in order:
- Export marketing assets. Runs
love . --export-assetsand checks thaticon,favicon,cover,social,wideandlogoPNGs exist inassets/generated/(seeassets.md). - Build
.love. Emptiesreleases/<PKG>/, then runslove-release -t "$TITLE" -a "$AUTHOR" --uti "$UTI" -p "$PKG"with excludes forDEV,.git,releases,designs,docs,.aider,.claude,.vscode,engine/dev,.md,scripts,assets/generatedandinit.sh. Output isreleases/<PKG>/<TITLE>.love. - Lint the
.love. Unzips it and runsscripts/lint-lua51.shover every.luainside. - Fetch runtimes. Downloads
love-11.5-macos.zip,love-11.5-win32.zipandlove-11.5-win64.zipfrom the LÖVE GitHub releases into~/.cache/love-release/if not already cached. - Build
.icns. Resizesicon.pngwithsipsto 16 through 512 plus@2xvariants and runsiconutil -c icns. - Package macOS. Renames
love.appto<TITLE>.app, copies the.loveintoContents/Resources/, writes the.icnsasOS X AppIcon.icnsandGameIcon.icns, setsCFBundleIdentifier,CFBundleNameandCFBundleDisplayName, removesCFBundleIconNameandUTExportedTypeDeclarations, ad-hoc signs withcodesign --force --deep --sign -, and zips to<TITLE>-macos.zip. - Package Windows. Runs
npm installinscripts/, resizesicon.pngto 16 through 256, and for each ofwin32andwin64patches the icon intolove.exewithnode scripts/patch-win-icon.mjs, appends the.loveto the exe as<PKG>.exe, removeslove.exe,lovec.exe, the readmes and the stock.icofiles, and zips to<TITLE>-win32.zipand<TITLE>-win64.zip. - Build web. Runs
love.js -c -t "$TITLE"intoreleases/<PKG>/web/, copiesscripts/web/over the output, deletestheme/bg.png, substitutes{{TITLE}}, copiesfavicon.pngtotheme/favicon.png, and fails if the favicon link or an unsubstituted{{placeholder is found. - Stage the
.love. Copies it intoreleases/<PKG>/love/, because butler unpacks zip uploads and a.loveis a zip. - Push (skipped with
--no-push).butler pushformac,windows,windows-32,webandlovechannels, each with--userversionset to the short git SHA, thenbutler status "$ITCH". - Checklist. Prints the page images to upload by hand and, after a push, opens
ITCH_EDIT_URL.
Outputs
Everything lands in releases/<PKG>/, which is git-ignored:
| Path | Contents |
|---|---|
<TITLE>.love |
The game archive |
<TITLE>-macos.zip |
<TITLE>.app for macOS |
<TITLE>-win32.zip, <TITLE>-win64.zip |
<TITLE>-win32/ and <TITLE>-win64/ folders with <PKG>.exe and the LÖVE DLLs |
web/ |
love.js output plus the template page |
love/<TITLE>.love |
Folder copy pushed to the love channel |
What ships and what does not
The exclude list keeps docs/, every .md file, scripts/, engine/dev/, init.sh, .vscode/, releases/ and assets/generated/ out of the .love. Excluding engine/dev removes the MCP bridge; engine/Game.lua requires it through pcall, so a shipped build silently skips it. Hot reload and the MCP bridge are otherwise switched by env = "dev" in main.lua: nothing in the engine reads a DEV file, so the -x DEV exclude only matters if you create one.
Platform notes
love-releaseis capped at LÖVE 11.3, so the script uses it only to produce the.loveand assembles Mac and Windows packages itself from the 11.5 runtime zips.- The Windows icon is replaced inside the PE resource table by
scripts/patch-win-icon.mjs(node scripts/patch-win-icon.mjs <in.exe> <out.exe> <png> [<png>...]), pure JavaScript viape-libraryandresedit, so no Windows tooling is needed on macOS. The.loveis then appended to the exe, the same tricklove-releaseuses. - The Mac icon is an
.icnsbuilt withiconutil. WithCFBundleIconNamepresent macOS reads the icon fromAssets.car, so the script removes that key. - Signing is ad-hoc; a failure prints a warning and continues.
The web page
love.js generates a page with a heading, footer and "Powered by" text. The script replaces it with the template in scripts/web/:
index.htmlhas a{{TITLE}}placeholder, linkstheme/love.cssandtheme/favicon.png, draws loading status text on aloadingCanvas, stops space and the arrow keys scrolling the page, and passesModule.arguments = ["./game.love"]to love.js. It also dispatches a syntheticbeforeunloadonpagehide, when the tab is hidden and every 10 seconds so love.js flushes the IndexedDB save directory.theme/love.csscentres the canvas on#000000with no border or padding, so mouse coordinates do not drift.
love.js's own game.js, love.js, love.wasm and game.data are kept. Change the colours in theme/love.css and the loading text in index.html to suit the game.
itch.io checklist
butler can only push build channels, and itch.io has no API for page images, so after a push:
- Upload
assets/generated/cover.png(630x500) under Edit game, Cover image. - Upload
assets/generated/wide.png(1920x1080) under Edit theme, Banner or background image. - Keep
social.png(1200x630) for devlogs and social posts,logo.png(1600x400, transparent) for press kits, andicon.png(1024x1024) for store listings. - Upload screenshots under Edit game, Screenshots. The script's message suggests keeping them in
assets/screenshots/.
First release only, on the edit page: tick "This file will be played in the browser" on the web channel upload, set its viewport to 1280x720, and set the page kind to HTML. Ticking the flag on the .love upload fails with "Failed to find index.html". Run butler login once in a real terminal before the first push.
The web page and the device bridge
scripts/web/index.html carries the page half of the device file picker and
camera (see device.md). Three things there are load-bearing:
- The synthetic
beforeunload. love.js only writes the IndexedDB-backed save directory in its ownbeforeunloadlistener, so the page dispatches one onpagehide, on tab hide and every ten seconds. LÖVE answers it by runninglove.quit, and a falsy return there ends the main loop — which froze the web build a few seconds after it loaded.Game:quitreturns true on web to refuse, andlove.quitpasses that return value through. Keep both halves if you touch either. INITIAL_MEMORYis 32 MiB, not love.js's default 16, because the camera holds a frame buffer and its decoded copy and growing the heap copies everything.- The build guards.
scripts/release.shfails if the page lost the bridge, or if the love.js output stopped exportingFS_createDeviceorFS_createDataFile. The toolchain is pinned atlove.js@11.4.1(the Davidobot fork); the bridge is built on what that build happens to export, so check the guards before upgrading it.