Contributing
The design system lives in the monk-business/design-system repository, a pnpm workspace:
| Path | Contents |
|---|---|
packages/tokens |
DTCG sources (src/tokens), the Style Dictionary build and its tests |
packages/brand |
The logo generator (scripts/logos.mjs), PNG exports and fonts.css |
packages/css |
Component CSS, one file per component in src/ |
packages/astro |
Astro components in src/, published as source |
apps/docs |
This site (Astro + Starlight) |
docs/adr |
Architecture decision records |
Development
Section titled “Development”nvm use # Node 24pnpm installpnpm build # tokens, brand, css (the astro package is source)pnpm docs:dev # this site at http://localhost:4321pnpm test # unit tests in every packagepnpm typecheckpnpm lint # Biome; pnpm format fixes formattingpnpm --filter @monk-business/docs test:e2e # Playwright: every page, axeVersioning
Section titled “Versioning”The four packages are a fixed group in Changesets: they always share one version, and a release bumps all of them. Follow semantic versioning from the consumer’s point of view:
| Change | Bump | Examples |
|---|---|---|
| Breaking | major | Remove or rename a token, CSS variable, class or prop; change a token value in a way that breaks contrast or layout; drop a theme selector |
| Additive | minor | New token, component, variant, prop or file; new output format |
| Fix | patch | Correct a value to match the approved design; fix markup or accessibility without changing the API; docs-only changes to packages |
While the version is below 1.0, treat minor as breaking-capable but still call out every breaking change in the changeset.
Changesets workflow
Section titled “Changesets workflow”- Make the change on a branch.
- Run
pnpm changeset, pick the bump and write a summary for consumers: what changed and what they need to do. - Open a pull request. CI runs lint, build, typecheck, unit tests, the docs build and the end-to-end tests.
- When the pull request is merged into
main, CI runs again and the release workflow opens (or updates) a “Version Packages” pull request with the new version and the changelogs. - Merging that pull request publishes the packages to GitHub Packages, tags the release and creates GitHub releases.
This site deploys on every push to main once the checks pass, so documentation fixes go live without a package release.
Add or change a token
Section titled “Add or change a token”- Edit the DTCG files in
packages/tokens/src/tokens/:$value,$typeand a$descriptionthat says where to use it. Reference other tokens with{color.teal.700}. - Themed tokens go in both
themes/dark.jsonandthemes/light.json; a test fails if one theme is missing a token. - New text and ground colors must pass the contrast tests (4.5:1 for text, 3:1 for graphics) in both themes; add the pair to
test/tokens.test.mjs. - Run
pnpm --filter @monk-business/tokens buildandtest. Review the CSS snapshot diff (test/__snapshots__) and update it withvitest -uonly when the change is intended. - Never rename or remove an existing
--mb-*variable in a minor release: the website depends on them.
Add a component
Section titled “Add a component”- Write the styles in
packages/css/src/<name>.css, inside@layer mb.components, using only--mb-*variables andmb-classes (BEM). Add the file toFILESinpackages/css/scripts/build.mjs. - Write
packages/astro/src/<Name>.astrowith an exportedPropsinterface, a JSDoc comment on every prop (the docs tables are generated from it) and no client JavaScript. Export it fromsrc/index.ts. - Add tests for its markup in
packages/astro/test/components.test.ts. - Add a demo in
apps/docs/src/demos/and a page inapps/docs/src/content/docs/components/with usage rules, Astro and HTML snippets, and<PropsTable>. - Add the page to the sidebar in
apps/docs/astro.config.mjsand to the end-to-end page list if it needs axe coverage.
Logos and brand files
Section titled “Logos and brand files”The logo geometry in packages/brand/scripts/logos.mjs is approved: the tests compare every SVG byte by byte with the committed snapshots. Change it only with the owner’s approval, then update the snapshots in the same pull request and describe the change in the changeset.
Release process
Section titled “Release process”Releases are automated with Changesets and GitHub Actions; nobody publishes from a laptop. To publish manually in an emergency, with a token that has write:packages:
pnpm buildpnpm changeset versionpnpm changeset publish