### Install Dependencies and Run Development Server Source: https://github.com/grafana/grafana-plugin-examples/blob/main/CONTRIBUTING.md Navigate to the specific example directory, install its dependencies, and start the development server. Ensure you build the backend if the plugin has one. ```bash cd path/to/your/clone/examples/ npm install npm dev ``` ```bash mage build:backend ``` ```bash docker compose up --build ``` -------------------------------- ### Install Plugin Dependencies Source: https://github.com/grafana/grafana-plugin-examples/blob/main/examples/app-basic/README.md Run this command to install all necessary Node.js dependencies for your plugin. ```bash npm install ``` -------------------------------- ### Spin Up Grafana Instance for Development Source: https://github.com/grafana/grafana-plugin-examples/blob/main/examples/app-basic/README.md Starts a Dockerized Grafana instance to run and test your plugin locally. ```bash npm run server ``` -------------------------------- ### Build Plugin Backend Binaries Source: https://github.com/grafana/grafana-plugin-examples/blob/main/examples/app-with-backend/README.md Build plugin backend binaries for Linux, Windows, and Darwin using Mage. ```bash mage -v ``` -------------------------------- ### Build Plugin in Production Mode Source: https://github.com/grafana/grafana-plugin-examples/blob/main/examples/app-basic/README.md Generates a production-ready build of your plugin. ```bash npm run build ``` -------------------------------- ### List Available Mage Targets Source: https://github.com/grafana/grafana-plugin-examples/blob/main/examples/app-with-backend/README.md List all available Mage targets for additional commands. ```bash mage -l ``` -------------------------------- ### Run Tests (CI) Source: https://github.com/grafana/grafana-plugin-examples/blob/main/examples/datasource-basic/README.md Runs all tests once and then exits, suitable for continuous integration environments. ```bash # Exits after running all the tests npm run test:ci ``` -------------------------------- ### Create Plugin Version Tag Source: https://github.com/grafana/grafana-plugin-examples/blob/main/examples/app-with-backend/README.md Create a new version tag for the plugin using npm version, then push the tag to GitHub. ```bash npm version git push origin main --follow-tags ``` -------------------------------- ### Build Plugin in Development Mode Source: https://github.com/grafana/grafana-plugin-examples/blob/main/examples/app-basic/README.md Compiles the plugin for development and enables watch mode for automatic rebuilding on changes. ```bash npm run dev ``` -------------------------------- ### Run Unit Tests Source: https://github.com/grafana/grafana-plugin-examples/blob/main/examples/app-basic/README.md Executes unit tests using Jest. Requires Git to be initialized. Use `test:ci` to run tests once and exit. ```bash # Runs the tests and watches for changes, requires git init first npm run test # Exits after running all the tests npm run test:ci ``` -------------------------------- ### Push Version Tag to GitHub Source: https://github.com/grafana/grafana-plugin-examples/blob/main/examples/app-basic/README.md Uploads the new version tag to your GitHub repository, triggering the release workflow. ```bash git push origin main --follow-tags ``` -------------------------------- ### Create Plugin Version Tag Source: https://github.com/grafana/grafana-plugin-examples/blob/main/examples/app-basic/README.md Increments the version number in your plugin's package.json and prepares it for release. ```bash npm version ``` -------------------------------- ### Run Tests (Development) Source: https://github.com/grafana/grafana-plugin-examples/blob/main/examples/datasource-basic/README.md Executes tests using Jest and continues to watch for file changes to re-run tests. Requires Git to be initialized in the project. ```bash # Runs the tests and watches for changes, requires git init first npm run test ``` -------------------------------- ### Run Linter Source: https://github.com/grafana/grafana-plugin-examples/blob/main/examples/app-basic/README.md Checks your code for style and potential errors using ESLint. Use `lint:fix` to automatically correct issues. ```bash npm run lint # or npm run lint:fix ``` -------------------------------- ### Update Grafana Plugin SDK for Go Source: https://github.com/grafana/grafana-plugin-examples/blob/main/examples/app-with-backend/README.md Update the Grafana plugin SDK for Go dependency to the latest minor version and tidy up the go modules. ```bash go get -u github.com/grafana/grafana-plugin-sdk-go go mod tidy ``` -------------------------------- ### Version and Push Tag Source: https://github.com/grafana/grafana-plugin-examples/blob/main/examples/datasource-basic/README.md Updates the plugin version and pushes the new version tag to the main branch, triggering the GitHub Actions release workflow for signing. ```bash Run `npm version ` Run `git push origin main --follow-tags` ``` -------------------------------- ### GitHub Actions Workflow for Automated API Compatibility Checks Source: https://github.com/grafana/grafana-plugin-examples/blob/main/README.md Integrate API compatibility checks into your CI/CD pipeline using this GitHub Actions workflow. It checks compatibility on every push and can comment on pull requests. ```yaml name: Compatibility check on: [push] jobs: compatibilitycheck: permissions: # Required permissions when comment-pr is set to 'yes': pull-requests: write, contents: read pull-requests: write contents: read runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - uses: actions/setup-node@v4 with: node-version: "22" - name: Install dependencies run: npm install - name: Build plugin run: npm run build - name: Compatibility check uses: grafana/plugin-actions/is-compatible@main with: module: "./src/module.ts" comment-pr: "yes" fail-if-incompatible: "no" ``` -------------------------------- ### Test Plugin API Compatibility with Specific Grafana Version Source: https://github.com/grafana/grafana-plugin-examples/blob/main/README.md This command allows you to test your plugin's API compatibility against a specific version of Grafana. Ensure you list the target packages with their exact version numbers. ```bash npx @grafana/levitate@latest is-compatible --path src/module.ts --target @grafana/data@9.0.5,@grafana/ui@9.0.5,@grafana/runtime@9.0.5 ``` -------------------------------- ### Test Plugin API Compatibility with Latest Grafana Release Source: https://github.com/grafana/grafana-plugin-examples/blob/main/README.md Use this command to check if your plugin's TypeScript code is compatible with the latest Grafana APIs. Specify the path to your module and the Grafana packages to target. ```bash npx @grafana/levitate@latest is-compatible --path src/module.ts --target @grafana/data,@grafana/ui,@grafana/runtime ``` -------------------------------- ### Run End-to-End Tests Source: https://github.com/grafana/grafana-plugin-examples/blob/main/examples/app-basic/README.md Executes E2E tests using Playwright against a running Grafana instance. You can specify a Grafana version. ```bash # Spins up a Grafana instance first that we tests against npm run server # If you wish to start a certain Grafana version. If not specified will use latest by default GRAFANA_VERSION=11.3.0 npm run server # Starts the tests npm run e2e ``` -------------------------------- ### Set Grafana API Key Secret Source: https://github.com/grafana/grafana-plugin-examples/blob/main/examples/datasource-basic/README.md Configures the 'GRAFANA_API_KEY' secret in GitHub repository settings, which is required for the release workflow to sign plugins. ```bash Please navigate to "settings > secrets > actions" within your repo to create secrets. Click "New repository secret" Name the secret "GRAFANA_API_KEY" Paste your Grafana Cloud API key in the Secret field Click "Add secret" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.