Remove gadget links from tutorial (#780)
[dygraphs.git] / DEVELOP.md
CommitLineData
341a2d65
DV
1## dygraphs developer notes
2
3So you've made a change to dygraphs and would like to contribute it back to the open source project. Wonderful!
4
5This is a step-by-step guide explaining how to do it.
6
7### How-to
8
2d0fdf6e
PK
9To install dependencies, run
10
11 npm install
12
341a2d65
DV
13To build dygraphs, run
14
e4fd77b3 15 npm run build
341a2d65
DV
16
17To run the tests, run:
18
e4fd77b3
DV
19 npm run build-tests
20 npm run test
341a2d65 21
e4fd77b3 22To iterate on the code, run:
341a2d65 23
e4fd77b3 24 npm run watch
341a2d65 25
e4fd77b3 26and open `tests/demo.html` (or one of the other demos) in your browser.
341a2d65 27
e4fd77b3
DV
28To iterate on a unit test, run the `watch` command above and open
29
30 auto_tests/runner.html
31
32in your browser. You can use the Mocha UI to run just a single test or suite.
33Or you can change `it` to `it.only` to do run just one test in code.
341a2d65 34
a6d0469d
DV
35To run a single test from the command line, you can use:
36
37 npm run test -- --grep highlight-series-background
38
39(Note the extra `--`.)
40
341a2d65
DV
41### dygraphs style
42
43When making a change, please try to follow the style of the existing dygraphs code. This will make the review process go much more smoothly.
44
45A few salient points:
46
471. We try to adhere to Google's [JS style guide][gstyle] and would appreciate it if you try to as well. This means:
48 * No tabs! Indent using two spaces.
49 * Use camelCase for variable and function names.
50 * Limit lines to 80 characters.
511. If you've added a new feature, add a test for it (in the tests/ directory) or a gallery entry.
521. If you've added an option, document it in `dygraph-options-reference.js`. You'll get lots of warnings if you don't.
531. If you've fixed a bug or added a feature, add a unit test (in `auto_tests`) for it.
54
55Adding a unit test ensures that we won't inadvertently break your feature in the future. To do this, either add to an existing test in `auto_tests/tests` or create a new one.
56
57### Sending a Pull Request
58
59To make a change, you'll need to send a Pull Request. See GitHub's documentation [here][pr].
60
61[gstyle]: http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml
62[pr]: http://help.github.com/send-pull-requests/