@grafana/create-plugin 6.2.0-canary.2283.19289604632.0 → 6.2.0-canary.2314.19503588692.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +74 -0
- package/dist/migrations/migrations.js +10 -0
- package/dist/migrations/scripts/006-webpack-nested-fix.js +80 -0
- package/dist/migrations/scripts/007-remove-testing-library-types.js +25 -0
- package/package.json +3 -2
- package/src/migrations/migrations.ts +11 -0
- package/src/migrations/scripts/006-webpack-nested-fix.test.ts +169 -0
- package/src/migrations/scripts/006-webpack-nested-fix.ts +117 -0
- package/src/migrations/scripts/007-remove-testing-library-types.test.ts +137 -0
- package/src/migrations/scripts/007-remove-testing-library-types.ts +25 -0
- package/templates/backend/go.mod +67 -47
- package/templates/backend/go.sum +197 -222
- package/templates/backend-app/go.mod +67 -48
- package/templates/backend-app/go.sum +197 -222
- package/templates/common/.config/types/setupTests.d.ts +1 -0
- package/templates/common/.config/webpack/webpack.config.ts +1 -1
- package/templates/common/_package.json +2 -3
- package/templates/github/workflows/bundle-stats.yml +1 -1
- package/templates/github/workflows/ci.yml +11 -11
- package/templates/github/workflows/cp-update.yml +1 -1
- package/templates/github/workflows/is-compatible.yml +3 -3
- package/templates/github/workflows/release.yml +1 -1
- package/templates/panel/.config/AGENTS/fundamentals.md +66 -0
- package/templates/panel/AGENTS.md +3 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -187,7 +187,7 @@ const config = async (env: Env): Promise<Configuration> => {
|
|
|
187
187
|
new ReplaceInFileWebpackPlugin([
|
|
188
188
|
{
|
|
189
189
|
dir: DIST_DIR,
|
|
190
|
-
|
|
190
|
+
test: [/(^|\/)plugin\.json$/, /(^|\/)README\.md$/],
|
|
191
191
|
rules: [
|
|
192
192
|
{
|
|
193
193
|
search: /\%VERSION\%/g,
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"author": "{{ sentenceCase orgName }}",
|
|
17
17
|
"license": "Apache-2.0",
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@grafana/eslint-config": "^
|
|
19
|
+
"@grafana/eslint-config": "^9.0.0",
|
|
20
20
|
"@grafana/plugin-e2e": "^3.0.1",
|
|
21
21
|
"@grafana/tsconfig": "^2.0.1",
|
|
22
22
|
"@playwright/test": "^1.52.0",{{#if useExperimentalRspack}}
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"@types/react": "^18.3.0",
|
|
34
34
|
"@types/react-dom": "^18.3.0",{{#if isAppType}}{{#unless useReactRouterV6}}
|
|
35
35
|
"@types/react-router-dom": "^{{ reactRouterVersion }}",{{/unless}}{{/if}}
|
|
36
|
-
"@types/testing-library__jest-dom": "5.14.8",
|
|
37
36
|
"@typescript-eslint/eslint-plugin": "^8.3.0",
|
|
38
37
|
"@typescript-eslint/parser": "^8.3.0",{{#unless useExperimentalRspack}}
|
|
39
38
|
"copy-webpack-plugin": "^11.0.0",{{/unless}}
|
|
@@ -42,7 +41,7 @@
|
|
|
42
41
|
"eslint-config-prettier": "^8.8.0",
|
|
43
42
|
"eslint-plugin-jsdoc": "^51.2.3",
|
|
44
43
|
"eslint-plugin-react": "^7.37.5",
|
|
45
|
-
"eslint-plugin-react-hooks": "^
|
|
44
|
+
"eslint-plugin-react-hooks": "^7.0.0",
|
|
46
45
|
"eslint-webpack-plugin": "^5.0.0",{{#unless useExperimentalRspack}}
|
|
47
46
|
"fork-ts-checker-webpack-plugin": "^8.0.0",{{/unless}}
|
|
48
47
|
"glob": "^10.2.7",
|
|
@@ -25,16 +25,16 @@ jobs:
|
|
|
25
25
|
env:
|
|
26
26
|
GRAFANA_ACCESS_POLICY_TOKEN: $\{{ secrets.GRAFANA_ACCESS_POLICY_TOKEN }}
|
|
27
27
|
steps:
|
|
28
|
-
- uses: actions/checkout@
|
|
28
|
+
- uses: actions/checkout@v5
|
|
29
29
|
with:
|
|
30
30
|
persist-credentials: false
|
|
31
31
|
{{#if_eq packageManagerName "pnpm"}}
|
|
32
32
|
# pnpm action uses the packageManager field in package.json to
|
|
33
33
|
# understand which version to install.
|
|
34
|
-
- uses: pnpm/action-setup@
|
|
34
|
+
- uses: pnpm/action-setup@v4
|
|
35
35
|
{{/if_eq}}
|
|
36
36
|
- name: Setup Node.js environment
|
|
37
|
-
uses: actions/setup-node@
|
|
37
|
+
uses: actions/setup-node@v6
|
|
38
38
|
with:
|
|
39
39
|
node-version: '22'
|
|
40
40
|
cache: '{{ packageManagerName }}'
|
|
@@ -61,7 +61,7 @@ jobs:
|
|
|
61
61
|
|
|
62
62
|
- name: Setup Go environment
|
|
63
63
|
if: steps.check-for-backend.outputs.has-backend == 'true'
|
|
64
|
-
uses: actions/setup-go@
|
|
64
|
+
uses: actions/setup-go@v6
|
|
65
65
|
with:
|
|
66
66
|
go-version: '1.22'
|
|
67
67
|
|
|
@@ -122,7 +122,7 @@ jobs:
|
|
|
122
122
|
ARCHIVE: $\{{ steps.metadata.outputs.archive }}
|
|
123
123
|
|
|
124
124
|
- name: Archive Build
|
|
125
|
-
uses: actions/upload-artifact@
|
|
125
|
+
uses: actions/upload-artifact@v5
|
|
126
126
|
with:
|
|
127
127
|
name: $\{{ steps.metadata.outputs.plugin-id }}-$\{{ steps.metadata.outputs.plugin-version }}
|
|
128
128
|
path: $\{{ steps.metadata.outputs.plugin-id }}
|
|
@@ -140,7 +140,7 @@ jobs:
|
|
|
140
140
|
matrix: $\{{ steps.resolve-versions.outputs.matrix }}
|
|
141
141
|
steps:
|
|
142
142
|
- name: Checkout
|
|
143
|
-
uses: actions/checkout@
|
|
143
|
+
uses: actions/checkout@v5
|
|
144
144
|
with:
|
|
145
145
|
persist-credentials: false
|
|
146
146
|
|
|
@@ -162,12 +162,12 @@ jobs:
|
|
|
162
162
|
name: e2e test $\{{ matrix.GRAFANA_IMAGE.name }}@$\{{ matrix.GRAFANA_IMAGE.VERSION }}
|
|
163
163
|
runs-on: ubuntu-latest
|
|
164
164
|
steps:
|
|
165
|
-
- uses: actions/checkout@
|
|
165
|
+
- uses: actions/checkout@v5
|
|
166
166
|
with:
|
|
167
167
|
persist-credentials: false
|
|
168
168
|
|
|
169
169
|
- name: Download plugin
|
|
170
|
-
uses: actions/download-artifact@
|
|
170
|
+
uses: actions/download-artifact@v6
|
|
171
171
|
with:
|
|
172
172
|
path: dist
|
|
173
173
|
name: $\{{ needs.build.outputs.plugin-id }}-$\{{ needs.build.outputs.plugin-version }}
|
|
@@ -180,10 +180,10 @@ jobs:
|
|
|
180
180
|
{{#if_eq packageManagerName "pnpm"}}
|
|
181
181
|
# pnpm action uses the packageManager field in package.json to
|
|
182
182
|
# understand which version to install.
|
|
183
|
-
- uses: pnpm/action-setup@
|
|
183
|
+
- uses: pnpm/action-setup@v4
|
|
184
184
|
{{/if_eq}}
|
|
185
185
|
- name: Setup Node.js environment
|
|
186
|
-
uses: actions/setup-node@
|
|
186
|
+
uses: actions/setup-node@v6
|
|
187
187
|
with:
|
|
188
188
|
node-version: '22'
|
|
189
189
|
cache: '{{ packageManagerName }}'
|
|
@@ -242,7 +242,7 @@ jobs:
|
|
|
242
242
|
needs: [playwright-tests]
|
|
243
243
|
runs-on: ubuntu-latest
|
|
244
244
|
steps:
|
|
245
|
-
- uses: actions/checkout@
|
|
245
|
+
- uses: actions/checkout@v5
|
|
246
246
|
with:
|
|
247
247
|
# required for playwright-gh-pages
|
|
248
248
|
persist-credentials: true
|
|
@@ -15,7 +15,7 @@ jobs:
|
|
|
15
15
|
release:
|
|
16
16
|
runs-on: ubuntu-latest
|
|
17
17
|
steps:
|
|
18
|
-
- uses: grafana/plugin-actions/create-plugin-update@create-plugin-update/
|
|
18
|
+
- uses: grafana/plugin-actions/create-plugin-update@create-plugin-update/v2.0.1
|
|
19
19
|
with:
|
|
20
20
|
# Make sure to save the token in your repository secrets as `GH_PAT_TOKEN`
|
|
21
21
|
token: $\{{ secrets.GH_PAT_TOKEN }}
|
|
@@ -7,18 +7,18 @@ jobs:
|
|
|
7
7
|
permissions:
|
|
8
8
|
contents: read
|
|
9
9
|
steps:
|
|
10
|
-
- uses: actions/checkout@
|
|
10
|
+
- uses: actions/checkout@v5
|
|
11
11
|
with:
|
|
12
12
|
persist-credentials: false
|
|
13
13
|
|
|
14
14
|
{{#if_eq packageManagerName "pnpm"}}
|
|
15
15
|
# pnpm action uses the packageManager field in package.json to
|
|
16
16
|
# understand which version to install.
|
|
17
|
-
- uses: pnpm/action-setup@
|
|
17
|
+
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
|
|
18
18
|
{{/if_eq}}
|
|
19
19
|
|
|
20
20
|
- name: Setup Node.js environment
|
|
21
|
-
uses: actions/setup-node@
|
|
21
|
+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
|
|
22
22
|
with:
|
|
23
23
|
node-version: '22'
|
|
24
24
|
cache: '{{ packageManagerName }}'
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
## Project overview
|
|
2
|
+
|
|
3
|
+
This repository contains a Grafana panel plugin, which adds a custom visualization that can be used in Grafana dashboards. Panel plugins are useful when you want to:
|
|
4
|
+
|
|
5
|
+
- Present data from Grafana data source queries in a new or specialized way
|
|
6
|
+
- Add custom interactivity, such as navigation or drill-downs
|
|
7
|
+
- Visualize or control external systems (for example, IoT devices or custom integrations)
|
|
8
|
+
|
|
9
|
+
### High-level anatomy of a Grafana panel plugin
|
|
10
|
+
|
|
11
|
+
A typical panel plugin has:
|
|
12
|
+
|
|
13
|
+
- A plugin **manifest** (`plugin.json`)
|
|
14
|
+
- Declares plugin ID, type (`panel`), name, version, and metadata
|
|
15
|
+
- Picked up by Grafana during boot time to register plugin.
|
|
16
|
+
|
|
17
|
+
- A **main module** (usually `src/module.ts` or `src/module.tsx`)
|
|
18
|
+
- Calls `new PanelPlugin(PanelComponent)` from `@grafana/data` and expose the instance from the module.
|
|
19
|
+
- Optionally wires in the options editor, panel migration handler, and panel defaults
|
|
20
|
+
|
|
21
|
+
- A panel React component (e.g. `src/components/Panel.tsx`)
|
|
22
|
+
- Renders the visualization
|
|
23
|
+
- Receives props such as `data`, `timeRange`, `width`, `height`, and `options`
|
|
24
|
+
- Works with Grafana data frames and field configuration APIs to read query results and settings.
|
|
25
|
+
|
|
26
|
+
## Goals for AI coding agents
|
|
27
|
+
|
|
28
|
+
When working on this project, AI agents should:
|
|
29
|
+
|
|
30
|
+
- Maintain the existing options schema unless a proper migration handler is implemented
|
|
31
|
+
- Follow idiomatic React and TypeScript practices consistent with Grafana’s official example plugins
|
|
32
|
+
- Treat AGENTS.md as the authoritative source. If anything in .config/AGENTS conflicts with this file, follow the instructions in AGENTS.md
|
|
33
|
+
|
|
34
|
+
## Repository layout (typical)
|
|
35
|
+
|
|
36
|
+
- `plugin.json` – Grafana plugin manifest (type: `panel`)
|
|
37
|
+
- `src/module.ts` – main plugin entry point (creates `PanelPlugin`)
|
|
38
|
+
- `src/components` – React components for the panel
|
|
39
|
+
- `src/types.ts` – TypeScript types for panel options and internal models
|
|
40
|
+
- `tests/` – End-to-end tests (if configured)
|
|
41
|
+
- `provisioning/` - Provisioning files used in the local development environment.
|
|
42
|
+
- `README.md` – Human-facing project documentation
|
|
43
|
+
|
|
44
|
+
## Coding guidelines
|
|
45
|
+
|
|
46
|
+
- Use **TypeScript** for all plugin code.
|
|
47
|
+
- Prefer **functional React components** and hooks.
|
|
48
|
+
- Use **Grafana UI components** (`@grafana/ui`) and **Grafana data APIs** (`@grafana/data`) or **Grafana runtime APIs** (`@grafana/runtime`) instead of custom UI or data abstractions whenever possible.
|
|
49
|
+
- Keep the panel responsive:
|
|
50
|
+
- Respect `width` and `height` props.
|
|
51
|
+
- Avoid fixed layout sizes that break in narrow panels or large screens.
|
|
52
|
+
- Avoid introducing new dependencies unless:
|
|
53
|
+
- They’re necessary
|
|
54
|
+
- They’re compatible with Grafana’s frontend environment and plugin guidelines
|
|
55
|
+
- If custom styling is needed, please using `Emotion`.
|
|
56
|
+
|
|
57
|
+
## Safety & constraints for agents
|
|
58
|
+
|
|
59
|
+
- Do **not** change `plugin.json` IDs or plugin type.
|
|
60
|
+
- Do **not** change anything in the `.config` folder.
|
|
61
|
+
- Do **not** add a backend to this plugin. A panel plugin is a frontend only plugin.
|
|
62
|
+
- Do **not** remove or break existing option fields without:
|
|
63
|
+
- Adding a migration handler, or
|
|
64
|
+
- Updating all usages and tests accordingly.
|
|
65
|
+
- Keep changes to public interfaces (options, field configs, panel props) backwards compatible where possible.
|
|
66
|
+
- When in doubt, mirror patterns from Grafana’s official panel plugin examples and docs.
|