@drawbridge/components
The components for Drawbridge. Three folders: shared/ renders on both the dashboard and the bridge pages, dashboard/ and bridge/ on one. Variants and tokens live in components/styles.css, which both apps import; a call site adds layout classes only, never a colour.
Work on a component
npm run app # every component, every state, at http://localhost:3003 (the family's ports: dashboard 3000, share 3001, website 3002)
npm run test:app # renders every story in Chromium; fails on an error
npm test # exports resolve, every component has a story, unit tests
A component without a .stories.js beside it fails npm test. One story per visible state.
The app on the web
https://components.trydrawbridge.com is this app, built from main on every push (.do/app.yaml, Dockerfile): npm run app:build makes the static site and server.js serves it behind the family's staging gate, the BASIC_AUTH_USERNAME and BASIC_AUTH_PASSWORD pair set on the DigitalOcean app, the same values that open the dev dashboard and website. Unset both and the site is public; /health is always open.
See it in an app without publishing
npm run dev # here: rebuilds dist on change
cd ../drawbridge-app-web && npm link ../drawbridge-components
npm run dev # the app resolves the package from this checkout
Undo with npm unlink @drawbridge/components && npm install in the app. Never publish from a feature branch.
Add or move a component
Put the file in its folder, write its story and its types/<folder>/<name>.d.ts, then npm run exports to regenerate the exports map. Never hand-edit exports.