Contribution guide
To setup the development environment, clone this repository and install its dependencies.
We use Storybook for component development. To create a new component:
- Create the component structure in
src/components
- Create a story in
stories
for the component - Spin up Storybook with
yarn storybook
- Use Storybook's sandbox to develop the component
- Don't forget to add component documentation
FormerKit gives a special attention to theme
prop in all components. It's a key public interface for customization and developers should definitely spend time thinking about the ideal shape for this property. That said, it's also important that the shape of theme
prop is properly well documented by inline comments.
As FormerKit doesn't specify a default theme, we have bundled Pagar.me Skin for development purposes. If you happen to need to change something in the theme (or develop a new one) you can use npm/yarn links to achieve a (mostly) seamless development process.
- Clone
former-kit-skin-pagarme
package and enter into its directory - Use
yarn link
inside skin directory to register the package as "linkable" - In
former-kit
directory useyarn link former-kit-skin-pagarme
Refer to former-kit-skin-pagarme for development instructions.
There are some details to pay attention when contributing a new component. Here's a checklist:
- Write tests and reach a coverage of at least 80% (
yarn test --coverage
) - Write a story for the component in Storybook (
yarn storybook
) - Add props documentation and examples on Styleguidist (
yarn styleguide
) - Check carefully for Storyshots to see the impact of your changes (checked on
yarn test
). - When confident, update the snapshots (
yarn test --updateSnapshot
) - Add storyshots snapshot file to the same commit the changes were made.
- Be sure
yarn.lock
is up to date (yarn
)
This are the common guidelines to contribute to this project. Please ensure the following guidelines are being followed by you and any other contributor.
Don't ask us to pull from your master branch.
We follow the pagarme/git-style-guide. Every commit/branch/pull_request must follow its guidelines.
Be sure to write tests for features or fixes you implement. Make absolutely sure all tests are passing for each commit.
If you want to do more than one thing, send multiple pull requests.
Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.
Make sure that yarn.lock
and any other lockfile is updated when they should be. Example: Doesn't add lockfiles as separate commits.