Comic Relief Storybook for React components
React components to build the Comic Relief front-end experience
npm install
npm run storybook
Then import your component(s) into stories/index.js and render them like so:
storiesOf("Some component name", module)
.add("Default", () => (
<ComponentName ></ComponentName>
))
.add("Some variation", () => (
<ComponentName prop="value" ></ComponentName>
));
Our target is to cover:
In order to run unit tests
yarn test
yarn test-update
You may need it to update snapshots after intentional layout changesTo build storybook components locally within an app, please use npm link
. Learn how to do this here
Then import your component(s) into components/index.js and rebuild build files via yarn build
Ensure packages are installed with correct version numbers by running:
npm install @comicrelief/storybook --save
import { Footer, FileUp } from '@comicrelief/storybook';
In some cases there is documentation for a specific component in a README.md
inside its own directory.
Git commit messages are used to automatically publish a new version of npm package. To achieve this, every commit message should have a type and a message in the format that is described below.
Travis CI will run a job automatically after PR is merged and analyze all commit messages since last npm release. Then semantic-release plugin will calculate new version according to this result.
To avoid commit loops, version numbers are not committed back to package.json
. Versions are listed on GitHub releases and used in the modified package.json @comicrelief/storybook">published to npm.
Commit messages are expected to be in this format:
<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
Minimally, only type
and subject
is required.
When there are no breaking changes or adding no new features. When we are fixing bugs or styles.
fix: A bug fix
When there is a new feature / functionality is added to the library
feat: A new feature
When there is a breaking change, we need to extend our commit message and add BREAKING CHANGE: A
description of the change
to its body. This message can be added to any type of commit.
Example:
feat: A new feature
BREAKING CHANGE: A description of the change
Commitizen library is added as npm dev dependency and it can be used to generate commit messages by
answering a few questions and skipping the ones which are not relavent.
Example workflow:
git add .
to add changed files and get ready to commityarn commit
This will start an interactive process to build commit message. Simply answer all questions or
press Enter
to skip.