How to contribute to the Source Design System for developers.
Install dependencies using pnpm:
$ pnpm i
Run all CSNX storybooks in a single instance:
$ make storybooks
Build all storybooks:
$ make build-storybook
- New components should be added to the Development Kitchen.
- New components must have a CODEOWNER.
- First familiarise yourself with Emotion's documentation – we use the React flavour
- Prefer composing styles using the
css
tag and thecss
prop. - Avoid using
styled
to create or extend components.- Every styled component rendered creates an additional
Context.Consumer
component, which can lead to performance issues.
- Every styled component rendered creates an additional
- Avoid dynamic styles. Prefer using conditional logic in the component
to compose numerous small chunks of CSS using the
css
prop. - One example of unavoidable dynamic styles is Theming.
- Source uses Storybook for its API documentation as well as for visual regression testing.
- Ensure you test your changes against our accessibility testing guide (see 'Raising a pull request' below).
- Ensure your component works against the following browsers (you can ask for access to Browserstack Live):
- Chrome 77+
- Firefox 68+
- Edge 17+
- Safari 12+
- Ensure your component can be imported and server-rendered on a project running Node.js v14.
- Ensure your component works on touchscreen devices.
- Before raising a pull request, squash your commits. Fewer commits makes the CHANGELOG (slightly) more readable.
- Each commit should contain changes to exactly one package. If you need to edit multiple packages as part of a change, please divide these into separate commits. Again, this is for CHANGELOG readability.
- Commit messages should read as if you are instructing someone else what to do. It usually helps to start with a verb. For example, "Increase the line height of the body text".
- Generate a changeset describing your work by running
make changeset
and following the prompts. - Test that your component can be used in a real project (e.g. dotcom-rendering). In the project folder, use
pnpm link
to avoid having to perform a real publish, andpnpm pack
to see exactly which files would be published.
- Tested with screen reader
- Navigable with keyboard
- Colour contrast passed
- The change doesn't use only colour to convey meaning
- Tested with touch screen device
If there are guidelines around how much content the component can support, or how wide its container may get, please specify them in the documentation section.
- Tested at all breakpoints
- Tested with with long text
- Stretched to fill a wide container
- Full API surface area is documented in the README
- Examples in Storybook
CSTI members have permissions to merge your PR. Ping the team on [[email protected]]((mailto:[email protected]?subject=Source PR)) if your PR needs prompt attention.
make changeset
will prompt you to choose a semver change type for your changes (major/minor/patch).- This should include visual changes, not just changes to the API e.g.
- A slight colour tweak could break contrast ratio guidlines, and comsumers would need to account for this, meaning it's not a drop-in change i.e. major/breaking.
- A new font-size will only affect consumers who want to use it, making it a new feature i.e. a minor change.
- Giving different text-sizes custom underline heights improves accessibility but doesn't require further changes, and all current consumers get the benefit i.e. a patch.
Publishing is triggered by merging the auto-generated Release Package Updates PR that changesets manages.
There are times when you want to publish a new version of a package even when the package source code hasn't changed. In these cases, you should:
- create a new changeset
- create a PR explaining why the package needs to be bumped