React UI component library and storybook 📓
component-library is built and tested with Yarn. Please follow their install instructions to get Yarn installed on your system.
Then, run these commands:
git clone git@github.com:rcanalytics/component-library.git
cd component-library
yarn install
yarn build
yarn build # builds all packages
yarn start # starts storybook server
yarn test # runs tests in all packages
First do the steps in "Getting started", then start the Storybook server:
yarn start
Next, put a file in packages/<component-dir>/examples/<name>.example.js
and make it look like this:
import React from 'react';
// The name of the example (always name the variable `name`)
let name = 'Basic';
// The example to render (always name the function `Example`)
function Example() {
return <div>Cool cool cool</div>;
}
// Assign the name to the example and then export it as a named constant
Example.story = { name };
export const Comp = Example;
// Default export an object with the title matching the name of the Reach package
export default { title: 'Dialog' };
Now you can edit the files in packages/*
and storybook will automatically reload your changes.
First do the steps in "Getting Started", then:
yarn test
Or if you want to run the tests as you edit files:
yarn test --watch
Often you'll want to just test the component you're working on:
cd packages/<component-path>
yarn test --watch
This is our current release process. We might be able to put some of this in a script...
# First, run the build locally and make sure there are no problems
# and that all the tests pass:
$ yarn build
$ yarn test
# Generate the changelog and copy it somewhere for later. We'll
# automate this part eventually, but for now you can get the changelog
# with:
$ yarn changes
# Then create a new version and git tag locally. Don't push yet!
$ yarn ver [version]
# Take a look around and make sure everything is as you'd expect.
# You can inspect everything from the commit that lerna made with:
$ git log -p
# If something needs to be changed, you can undo the commit and
# delete the tag that lerna created and try again.
# If everything looks good, push to GitHub along with the new tag:
$ git push origin master --follow-tags
# Paste the changelog into the release on GitHub. The release is
# complete … huzzah!
You need to be careful when publishing a new package because the lerna publish
on Travis CI will fail for new packages. To get around this, you should publish a 0.0.0
version of the package manually ahead of time. Then the release from CI will be ok. This is really janky but AFAICT the only workaround.
The website is a Docusaurus app in the website
directory.
Apache-2.0 © Real Capital Analytics