Skip to content

Migrating to Karni 0.7.0

Changed in 0.7.0

The game kind makes a game first

karni new --kind game makes a game first: the game in game/<slug>/, its own npm package on @karni/game, served by the project at /play/<slug>/, with the API and the admin, and no React staff app unless --staff-app (apps and games). What 0.6.0's --kind game made, an app with the game on a page, is the kind app+game (karni new --kind app+game), and karni add game turns an app into one.

What a project made with 0.6.0's --kind game does. Nothing breaks, and nothing in it moves. It records kind = "game" and keeps its game in frontend/src/game/ and frontend/portal/, with no game/<slug>/ folder, so Karni reads it as app+game: karni context prints KIND: app+game, recorded as game (the 0.6.0 name) and karni rules sync writes the agent files for an app with a game. Its build, its tests and karni check are as before.

To record the name, set it under [tool.karni] in pyproject.toml and rewrite the agent files:

[tool.karni]
kind = "app+game"
karni rules sync

To make it a game first instead, the game moves out of the staff app: make a new project with karni new "<Name>" --kind game in a scratch folder, copy its game/<slug>/ folder, the games stage of its Dockerfile and its game service of docker-compose.yml into the project, move the rules you changed (frontend/src/game/rules.ts) to game/<slug>/src/rules/index.ts, set kind = "game", then run karni make deploy compose --force (and karni make deploy systemd-nginx --force where you use it) so the web front serves /play/<slug>/. Keep frontend/ for staff, or delete it with its game:package script.