Skip to content

five-on-it / packages/missions/src/migrate

packages/missions/src/migrate ​

The game document's format across releases: a document says its version (schemaVersion, 1 when absent: every game made before 0.54), and migrateGame brings an older one up to GAME_SCHEMA_VERSION a step at a time (@foi/shared's migrate) before GameDoc reads it, wherever a document comes in: a bundled game, FOI_GAME, a draft the API is sent or builds, a published game remixed, an artifact a game server opens. A document of a newer format than this release reads is refused, saying it needs a newer release.

A change to the format that an older document does not meet (a field renamed, a verb reshaped) adds a step to GAME_STEPS (version n to n + 1 at index n − 1) and, with it, the newest version; every bundled game and fixture runs through the steps in migrate.test.ts. So does a change an older release must not read: version 2 (0.71) adds a mission's play (play.ts), which a release before it would play as a solo mission in the open city; its step changes nothing in the document, and the newer format alone makes an older game server refuse a game built since (@foi/protocol's unplayableReason).

Variables ​

Functions ​