Skip to content

The scripts ​

Everything runs through a named root script. Nobody changes into a subdirectory, calls Gradle by hand, or remembers an xcodebuild line – the root package.json is the one front door, and the native directories stay purely native. pnpm run lists the live set, and package.json settles any disagreement with this page.

How the names work ​

The names follow one grammar: <verb>:<target>, and <verb>:<target>:<flavor> where a target has variants.

The target of a start: script is the size of what it runs. The three environments – start:local, start:dev, and start:prod – each bring up a whole stack on http://localhost:8000 (ADR 012); every other start: script starts one thing, a single server or a shell.

The flavor belongs to build:, not to start:, and the difference is deliberate. The environment scripts choose which stack answers on this machine, while build:android:dev and build:apple:prod bake a remote site into an artifact that ships. Running a shell has no flavor at all: start:android and start:apple always point at this machine.

Run ​

ScriptWhat it does
start:localThe local environment – Caddy, the mock, and Vite
start:devThe dev environment – the real back-end in containers
start:prodThe prod environment – the built image
start:webThe web application's Vite dev server alone
start:mockThe mock back-end alone
start:guidebookThis guidebook
start:storybookStorybook – every component, widget, and screen
start:archStructurizr, for arranging the architecture diagrams
start:androidBuilds and runs the Android shell on a device or emulator, against 8000
start:appleBuilds and launches the Apple shell on a simulator, against 8000

Check and test ​

ScriptWhat it does
check:formatPrettier, in check mode
check:lintESLint, failing on any warning
check:markdownmarkdownlint
check:typesThe TypeScript compiler, without output
check:archValidates the architecture model
check:android:formatktlint
check:android:lintDetekt and Android Lint
check:apple:formatSwiftFormat, in lint mode
check:apple:lintSwiftLint, strict
testThe TypeScript unit tests, with coverage
test:web:uiThe Playwright walks, starting the local stack or reusing a running one
test:androidThe Android unit tests, and a compile of the instrumented tests
test:android:uiThe Android instrumented tests, on an emulator
test:appleThe Apple unit tests, on a simulator
test:apple:uiThe Apple UI tests, on a simulator

The checks says which of these run before a push and in continuous integration.

Fix and generate ​

ScriptWhat it does
formatPrettier, writing fixes
format:androidktlint, writing fixes
format:appleSwiftFormat, writing fixes
format:svgsvgo, rewriting the SVG icons in place
generate:appleXcodeGen, regenerating Campfire.xcodeproj from project.yml

Build and release ​

ScriptWhat it does
build:webThe web application
build:imageThe deployable web image, for linux/amd64
build:guidebookThis guidebook
build:storybookStorybook
build:archRenders the architecture diagrams as SVGs
build:android:devThe Android shell against the dev site
build:android:prodThe Android shell against the prod site
build:android:stagingThe Android shell against the staging site
build:apple:devThe Apple shell against the dev site
build:apple:prodThe Apple shell against the prod site
build:apple:stagingThe Apple shell against the staging site
version:nextPrints the next version of android, apple, or web (Release)

Housekeeping ​

ScriptWhat it does
ide:androidOpens the Android shell in Android Studio
ide:appleOpens the Apple shell in Xcode
cleanRemoves every build output, and Gradle's working directories
preparePoints git at .githooks, run by pnpm install

The ports ​

Every server has a port of its own, chosen rather than defaulted, so two can run at once without either taking the other's address.

PortWhat holds it
8000The one origin – Caddy on the host in local, a Caddy container in dev and prod
8003The mock back-end, reached through Caddy
3000The web application's Vite dev server
3001This guidebook
3002Storybook
3003Structurizr, for the C4 model

Each port is strict, so a server that cannot have its port fails instead of quietly moving to the next one and leaving a link wrong. Starting the same server twice is handled the other way: the environment and server scripts free their port first and name whatever held it, so a second pnpm start:web replaces the first rather than failing.

What is behind them ​

The shell scripts live in scripts/, grouped by what they start or build. The Structurizr runner and the version rule behind pnpm version:next are Node rather than shell, so they run on any machine, and a missing Docker fails the Structurizr runner with a message that names it.

The start scripts share one set of helpers that make them trustworthy: a port is freed before it is taken, a server is reported only once it actually answers rather than once its process exists, and everything a script started stops together on Ctrl+C or when any one of them dies. Waiting comes in several kinds – any answer, a 2xx, any status the back-end produced itself rather than a proxy's 502, and an answer that says the service is ready – because a stack reported as up before it is up costs more than the wait.

Shell scripts are the one kind of source nothing formats. Prettier has no parser for them and no shell formatter is in the toolchain, so they are held to review instead.