dbt-style lineage for UI components and CMS content: what each piece is built with, where it is used, and what a change affects.
| Package | npm | |
|---|---|---|
@rocksoliddigital/storybook-addon-lineage |
The lineage graph of your components, as a page in Storybook (features) | |
@rocksoliddigital/payload-lineage |
Lineage and data model (ERD) pages in the Payload admin, from your config (features) |
- Storybook: install the addon and add it to
.storybook/main.ts: see its README. - Payload: add the plugin to
payload.config.ts: see its README, or run the example withpnpm dev:payload.
What's next, known issues, limitations and ideas: see ROADMAP.md.
Contributions are welcome: bug reports, ideas and pull requests. For anything bigger than a small fix, open an issue first so we can agree on the approach.
With mise (recommended): it installs the Node and pnpm versions pinned
in mise.toml.
mise trust
mise setupWithout mise: install Node 22 or later (CI uses 24), then let corepack provide the pnpm version
from packageManager in package.json.
corepack enable
pnpm run setupEither way, setup installs the dependencies, the git hooks and the Chromium the tests run in. Use
pnpm run setup rather than pnpm setup, which is a pnpm command of its own.
Every mise task is an alias over a pnpm script, so both columns run the same thing.
| Script | mise | What it does |
|---|---|---|
pnpm run setup |
mise setup |
One-time setup: dependencies, git hooks, test browser |
pnpm dev |
mise dev |
Builds the packages in watch mode and starts the example Storybook at http://localhost:6006 |
pnpm dev:payload |
mise dev-payload |
Builds the packages in watch mode and starts the example Payload admin at http://localhost:3000/admin |
pnpm build |
mise build |
Builds the packages to dist/ |
pnpm test |
mise test |
Every package's unit tests, the Payload example's config test, and the example Storybook's stories as browser tests |
pnpm lint |
mise lint |
ESLint |
pnpm typecheck |
mise typecheck |
TypeScript, every package |
pnpm format |
mise format |
Prettier |
pnpm check |
mise check |
Everything CI checks: format, build, lint, types, tests and the example Storybook build |
pnpm changeset |
mise changeset |
Adds a changeset for a release: see Releasing |
packages/storybook-addon-lineage: the addon.src/graph.tsbuilds the graph with dependency-cruiser.src/vite-plugin.tsserves it to the viewer and rebuilds it on changes.src/preset.tswires both into Storybook and adds the Lineage page.src/manager.tsxis the toolbar button,src/LineageGraph.tsxthe viewer.
packages/payload-lineage: the Payload plugin.src/graph.tsbuilds the lineage graph andsrc/schema.tsthe data model, from the config.src/plugin.tsregisters the admin pages;src/rsc.tsxrenders them on the server, andsrc/view/holds the canvases, which run in the browser.
packages/lineage-core: what both share, walking a graph's links and laying it out with ELK (with a React hook). It's private: each package's build includes its code, so it's never published or installed on its own. Use it for anything both tools need, rather than copying.examples/payload: a minimal Payload app (SQLite, no database server) that installs the plugin from the workspace. On first start, create a user at http://localhost:3000/admin, then open Lineage in the nav. Itssrc/lineage.test.tschecks the plugin against this real config.examples/react: a small Storybook that installs the addon from the workspace. Develop against it; itssrc/lineage.test.stories.tsxtests the viewer on fixture graphs..changeset/: the changesets waiting for the next release, and their config.
- Branch from
main, and keep each PR to one change. - Run
pnpm checkbefore you push. CI runs the same. - Add or update a test for any behaviour you change. Package tests are Vitest files next to the
code (
src/**/*.test.ts); the Storybook viewer's are stories with play functions inexamples/react/src/lineage.test.stories.tsx. - If it changes what a package does, add a changeset:
pnpm changeset(see Releasing). - Fill in the PR template; the test plan matters most.
Commit messages and PR titles follow Conventional Commits,
e.g. feat: add a dark theme or fix(storybook): keep the focus after a rebuild. A git hook
checks commit messages and CI checks PR titles. PRs are squash-merged, so the title becomes the
commit on main.
Releases use Changesets. The two published packages share one version and are always released together, so each addon version goes with the plugin version of the same number. A PR that changes what a package does adds a changeset:
pnpm changeset # pick the packages and the bump, then write the changelog lineThat adds a file under .changeset/ to commit with the PR. packages/lineage-core is built into
both published packages, so a change there names the packages it changes. Docs, tests and CI need
none.
Once changesets reach main, the Release workflow opens a Version Packages PR, and keeps it up
to date: it bumps the versions and writes each package's CHANGELOG.md. Merging it publishes the
new versions to npmjs.com with provenance, tags them (@rocksoliddigital/payload-lineage@<version>) and
creates their GitHub Releases. GitHub doesn't let a PR the workflow opens start other workflows, so
close and reopen the Version Packages PR to run its checks.
Release notes group changesets under 🚀 Features, 🐛 Bug Fixes and ⚠️ Breaking Changes (minor,
patch and major), one line each with the PR's scope, PR and commit, then 🤝 Contributors.
.changeset/changelog.mjs writes the lines and scripts/format-changelog.mjs the sections, both
run by pnpm version-packages (changeset version, then the formatter). To preview, run it with
GITHUB_TOKEN=$(gh auth token) and discard the result. For a prerelease, see Changesets'
prerelease guide.
Setting up publishing, once:
- In the repo's Settings → Actions → General, allow GitHub Actions to create and approve pull requests, so the workflow can open the Version Packages PR.
- On npmjs.com, add the Release workflow (
rock-solid/lineage-kit,release.yml) as each package's trusted publisher; publishing then needs no token. If npm won't take a trusted publisher before a package's first version, publish that version once by hand frommainafter merging the Version Packages PR:pnpm build && pnpm changeset publish.