@deploybaseline/state-sqlite
v0.14.0
Published
Save Baseline emulator state in a SQLite file with node:sqlite
Readme
@deploybaseline/state-sqlite
Keep Baseline emulator state and named snapshots in a SQLite file. It uses Node's built-in node:sqlite (Node 24 or later), so there is no native module to build.
npm install -D @deploybaseline/cli @deploybaseline/state-sqlite
npx @deploybaseline/cli --state sqlite:.baseline/state.dbThe CLI finds this package in your project's node_modules. Without installing it in the project:
npx -p @deploybaseline/cli -p @deploybaseline/state-sqlite baseline start --state sqlite:.baseline/state.dbThe database has one table, baseline_state: the row named current is the live state, and every other row is a named snapshot. The file is created owner-only and uses WAL mode. The CLI locks it to one process, like a JSON state file.
In code:
import { sqliteState } from '@deploybaseline/state-sqlite'
import { createEmulator } from '@deploybaseline/cli'
const store = await sqliteState('.baseline/state.db')
const github = await createEmulator({ service: 'github', port: 4001, state: store })See Saved state.
