The Puppet Design System is a cross-functional team effort across Puppet with shared ownership where contributions are encouraged. Though designed for and maintained by Puppet, outside PRs are welcome. A good place to start is by visiting #team-design-system in Puppet's internal Slack or contacting puppet-design-system@puppet.com.
- Install
- Run website locally
- Local development with consuming app
- Testing
- Pull requests and publishing
Clone the design-system monorepo:
git clone git@github.com:puppetlabs/design-system.git && cd design-system
The required version of Node.js can be found in .nvmrc
. We recommend using nvm (Node Version Manager) to switch between different versions of Node. If you have nvm installed, run the following command in the design-system directory to get the right version before performing other commands with npm:
nvm install && nvm use
Run npm install
in the root of the design-system to install all package dependencies (which uses Lerna to link local packages together and hoist duplicate dependencies up to the top directory to reduce install time):
npm install
You can run the http://puppet.style website locally in order to develop components in a sandbox without a separate consuming application. It is built with Styleguidist, which provides an isolated React component development environment as well a living style guide:
npm start
To develop locally using a separate app that consumes a design-system package:
- Run
npx lerna run link
(which will runnpm link
in consumable packages). - Run
npm link @puppet/<package-name>
in the consuming app. - Run
npx lerna run --parallel watch
to rebuild packages on change ( or justnpm run watch
in the desired package).
Run npm test
in the top folder to test all packages, or npm test
in the desired package. You can also run npm lint
to check for code formatting errors or npm format
to attempt to automatically fix them.
- Granularity: Make commits of logical units (ideally with each commit passing tests, and formatting and refactoring in separate commits).
- Commit summary: The first line should be no more than 72 characters (with any extra details or motivation in the commit body).
- Tense: Use the imperative present tense (e.g. "Add feature", not "Added feature") to describe what changed from the consumer's perspective in the commit summary.
Don't do this |
See more guidelines for contributors and maintainers in the Principles, Patterns, and Guidelines doc.
Once you have made a change and verified that it works locally including in the Styleguidist website, put up a PR. The author should own seeking review and merging/publishing. Publishing packages to npm is automated with Relay when a PR is merged to main
or releases/alpha
if Lerna detects a new version in a package's package.json
that doesn't yet exist on npm.
- Branch: Create a PR from your branch. Note that we usually push the branch directly to this repository rather than a fork.
- Target the
main
branch (the default branch) if the change should be published upon merge. - Target the
releases/alpha
branch if it includes a breaking change. - Target a feature branch if the change shouldn't be released yet. For example, a "feature" or "integration" branch can be used if you want to batch up multiple changes into a single release, which would then need to be followed up with another PR from that branch to
main
for a release.
- Target the
- Changelog: Add a line about your change to the package's CHANGELOG.md.
- Add a heading with the release date. Note that you may use "Unreleased" if it's not going to be released yet.
- Add context and be specific about the change by prefixing the change with the component affected and referencing props by name.
- Version: Update the version to be published, following semver for patch, minor, and major versions. Note that alpha versions also follow semver, in the form
6.0.0-alpha.3
.- Increment the version in the appropriate
package.json
files, e.g. packages/react-components/package.json. - Also increment the version in the corresponding
package-lock.json
files. When updating a single package, this is most easily done by simply manually incrementing theversion
field in thepackage-lock.json
file to match, but can also be done by runningnpm install
, though you may have to rungit clean -dfX
first to force them to update. - Note: Other packages in this project that depend on the incremented package may also need to be udpated to point to the new version, otherwise, you could end up with multiple versions due to the use of lockfiles.
- Increment the version in the appropriate
- Review: Get a +1 on the PR. Feel free to ping people to find a reviewer. The design-system-codeowners team should be able to help.
- Merge: Merge the PR. Merging to
main
orreleases/alpha
will trigger a github workflow that runs thenpm run publish
command. - Verify: Verify the new version got published, e.g. by checking https://www.npmjs.com/package/@puppet/react-components.