How to wire meander generate into your project's own build
pipeline (CI, Makefile, rolldown bundle, whatever).
meander is usable as a CLI and as a library. Pick whichever matches the rest of your toolchain.
Simplest. Good if you only need it occasionally.
// package.json
{
"scripts": {
"walkthrough": "meander generate meander.config.json",
"walkthrough:preview": "meander serve meander.config.json"
}
}pnpm run walkthrough # emit pages/
pnpm run walkthrough:preview # watch + serve at localhost:8080Import the generator and call it from your own build script. Good when you want meander output as one step in a larger pipeline (a docs site build, a CI artifact upload, etc.).
// scripts/build-walkthrough.mts
import { generate } from '@socketsecurity/meander'
await generate('./meander.config.json', {
basePath: '/meander', // matches your hosting prefix
})Invoke it the same way you run any other Node script:
node --experimental-strip-types scripts/build-walkthrough.mtsmeander can run inline scripts through rolldown's minifier,
inline SVGs through svgo, and meander.css through lightningcss
at emit time - enable via the config:
{
"minify": {
"js": true,
"svg": true,
"css": true
}
}Requirements:
-
svgoandlightningcssare already installed as meander deps - no action needed forsvg: trueorcss: true. -
For
js: true, install rolldown in your project:pnpm add -D rolldown
meander loads it dynamically. If rolldown isn't available, the JS pass logs + skips rather than aborting the build.
The simplest zero-cost hosting path. meander emits static HTML; GitHub Pages serves it.
The GitHub Pages deploy steps
# .github/workflows/pages.yml
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@<pinned-sha>
- uses: pnpm/action-setup@<pinned-sha>
- run: pnpm install
- run: |
node --input-type=module -e "
import { generate } from '@socketsecurity/meander'
await generate('./meander.config.json', { basePath: '/your-repo' })
"
# GH Pages skips files starting with _ without a .nojekyll marker.
touch pages/.nojekyll
- uses: actions/upload-pages-artifact@<pinned-sha>
with:
path: pagesReplace --base-path=/your-repo with your repo's URL path
(matches https://<user>.github.io/<your-repo>/). For a
project-level Pages deploy at the root, drop the option.
See meander's own
.github/workflows/pages.yml
for a working reference.