Following prerequisites must be installed for developing the plugin
-
Install dependencies
yarn install
-
Build plugin in development mode or run in watch mode
yarn dev # or yarn watch
-
Build plugin in production mode
yarn build
-
Run the tests (using Jest)
# Runs the tests and watches for changes yarn test # Exists after running all the tests yarn lint:ci
-
Spin up a Grafana instance and run the plugin inside it (using Docker)
yarn server
-
Run the E2E tests (using Cypress)
# Spin up a Grafana instance first that we tests against yarn server # Start the tests yarn e2e
-
Run the linter
yarn lint # or yarn lint:fix
-
Update Grafana plugin SDK for Go dependency to the latest minor version:
go get -u github.com/grafana/grafana-plugin-sdk-go go mod tidy
-
Build backend plugin binaries for Linux, Windows and Darwin:
mage -v
-
List all available Mage targets for more commands:
mage -l
-
Navigate to the Locally Running Grafana.
in docker-compose.yaml
file, search for development: false
and replace it with development: true
.
This starts an enhanced framework that automatically rebuilds and reloads the plugin inside the grafana container. The go debugger is attached to the plugin and listen on localhost:2345.
You can start a debug session from your local IDE and set breaking points as you would do on local development.