You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+36-7Lines changed: 36 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,33 @@
1
1
# Observable Plot - Contributing
2
2
3
-
Observable Plot is released under the ISC license. You are welcome to fork this repository and to send us pull requests to contribute bug fixes or new features.
3
+
Observable Plot is released under the ISC license. You are welcome to [fork this repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo) and to [send us pull requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) to contribute bug fixes or new features.
4
4
5
-
To develop Observable Plot locally, clone this repository and install its dependencies:
# 2. Install dependencies listed in the package.json file
10
15
yarn
11
16
```
12
17
13
-
Plot is written in ES modules and uses [Vite](https://vitejs.dev/) for development; this means that you can edit the Plot source code and examples, and they’ll update live as you save changes. To start Vite:
18
+
## Development
19
+
20
+
Plot is written in ES modules and uses [Vite](https://vitejs.dev/) for development; this means that you can edit the Plot source code, and the test plots will update live in your browser as you save changes. To start Vite:
14
21
15
22
```
16
23
yarn dev
17
24
```
18
25
19
-
This should open http://localhost:8008/ where you can browse the tests.
26
+
This should open http://localhost:8008/ in your browser where you can see the tests plots defined in `test/plots`.
27
+
28
+

29
+
30
+
If you’d like to create a new test plot as part of your development, see the instructions below for *snapshot tests*.
When a snapshot test is run, its output is compared against the SVG snapshot saved in the `test/output` folder. This makes it easier to see the effect of code changes and to catch unintended changes.
55
+
When a snapshot test is run, its output is compared against the SVG or HTML snapshot saved in the `test/output` folder. This makes it easier to see the effect of code changes and to catch unintended changes.
45
56
46
57
To add a new snapshot test, create a new JavaScript file in the `test/plots` folder. Then register your test in the test registry, `test/plots/index.js`. Once you’ve registered your test, it will also appear automatically in the test browser (http://localhost:8008), where you can inspect and debug the output. (Snapshot tests must have deterministic, reproducible behavior; they should not depend on live data, external servers, the current time, the weather, etc. To use randomness in a test, use a seeded random number generator such as [d3.randomLcg](https://github.com/d3/d3-random/blob/master/README.md#randomLcg).)
47
58
@@ -59,3 +70,21 @@ If your code intentionally changes some of the existing snapshots, simply blow a
59
70
rm -rf test/output
60
71
yarn test
61
72
```
73
+
74
+
## Documentation
75
+
76
+
Please update the [README.md](./README.md) to reflect any changes to Plot’s public API, and reference any related [issues](https://github.com/observablehq/plot/issues).
77
+
78
+
If you’d like to share a motivating example in an Observable notebook, you can bundle your changes into a single file:
79
+
80
+
```bash
81
+
# Compile into the file `dist/plot.umd.js`
82
+
yarn prepublishOnly
83
+
```
84
+
85
+
You can then attach the `dist/plot.umd.js` file to your notebook using a [File Attachment](https://observablehq.com/@observablehq/file-attachments), and load it into your notebook:
0 commit comments