- Fork repository by clicking the fork button on github
- Clone repository with
git clone https://github.com/<your handle>/britecharts-react.git
- Navigate to the repository folder and install dependencies with:
yarn install
(we require node 6.11.x at the moment) - If you don't have yarn installed, it can be easily installed with homebrew following the instruction in the yarn docs
-
in local master, set upstream to https://github.com/eventbrite/britecharts-react.git
git remote add upstream https://github.com/eventbrite/britecharts-react.git
-
pull the most recent changes by rebasing master
git pull --rebase upstream master
-
Branch names should be prefixed with either
fix-
orfeat-
depending on your PR content. Create a new branch by typing:git checkout -b [fix|feat]-<your branch name>
In order to generate the demos and see the documentation for the library you would need to:
-
Download and install node (note we need npm version 2.X)
-
Ensure you have yarn installed as well
-
Clone the repository with:
git clone git@github.com:eventbrite/britecharts-react.git
-
Change directory into the repository root and install its dependencies:
yarn install
-
In the root or the repository folder, run:
yarn run test
-
In a second terminal window, run:
yarn run styleguide
This process will generate the styleguide and show it in localhost:6060
. You can use this demos as your testing platform when creating new charts.
We have created this components with Tests First, and we encourage you to do the same. However, you can also write tests later.
For a TDD workflow, the process would look like this:
- Create a new branch for your modification
- On a new terminal, run
yarn start
andyarn run styleguide
and navigate to the chart's demo or create a new demo in/src/charts/*/Readme.md
- Find the test of the chart you want to modify in
/src/charts/*/*.test.js
- Write a failing test for the feature you want to add
- On a new terminal, run
yarn run test:watch
- Check that the test fail
- Write the code that would make that test pass on the chart located in
/src/charts/*/*Component.js
or/src/charts/*/*Chart.js
. Please follow the code style in the current files. - Make the test pass by writing the less amount of code
- Refactor until you get a nice and clean code
- Check the demo to see the code in action
- Update the documentation so that the proper demos gets generated when you run
yarn run styleguide:build
- Create a pull request and ask people of the team to review it
- Once you have the OK, merge it!
Adding a new chart is a bunch of work, but we hope that using the current code and documentation will help in the process.
- Create a new branch for your new chart
- On a new terminal, run
yarn start
yarn run styleguide
to get ready the demos and turn on the dev server. - Given that you new chart is
ChartName
, create in/src/charts/ChartName
a new fileChartName.js
and test fileChartName.test.js
. - Create also a new component in
/src/charts/ChartName
a new fileChartNameComponent.js
and test fileChartNameComponent.test.js
. - Add the new demo entry on
/src/charts/ChartName/Readme.md
, keeping the same format. - Go to
webpack.config.js
and add the new chart to theCHARTS
object, follow the same style. - Go to your test file
ChartName.test.js
and, taking another test as an example, copy over pieces until you have the first test case. - Add one test and make it fail calling
yarn run test:watch
. - Keep on coding according to the code style you can see in the current charts, using the stackedAreaChart as a reference.
- Generate your docs with
yarn run styleguide:build
and manually test the demos. - Create a pull request with your branch and ping one of the core authors to get it reviewed.
- Once you have a shipit, merge it
Alternatively, you can use Plop to generate the boilerplate for your new component, if the component already exists in Britecharts.
- Create a new branch for your new chart
- On a new terminal, run
yarn start
yarn run styleguide
to prepare the demos and turn on the dev server. - On a new terminal, run
yarn run plop
. When prompted, enter your chart's name (be sure to use PascalCase capitalization!). This will generate a new folder for your component insrc/charts/chartName
, with all necessary files. - Before starting to modify the boilerplate, start the test suite:
yarn run test:watch
. - Follow the tasks in
src/charts/chartName/Checklist.md
to complete your component - Once completed, create a pull request with your branch and ping one of the core authors to get it reviewed.
- Once you have a shipit, merge it
Disclaimer -> While it is true that Britecharts-React is currently live in Eventbrite production, this project is not being monitored closely for open source contributions. Please have patience and we will get to any issues and pull requests as soon as we can.
1- when you're finished coding, git checkout master
2- git pull upstream master
(note that your local master should always reflect upstream master)
3- git checkout <your branch>
4- git rebase master
& reconcile all conflicts
5- git push origin <your branch>
6- make your pr with a link to the original issue filed (if you see "unable to merge", please pull from your upstream and rebase again)
7- be patient :)
Please use the issues section of the Britecharts-React github profile to submit any bugs found. Please be descriptive and feel free to add pictures or links to docs to make your point as clear as possible.
The build sequence consists of a small set of Node tasks. While you'll probably only need yarn run test
and yarn run build
most of the time, the other tasks can be called independently or combined in order to see the docs.
Task | Description |
---|---|
yarn run start |
Start the development process that is going to transpile the files |
yarn run test |
Run the Jest runner to see if the tests are running |
yarn run test:watch |
Start the Jest runner that will test the project and keep watching for changes. |
yarn run styleguide |
Serves the demos in localhost:6060. |
yarn run styleguide:build |
Builds the styleguide. |
yarn run build |
Build everything and generate the distribution version of the charts. |
yarn run lint |
Runs the eslint linter |
yarn run lint:fix |
Runs the eslint linter fixing easy problems |
yarn run release |
Create a new release of the library. |
yarn run release:minor |
Create a new release of the library by bumping the second number of the version (1.N.1) |
yarn run release:major |
Create a new release of the library by bumping the third number of the version (N.1.1) |
The default directory structure looks something like this:
britecharts-react
├── dist
├── docs
├── lib
├── src
│ ├── charts
│ ├── docs
│ ├── helpers
│ └── tasks
Folder | Description |
---|---|
dist | Where the production ready bundle of our charts will be placed |
docs | Where the generated demo website lives |
lib | Where the production ready individual UMD bundles will live, alongside with the ES6 modules version of them |
src | Where we will place the code we create |
src/charts | Where our charts live |
src/charts/helpers | Where our chart helpers live |
src/helpers | Where our general helpers live, like test data generators |
src/tasks | Some of our grunt tasks configuration |