|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the plugin! 🙏 |
| 4 | + |
| 5 | +## Contribute code |
| 6 | + |
| 7 | +### Set up the plugin |
| 8 | + |
| 9 | +This project uses GitHub Pull Requests to manage contributions. If this is your first time contributing to a project on GitHub, you should first learn how to [fork a project and make a pull request](https://guides.github.com/activities/forking/). |
| 10 | + |
| 11 | +To build and run the plugin locally, you first need to: |
| 12 | + |
| 13 | +- [Install Node.js](https://nodejs.org/en/download/) |
| 14 | +- [Fork the project](https://guides.github.com/activities/forking/#fork) |
| 15 | + |
| 16 | +Then enter the following in your terminal: |
| 17 | + |
| 18 | +```bash |
| 19 | +cd path/to/your/clone |
| 20 | +yarn install |
| 21 | +yarn build |
| 22 | +``` |
| 23 | + |
| 24 | +If the commands ran successfully without errors, then you're ready to go! 🚀 |
| 25 | + |
| 26 | +> **Note:** Instead of `yarn build` you can also run `yarn watch`, which rebuilds the plugin whenever the source code changes. |
| 27 | +
|
| 28 | +### Set up Grafana for plugin development |
| 29 | + |
| 30 | +Grafana loads plugins from any directory under the Grafana plugin directory. |
| 31 | + |
| 32 | +By default, Grafana doesn't load unsigned plugins. To load the development build of the plugin, you need to configure Grafana to allow it by adding the following to your Grafana configuration file: |
| 33 | + |
| 34 | +```bash |
| 35 | +[plugins] |
| 36 | +allow_loading_unsigned_plugins = marcusolsson-json-datasource |
| 37 | +``` |
| 38 | + |
| 39 | +You can also configure this using environment variables: |
| 40 | + |
| 41 | +```bash |
| 42 | +export GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=marcusolsson-json-datasource |
| 43 | +``` |
| 44 | + |
| 45 | +#### Local installation |
| 46 | + |
| 47 | +If you're running Grafana locally, then you can either move or symlink the project directory to the Grafana plugin directory. |
| 48 | + |
| 49 | +```bash |
| 50 | +# Linux and macOS |
| 51 | +ln -s /path/to/your/clone /var/lib/grafana/plugins |
| 52 | +``` |
| 53 | + |
| 54 | +#### Docker |
| 55 | + |
| 56 | +If you have Docker installed, then you can instead mount the plugin into the container: |
| 57 | + |
| 58 | +```bash |
| 59 | +docker run --rm \ |
| 60 | + -v /path/to/your/clone:/var/lib/grafana/plugins \ |
| 61 | + -e GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=marcusolsson-json-datasource \ |
| 62 | + -p 3000:3000 \ |
| 63 | + grafana/grafana:8.0.0-beta2 |
| 64 | +``` |
| 65 | + |
| 66 | +## Contribute documentation |
| 67 | + |
| 68 | +This plugin uses [Docusaurus](https://docusaurus.io/) to build the [documentation](https://marcus.se.net/grafana-json-datasource). |
| 69 | + |
| 70 | +For more information about writing documentation using Docusaurus, refer to the [Docusaurus documentation](https://docusaurus.io/docs/). |
| 71 | + |
| 72 | +The individual documentation pages are written in Markdown. You can find them under [website/docs](website/docs). |
| 73 | + |
| 74 | +To preview the documentation site on your local machine, run the following commands in your terminal: |
| 75 | + |
| 76 | +```bash |
| 77 | +cd website/docs |
| 78 | +yarn start |
| 79 | +``` |
0 commit comments