Skip to content

Latest commit

 

History

History
99 lines (63 loc) · 1.83 KB

DEVELOPMENT.md

File metadata and controls

99 lines (63 loc) · 1.83 KB

Developing the Plugin

Following prerequisites must be installed for developing the plugin

Frontend

  1. Install dependencies

    yarn install
  2. Build plugin in development mode or run in watch mode

    yarn dev
    
    # or
    
    yarn watch
  3. Build plugin in production mode

    yarn build
  4. Run the tests (using Jest)

    # Runs the tests and watches for changes
    yarn test
    
    # Exists after running all the tests
    yarn lint:ci
  5. Spin up a Grafana instance and run the plugin inside it (using Docker)

    yarn server
  6. Run the E2E tests (using Cypress)

    # Spin up a Grafana instance first that we tests against 
    yarn server
    
    # Start the tests
    yarn e2e
  7. Run the linter

    yarn lint
    
    # or
    
    yarn lint:fix

Backend

  1. 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
  2. Build backend plugin binaries for Linux, Windows and Darwin:

    mage -v
  3. List all available Mage targets for more commands:

    mage -l
  4. Navigate to the Locally Running Grafana.

Debugging

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.