2.9 KiB
Build & release
Toolchain
- TypeScript compiled/bundled with esbuild (
esbuild.config.mjs). - Entry point
main.ts→ bundled outputmain.js(CJS, targetes2018).obsidian,electron, and the CodeMirror/Lezer packages are externalized. main.jsis generated — do not edit it by hand.- A reproducible dev shell is provided via devbox (
devbox.json).
npm scripts
| Script | What it does |
|---|---|
npm run dev |
esbuild in watch mode (inline sourcemaps, no minify). |
npm run build |
tsc -noEmit -skipLibCheck (type-check) → npm test → production esbuild (minified). |
npm run build-no-check |
Production esbuild only — skips type-checking and tests. |
npm test |
Runs the test suite (tsx --test test/*.test.ts). See testing.md. |
npm run lint |
eslint . |
npm run version |
version-bump.mjs (syncs manifest.json + versions.json). |
Before committing, both of these should pass clean:
npm run build
npx eslint .
The repo follows eslint-plugin-obsidianmd (see eslint.config.mjs) and the
obsidian-plugin-development skill — invoke that skill when touching plugin APIs.
Releasing
Releases go through the justfile (just release <version>). Accumulate user-facing
changes under ## Unreleased in ../CHANGELOG.md as you work — the
recipe promotes that section to the release version for you (no manual rename needed).
The recipe:
- Normalizes the version (strips a leading
v) and rejects anything that isn't semver (e.g.1.0.1or1.0.1-rc.1). - Refuses to run if
git statusis not clean, or if the tag already exists. - Syncs the version into
manifest.json,package.json, andversions.json(viajq) —versions.jsonmaps the new version to the currentminAppVersion. - Promotes
## Unreleased→## <version>inCHANGELOG.mdand uses that section's body as the GitHub release notes (falls back toRelease <version>if empty). - Builds with
npm run build(type-check + tests + production esbuild) — a failing type-check or test aborts the release after the file edits but before commit/push. - Commits (
Prepares for release '<version>') the four metadata/changelog files and pushes the current branch (git push -u origin HEAD). - Creates a GitHub release with
gh, targeting the just-pushed branch and uploadingmain.js,manifest.json, andstyles.cssas assets.
gh token note
devbox bundles its own gh (from nixpkgs) that can't read the host keyring where
gh auth login stored the token. The _gh-token recipe works around this by
falling back to the host /usr/bin/gh auth token. If it prints nothing, gh uses
its own auth.
Release artifacts
Obsidian loads three files from a release: manifest.json, main.js, and
styles.css. versions.json maps plugin versions to the minimum Obsidian version.