If you'd like to contribute to the Design System, we'd love to have your help. As with any open-source project, we ask that you be kind, professional, and courteous toward others.
Contributing doesn't necessarily mean committing code; we also encourage you to:
- Open issues
- Join in on discussions on issues and PRs
- Help write documentation
- Use the Design System in your project and provide feedback
- Add yourself to our Contributors list using
npm run contributors:add
then enter your username and type of contribution.
git clone https://github.com/priceline/design-system.git
cd design-system
The Design System is a Rush Monorepo. Install rush
globally:
npm i -g @microsoft/rush
Install dependencies and build all projects by running rush prepare
:
rush prepare
# This is equivalent to running `rush install` and `rush build`
To update the PNPM lockfile when you change dependencies in a package.json
:
rush update
We use Jest for testing. We intend for all tests to be migrated to React Testing Library.
rush test:ci
To update snapshots while running tests:
rush test:snapshots
Prettier is used for formatting and is run as a pre-commit hook. There is a prettier config file in the root of the repository so that IDE extensions for ESLint can read the configuration.
ESLint is used for static analysis and runs as a pre-commit hook and during CI.
rush lint
We use Plop to scaffold new components rather than copying & pasting from a boilerplate. The configuration allows you to create new core and package components. Follow the steps below to create a new component:
- Run
npm i -g plop
to install plop globally. - Run
rush create
and follow the prompts forcomponent
(components inpcln-design-system
(packages/core
)) orpackage
(new project) - Run
rush update
to update dependencies - If creating a core component, add an import & an export for the new core component in
packages/core/src/index.ts
Additional Guidance: Creating Components
We use Storybook for isolated UI component development.
Storybook stories are in the src
folder of each project, adjacent to the components they showcase.
rush storybook
To publish a new version of any Design System packages that have unreleased changes, run the [Rush publish to NPM]
GitHub Action workflow from the main
branch. This will publish changed projects to NPM and create a GitHub release
for each package containing the changelogs for that release. Note that you'll need to request approval of your
deployment before it will begin running.
The NextJS doc site is located in apps/docs
.
To run the static docs locally:
rush docsite
We follow a loose version of GitHub Flow where feature branches
are created from main
, submitted as pull requests, given time for review and
discussion, then merged into `main``.
All merges into `main`` should be ready to be published. The Design System Working Group will batch releases as appropriate.
Generally, the workflow looks like this:
- Pull the latest changes from `main``
- Create a new feature branch with a name that clearly describes the change
- Commit changes to your feature branch. We recommend keeping only one commit and amending it as you work to make rebasing easier.
- Run
rush change
to document your changes - Push your branch to
origin
- Open a Pull Request with a clear description of the change (Answering what, why, and how is a good place to start)
- Allow for some time for discussion
- (optional) If your PR has merge conflicts, pull the latest from
main
, then rebase your changes onto it - Merge the PR once you have at least two approvals and all CI checks pass
All changes to the code base must be submitted as a Pull Request (PR) and approved by at least two members of the team before it can be merged to main. This gives contributors and the team a chance to review and discuss changes and helps create a record of the project's history.
If you're unsure about your change, feel free to open a PR for discussion or make an RFC (request for comments) PR. PRs can also be in a Work In Progress (WIP) state as long as they are marked clearly.
Generally, follow these rules for creating a PR:
- Keep it simple
- Keep changes as small as possible
- Write tests for changes & try to maintain or improve code coverage
- Write documentation for changes
- For new components and feature additions to existing components, add stories to the Storybook
- Announce your PR to the appropriate channels in Slack
- Allow enough time for everyone to review and discuss your PR
- Remember that not every PR will be merged, but that's okay