@cobre-npm/ds-v3
Cobre Design System V3 (@cobre-npm/ds-v3)
Vue 3 + TypeScript component library for the Cobre platform, documented and developed through Storybook.
Heads up: this project uses pnpm, not npm. Running
npm installwill generate a straypackage-lock.jsonand can produce a brokennode_modules. Always usepnpm.
Prerequisites
- Node.js ≥ 20 (CI uses Node 24).
- pnpm ≥ 10. The exact version is pinned via the
packageManagerfield inpackage.json, so the simplest setup is to let corepack match it:
To install manually instead:corepack enablenpm install -g pnpm.
Project Setup
pnpm install
On a fresh checkout, pnpm may prompt you to approve build scripts for native dependencies (esbuild, @swc/core, @parcel/watcher, unrs-resolver, vue-demi). If it does, approve them:
pnpm approve-builds
Then re-run pnpm install if needed.
postinstall downloads the headless Chromium the render lane tests against (~95 MB, once per
machine, idempotent). It lives in postinstall rather than in the test script because the browser is
a dependency of the suite, and because more than one command runs that suite — putting it in test
left every other entry point without a browser. SKIP_TEST_BROWSER=1 skips it, for any image that installs dependencies and never runs the suite —
the Dockerfile that builds the Storybook showcase sets it. On Alpine it skips itself, because
Playwright publishes glibc builds only. --ignore-scripts skips it too, and pnpm test:browsers
gets it back.
Develop with Storybook (primary workflow)
This is a component library — day-to-day development happens in Storybook, which renders every component with its variants and docs:
pnpm storybook
Opens at http://localhost:6006.
pnpm dev(plainvite) only serves the minimalsrc/main.ts/App.vueharness. It is not the component gallery — usepnpm storybookfor normal development.
Common Commands
| Command | What it does |
|---|---|
pnpm install |
Install dependencies |
pnpm storybook |
Run Storybook dev server on port 6006 (main dev workflow) |
pnpm dev |
Bare Vite dev harness (src/main.ts) — rarely needed |
pnpm build |
Type-check + build the publishable library into dist/ |
pnpm build-storybook |
Build the static Storybook site |
pnpm test |
The whole gate: story render lane, logic lane with coverage, invariants |
pnpm test:stories |
Render lane only — mounts all 81 stories in headless Chromium |
pnpm test:unit |
Logic lane only, with coverage enforced against coverage-floor.json |
pnpm test:browsers |
Re-download the Chromium build the render lane needs — normally unnecessary, pnpm install does it |
pnpm lint |
Lint & auto-fix with ESLint |
Testing
The suite is split in two lanes because the two numbers would not mean the same thing (ADR-0008):
- Render lane (
test:stories) — every story mounts without error, in headless Chromium via@storybook/addon-vitest. It is binary: no percentage is attached to it. Storybook marks a line covered when a story renders it while asserting nothing, so a percentage built that way measures exercised, not verified. - Logic lane (
test:unit) — the non-component sources (src/**/*.tsminus stories, tests, type-only modules, barrels and the dev entry), with coverage thresholds enforced.
The coverage floor ratchets
coverage-floor.json holds the thresholds, and it is a floor, not a target. It was set to what
the repo measured the day the gate was switched on — there is no retroactive 95% and no backfill of
the existing components as a precondition. It may only rise:
scripts/check-invariants.mjsfails the build when any number in the file drops below the base ref. It is a change-level check, so it runs in CI, or locally withpnpm test:invariants -- --base origin/trunk.src/utils/repo-invariants.test.tsfails whenvitest.config.mtsstops reading its thresholds from that file, which would otherwise be a silent way to lower the gate to nothing.
To raise the floor: improve coverage, run pnpm test:unit, and copy the reported totals into
coverage-floor.json.
Adding tests
Component behaviour belongs in a story — it is the lane that already exists and the one consuming apps read as documentation. Reach for the logic lane when the subject is a composable, a pure function or shared state.
Recommended IDE Setup
VSCode + Vue - Official (Volar) (disable Vetur).
Type Support for .vue Imports in TS
TypeScript can't type .vue imports on its own, so we use vue-tsc for type checking and the Vue (Volar) extension to make the editor's TS language service aware of .vue types.
Project Structure & Conventions
See CLAUDE.md for the full architecture overview: Atomic Design layout (atoms/molecules/organisms), the Cobre* / co- naming conventions, the SCSS token system, and how to add a new component (each lives in its own folder with a .vue, a .stories.ts, and an index.ts, and must be exported from src/components/index.ts and src/index.ts).
Troubleshooting
npm run dev/npm installfails or behaves oddly — you're using the wrong package manager. Delete anypackage-lock.json, then usepnpm install.- pnpm asks to approve build scripts — run
pnpm approve-builds, then re-runpnpm installif needed. - Stale or broken
node_modules—rm -rf node_modules && pnpm install.
Related Packages
Embeddable Vue 3 widgets for Cobre's portal, published to npm and consumed by th...
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.162.2 | ^3.4.21 | ||
| 0.162.1 | ^3.4.21 | ||
| 0.162.0 | ^3.4.21 | ||
| 0.161.0 | ^3.4.21 | ||
| 0.160.0 | ^3.4.21 | ||
| 0.159.0 | ^3.4.21 | ||
| 0.158.0 | ^3.4.21 | ||
| 0.157.0 | ^3.4.21 | ||
| 0.156.0 | ^3.4.21 | ||
| 0.155.0 | ^3.4.21 | ||
| 0.154.0 | ^3.4.21 | ||
| 0.153.0 | ^3.4.21 | ||
| 0.152.0 | ^3.4.21 | ||
| 0.151.0 | ^3.4.21 | ||
| 0.150.0 | ^3.4.21 | ||
| 0.149.0 | ^3.4.21 | ||
| 0.148.0 | ^3.4.21 | ||
| 0.147.1 | ^3.4.21 | ||
| 0.147.0 | ^3.4.21 | ||
| 0.146.1 | ^3.4.21 | ||
| 0.146.0 | ^3.4.21 | ||
| 0.145.2 | ^3.4.21 | ||
| 0.145.1 | ^3.4.21 | ||
| 0.145.0 | ^3.4.21 | ||
| 0.144.3 | ^3.4.21 | ||
| 0.144.2 | ^3.4.21 | ||
| 0.144.1 | ^3.4.21 | ||
| 0.144.0 | ^3.4.21 | ||
| 0.143.0 | ^3.4.21 | ||
| 0.142.3 | ^3.4.21 |
Showing the latest 30 of 412. See every release on npm
Pre-releases (3)
| Version | Released | Vue | License |
|---|---|---|---|
| 0.30.3-9-PROD | ^3.4.21 | ||
| 0.30.2-8-PROD | ^3.4.21 | ||
| 0.30.1-6-PROD | ^3.4.21 |