Run the examples from the repository
Try unreleased IFLoom code from a clone of the repository by playing the examples or making a game in or beside the checkout.
Use this to try code that hasn't been released yet, such as a fix on the main branch. You need Node 22.18 or later, git and npm, because the checkout's tools run the packages' TypeScript source and Node strips the types itself from 22.18. For a game on the published packages, see Create a game instead.
Play the examples
-
Clone the repository and install it:
git clone https://github.com/IFLoom/ifloom.git cd ifloom npm install -
Run an example's dev server, and open the address Vite prints:
npm run dev -w @ifloom/example-novel # The Letter, a linear novel npm run dev -w @ifloom/example-cafe # The Corner Café, a management game npm run dev -w @ifloom/showcase # Small Town, which uses every feature
The showcase has more scripts, each run the same way with -w @ifloom/showcase:
npm run build # build dist/index.html
npm run check # list any problem in its content
npm run playtest # play a week unattended, into playtest/week.txt
npm run snapshot # compare every scene with snapshots/scenes.txt
npm run build:one-file # build dist-one/index.html, with the pictures inside itOpen the built dist/index.html straight from disk, with no server. The examples lists each example's files.
Make a game inside the checkout
From the root of the checkout:
npm run new -- my-game
npm install
npm run dev -w my-gamenpm run new runs ifloom new, with the same --template and --theme, and makes the game in games/my-game. The games/ folder is an npm workspace, so npm install links the game to the packages. Git ignores games/, so your game stays out of IFLoom's history and a pull leaves it alone.
Run the game's scripts from the root with -w, as in npm run check -w my-game. The checkout's workspaces are npm's, so use npm here. A change to a package shows up in the game straight away, because the checkout's tools read each package's source. A next game is the exception: run npm run build at the root before its dev or build, and again after you change a package.
Make a game beside the checkout
Use this to keep the game in a folder and repository of its own, next to the checkout, on the packages as they'll be published:
work/
├── ifloom/ the IFLoom repository
└── my-game/ your game-
Build and pack every package into
ifloom/packs/:cd ifloom npm install npm run packTo write the files elsewhere, give a folder after
--, relative to the checkout:npm run pack -- ../my-game/packs. Thefile:paths below then readfile:./packs/…. -
Make the game beside the checkout with
create-ifloom's command, straight from the checkout. It takes the same--templateand--theme:cd .. node ifloom/packages/create-ifloom/bin.js my-game -
In
my-game/package.json, point the@ifloomdependencies at the packed files:{ "dependencies": { "@ifloom/engine": "file:../ifloom/packs/ifloom-engine-0.2.0.tgz", "@ifloom/react": "file:../ifloom/packs/ifloom-react-0.2.0.tgz", "@ifloom/audio": "file:../ifloom/packs/ifloom-audio-0.2.0.tgz", "@ifloom/browser": "file:../ifloom/packs/ifloom-browser-0.2.0.tgz" }, "devDependencies": { "@ifloom/cli": "file:../ifloom/packs/ifloom-cli-0.2.0.tgz" } }List
@ifloom/audioand@ifloom/browsereven though they're peers of@ifloom/react, or the package manager fetches them from the registry. A package's file is its name without the@, with the/as a-, then its version, so@ifloom/plugin-jobsisifloom-plugin-jobs-0.2.0.tgz. Add one for each plugin the game uses. -
Install and run it:
cd my-game npm install npm run check npm run dev
Three package managers need one more step:
- bun looks a package's peers up on the registry even when the game lists them. List the same files under
"overrides"too. - yarn 2 and later need a
.yarnrc.ymlholdingnodeLinker: node-modules, because Vite doesn't support Plug'n'Play installs.yarn create ifloomwrites it, but running the command withnodedoesn't. - npm 10, which comes with Node 20, stops with
Cannot read properties of null (reading 'edgesOut')on the packed files. Runnpm install --legacy-peer-deps, or update npm.
A plugin package beside the checkout works the same way. Make it with --template plugin, and point its @ifloom/engine dev dependency at the packed engine. Leave its peer dependency as it is, since that's the range a game sees once the plugin is on npm.
Send a change back
A pull request that changes a published package adds a changeset, a small file saying which packages changed and what to tell people, which the release turns into new versions and changelog lines:
npm run changesetPick the packages and whether each is a patch or a minor (before 1.0, a minor is a breaking change), then write the line for the changelog, starting with Added:, Changed:, Removed: or Fixed:. A change to the docs or the examples needs none. CONTRIBUTING.md has the rest: the checks to run and how a release happens.
Check it worked
npm run check prints No problems. in the new game, and npm run dev serves it. After you pull a newer IFLoom, run npm run pack in the checkout again, then npm update in the game. With another package manager, delete node_modules and the lockfile and install again. yarn 1 also keeps the old files in its cache under the same version, so run yarn cache clean first.
For more, see:
ifloom newand the CLI's requirements.- Write a plugin, for a plugin package of your own.
Last updated on