Follow the instructions below to get started. Branch from main
, and submit a pull request when you're ready.
- All commit messages must follow the conventional commit format. Read below if you are unfamiliar with the standard or the available types.
- You must restrict your commits to one package at a time: e.g. don't make one commit that changes files inside
components
andcss
- it impacts how versions are bumped. - We use
yarn
: these instructions presume you have this installed.
- Clone the repository and run
yarn setup
to install dependencies and build all packages:
git clone [email protected]:transferwise/neptune-web.git && cd neptune-web && yarn setup
-
Familiarise yourself with our code conventions and accessibility guidelines.
-
Refer to
CONTRIBUTING.md
inside each package for more information on working within that package.
Almost always from within the package you're working in. For example, if you're making changes to components
, run your yarn commands from that package:
cd packages/components
yarn dev
The two exceptions to this rule are the initial setup, and running the docs (which require all packages to be built). These should be done here, at the root of the monorepo.
yarn setup
yarn docs
The full list of commands available to run from the root directory are:
setup
- installs dependencies and runs build in all packagesbuild
- builds all packagesclean
- removesnode_modules
and cached builds from all packagesdocs
- builds all packages and starts the Neptune Web docslint
- lints all packages (JS, TS and style files)test
- runs tests in all packagescreate-component
- creates all the necessary files needed when a react component gets added to the library
As said above, we recommend running most commands from within the package you're working in.
If you wish to test your changes in some consumer codebase and yarn link
is not so sufficient or/and convenient approach, then you can easily publish beta version(s) on NPM registry and use it in any NPM repository.
Steps:
- Push changes into your feature/fix branch
- Find your workflow run in GitHub Actions
- Approve
beta
deployment - Lerna will publish affected packages tagged as beta
Set the exact beta version without any update types or version ranges (e.g
^
,~
) as usually NPM clients tend to opt-out installing beta (unstable) versions, correct example:
// package.json
"@transferwise/neptune-css": "10.0.6-beta-2ffb6cde65.61",
We have visual tests running on percy.io & Storybook. It compares screenshots of your changes against the main
branch.
To run the visual tests, go to GitHub Actions, find your workflow run and approve visual-test
deployment. Find the link for the results in the job output.
The job will be marked as passed/green even if the visual tests are failed.
We follow Semantic Versioning. We require that commit messages follow the conventional commit standard. In this way, we can automatically bump the version of our packages when necessary.
These rules apply to both normal commit messages and PR titles (if you are using squash and merge).
The rules are simple:
- All your commit messages must follow the format
<type>(scope?): subject
- The type must be one of the following: [
fix
,feat
,refactor
,build
,chore
,docs
,perf
,test
] - If you are fixing something, use
fix
. This will bump the patch version. - If you are adding a new feature, use
feat
. This will bump the minor version. - Breaking changes must have the words
BREAKING CHANGE:
as the first two words in the commit description. We also add a!
after the type to make it obvious in the commit log.* For example:
feat!: Some feature
BREAKING CHANGE: Description of breaking changes
Using anything other than fix
or feat
without a !
will not trigger a version bump. This is useful for changes to CI config, documentation or tests. Feel free to choose the type that best reflects the work you're doing.
You can optionally use a scope to describe where in the code you're working: e.g. feat(components): adding new functionality to Accordion
.
Some examples:
fix: fix a bug
feat: add a new feature or component
feat!: modify the API of an existing component
docs: update the docs
refactor(components): refactor the implementation of an existing component
chore: update
Generally the core design system team will handle breaking change releases. If you are planning a breaking change, please talk to us.
The documentation and the new npm release will be automatically deployed when merging changes to main
. Our use of conventional commits means we can bump package versions automatically based on the changes made. It also allows us to generate Changelogs.