Skip to content

Development

Eric Teninty edited this page Dec 2, 2026 · 1 revision

Layout

Part Where Committed?
System code (TypeScript, bundled to dist/crawlspace.mjs) src/ Source only. dist/ is built.
Sheets, chat cards and dialogs templates/, styles/, lang/ Yes
Homebrew and rules compendiums packs-src/, compiled to packs/ JSON source only. The LevelDB packs are built.
Game-database content module (crawlspace-content) Built by npm run packs:content No. It holds book text. It is built and published from a separate private repository, never with the system.

Setup

npm install
npm run build         # dist/crawlspace.mjs
npm run packs         # homebrew + action packs, and the content module (reads CrawlSpace's Postgres)
npm run link          # junction into %LOCALAPPDATA%/FoundryVTT/Data
  • Database URLs. The pack builders read them from CrawlSpace's .env (../Dungeon Crawler Carl RPG/.env). Point CRAWLSPACE_ENV at another file to override it.
  • No database? npm run packs:homebrew -- --offline compiles the committed packs-src without one.
  • Locked packs. Stop Foundry, or close the world, before rebuilding packs: Foundry locks the LevelDB files.
  • Watching. npm run watch rebuilds the bundle on save. Reload Foundry (F5) to pick it up.
  • Checks. npm test runs the rules tests; npm run typecheck checks the TypeScript.

tests/foundry-time.mjs has integration checks for a disposable Foundry copy only. They create and delete their own documents. Never run them in a live campaign.

How CrawlSpace maps onto Foundry

  • Effects are Active Effects.
    • Plain bonuses use core add changes on system.* paths.
    • Rank, health-slot, percent, roll-mode, triggered and special bonuses use custom change types: crawlspace.skillRank, crawlspace.spellRank, crawlspace.baseSkillRank, crawlspace.baseSpellRank, crawlspace.healthBonus, crawlspace.statPercent, crawlspace.modLoss, crawlspace.rollMode, crawlspace.triggered and crawlspace.special.
    • The effect sheet's rule elements write these. See Effects and Rules.
  • Debuffs replace core status effects.
  • Combat keeps Foundry's Combat document. Its phase state lives in flags.crawlspace.phase, and "next turn" steps through the phases.
  • Damage and healing use chat-card buttons. Players apply damage to tokens they don't own through a socket relay to the active GM.
  • Personal Spaces are personalSpace actors holding spaceUpgrade and craftingTable items. A crawler is in one while flags.crawlspace.inPersonalSpace holds the space's actor id.
  • Crafting uses the material and craftingTable item types. Recipes are kept on the item they make; a crafted copy records where it came from in flags.crawlspace.craftedFrom.
  • Quests and the leaderboard are world settings (quests, leaderboard, population). A party title is flags.crawlspace.partyTitle on the crawler.
  • Party membership is flags.crawlspace.inParty on crawlers. Other parties are the parties world setting, and a crawler's other party is flags.crawlspace.partyId.
  • Headshots are flags.crawlspace.headshot on actors.
  • Region journals are the journal page types neighborhood, borough, city, province, country and floor. Items that open a document to whoever holds them list its UUID in flags.crawlspace.grants.
  • Imports record flags.crawlspace.importKey, so importing again updates documents in place.
  • Rounding. All rules round down (Math.floor).

Releasing

  1. Bump version in system.json and package.json.

  2. Set download in system.json to .../releases/download/v<version>/system.zip.

  3. Commit, then push a matching tag:

    git tag v0.9.7
    git push origin main v0.9.7

The Release workflow (.github/workflows/release.yml) then:

  1. tests and builds the system;
  2. compiles the homebrew and action packs;
  3. runs npm run release -- <tag>, which writes release/system.json and release/system.zip;
  4. publishes them as a GitHub Release.

The tag must match system.json's version or packaging stops. The content module is never part of a release.

Foundry reads the manifest from releases/latest/download/system.json, so installed worlds see the new version as soon as the release is published.

To try a release locally:

npm run build && npm run packs:homebrew -- --offline && npm run packs:actions
npm run release -- v0.9.7

Clone this wiki locally