@grafana/create-plugin 6.3.0-canary.2314.19540157259.0 → 6.3.0-canary.2319.19627830170.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 +12 -0
- package/dist/constants.js +4 -4
- package/dist/libs/version/src/index.js +2 -2
- package/package.json +3 -3
- package/src/codemods/AGENTS.md +25 -0
- package/templates/github/workflows/ci.yml +1 -1
- package/templates/panel/.config/AGENTS/instructions.md +0 -83
- package/templates/panel/.config/AGENTS/tasks/add-panel-options.md +0 -132
- package/templates/panel/AGENTS.md +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# v6.2.2 (Fri Nov 21 2025)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- fix(deps): update dependency glob to v11.1.0 [security] [#2308](https://github.com/grafana/plugin-tools/pull/2308) ([@renovate-sh-app[bot]](https://github.com/renovate-sh-app[bot]))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- [@renovate-sh-app[bot]](https://github.com/renovate-sh-app[bot])
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
1
13
|
# v6.2.1 (Thu Nov 20 2025)
|
|
2
14
|
|
|
3
15
|
#### 🐛 Bug Fix
|
package/dist/constants.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { fileURLToPath } from 'node:url';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
|
-
const __dirname = fileURLToPath(new URL(".", import.meta.url));
|
|
4
|
+
const __dirname$1 = fileURLToPath(new URL(".", import.meta.url));
|
|
5
5
|
const IS_DEV = process.env.CREATE_PLUGIN_DEV !== void 0;
|
|
6
6
|
const EXPORT_PATH_PREFIX = process.cwd();
|
|
7
|
-
path.join(__dirname, "dist");
|
|
8
|
-
const TEMPLATES_DIR = path.join(__dirname, "..", "templates");
|
|
7
|
+
path.join(__dirname$1, "dist");
|
|
8
|
+
const TEMPLATES_DIR = path.join(__dirname$1, "..", "templates");
|
|
9
9
|
const PARTIALS_DIR = path.join(TEMPLATES_DIR, "_partials");
|
|
10
|
-
path.join(__dirname, "..", "fixtures");
|
|
10
|
+
path.join(__dirname$1, "..", "fixtures");
|
|
11
11
|
const TEMPLATE_PATHS = {
|
|
12
12
|
app: path.join(TEMPLATES_DIR, "app"),
|
|
13
13
|
scenesapp: path.join(TEMPLATES_DIR, "scenes-app"),
|
|
@@ -2,9 +2,9 @@ import { findUpSync } from 'find-up';
|
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
|
|
5
|
-
const __dirname = fileURLToPath(new URL(".", import.meta.url));
|
|
5
|
+
const __dirname$1 = fileURLToPath(new URL(".", import.meta.url));
|
|
6
6
|
function getVersion() {
|
|
7
|
-
const packageJsonPath = findUpSync("package.json", { cwd: __dirname });
|
|
7
|
+
const packageJsonPath = findUpSync("package.json", { cwd: __dirname$1 });
|
|
8
8
|
if (!packageJsonPath) {
|
|
9
9
|
throw `Could not find package.json`;
|
|
10
10
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "6.3.0-canary.
|
|
3
|
+
"version": "6.3.0-canary.2319.19627830170.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"directory": "packages/create-plugin",
|
|
6
6
|
"url": "https://github.com/grafana/plugin-tools"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"debug": "^4.3.4",
|
|
33
33
|
"enquirer": "^2.4.1",
|
|
34
34
|
"find-up": "^8.0.0",
|
|
35
|
-
"glob": "^11.
|
|
35
|
+
"glob": "^11.1.0",
|
|
36
36
|
"handlebars": "^4.7.8",
|
|
37
37
|
"jsonc-parser": "^3.3.1",
|
|
38
38
|
"minimist": "^1.2.8",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=20"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "e62bbbc7de46e7d822179afb84d620b5e809b50e"
|
|
65
65
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Create Plugin Codemods Guide
|
|
2
|
+
|
|
3
|
+
This guide provides specific instructions for working with migrations and additions in the create-plugin package.
|
|
4
|
+
|
|
5
|
+
## Agent Behavior
|
|
6
|
+
|
|
7
|
+
- Refer to current migrations and additions typescript files found in @./additions/scripts and @./migrations/scripts
|
|
8
|
+
- When creating a new migration add it to the exported migrations object in @./migrations/migrations.ts
|
|
9
|
+
- Always refer to @./context.ts to know what methods are available on the context class
|
|
10
|
+
- Always check for file existence using the @./context.ts class before attempting to do anything with it
|
|
11
|
+
- Never write files with any 3rd party npm library. Use the context for all file operations
|
|
12
|
+
- Always return the context for the next migration
|
|
13
|
+
- Test thoroughly using the provided utils in @./test-utils.ts where necessary
|
|
14
|
+
- Each migration must be idempotent and must include a test case that uses the `.toBeIdempotent` custom matcher found in @../../vitest.setup.ts
|
|
15
|
+
- Keep migrations focused on one task
|
|
16
|
+
- Never attempt to read or write files outside the current working directory
|
|
17
|
+
|
|
18
|
+
## Naming Conventions
|
|
19
|
+
|
|
20
|
+
- Each migration lives under @./migrations/scripts
|
|
21
|
+
- Migration filenames follow the format: `NNN-migration-title` where migration-title is, at the most, a three word summary of what the migration does and NNN is the next number in sequence based on the current file name in @./migrations/scripts
|
|
22
|
+
- Each migration must have:
|
|
23
|
+
- `NNN-migration-title.ts` - main migration logic
|
|
24
|
+
- `NNN-migration-title.test.ts` - migration logic tests
|
|
25
|
+
- Each migration should export a default function named "migrate"
|
|
@@ -247,7 +247,7 @@ jobs:
|
|
|
247
247
|
# required for playwright-gh-pages
|
|
248
248
|
persist-credentials: true
|
|
249
249
|
- name: Publish report
|
|
250
|
-
uses: grafana/plugin-actions/playwright-gh-pages/deploy-report-pages@deploy-report-pages/v1.0
|
|
250
|
+
uses: grafana/plugin-actions/playwright-gh-pages/deploy-report-pages@deploy-report-pages/v1.1.0
|
|
251
251
|
with:
|
|
252
252
|
github-token: $\{{ secrets.GITHUB_TOKEN }}
|
|
253
253
|
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: panel-plugin-agent-fundamentals
|
|
3
|
-
description: Develops Grafana panel plugins
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
You are an expert Grafana panel plugin developer for this project.
|
|
7
|
-
|
|
8
|
-
## Your role
|
|
9
|
-
|
|
10
|
-
- You are fluent in TypeScript and React
|
|
11
|
-
- You know how to use Grafana dashboards
|
|
12
|
-
|
|
13
|
-
## Project knowledge
|
|
14
|
-
|
|
15
|
-
This repository contains a **Grafana panel plugin**, providing a custom visualization for Grafana dashboards.
|
|
16
|
-
Panel plugins are used to:
|
|
17
|
-
|
|
18
|
-
- Display data from Grafana data sources in custom ways
|
|
19
|
-
- Add interactive behavior (drill-downs, navigation, etc.)
|
|
20
|
-
- Visualize or control external systems (IoT, integrations, custom controls)
|
|
21
|
-
|
|
22
|
-
### Plugin anatomy
|
|
23
|
-
|
|
24
|
-
A typical panel plugin includes:
|
|
25
|
-
|
|
26
|
-
**plugin.json**
|
|
27
|
-
|
|
28
|
-
- Declares plugin ID, type (`panel`), name, version
|
|
29
|
-
- Loaded by Grafana at startup
|
|
30
|
-
|
|
31
|
-
**Main module (`src/module.ts`)**
|
|
32
|
-
|
|
33
|
-
- Exports: `new PanelPlugin(PanelComponent)`
|
|
34
|
-
- Registers panel options, migrations, defaults, ui extensions
|
|
35
|
-
|
|
36
|
-
**Panel component (`src/components/Panel.tsx`)**
|
|
37
|
-
|
|
38
|
-
- React component receiving: `data`, `timeRange`, `width`, `height`, `options`
|
|
39
|
-
- Renders visualization using Grafana data frames and field configs
|
|
40
|
-
|
|
41
|
-
### Repository layout
|
|
42
|
-
|
|
43
|
-
- `plugin.json` — Panel plugin manifest
|
|
44
|
-
- `src/module.ts` — Main plugin entry
|
|
45
|
-
- `src/components/` — Panel React components
|
|
46
|
-
- `src/types.ts` — Option and model types
|
|
47
|
-
- `tests/` — E2E tests (if present)
|
|
48
|
-
- `provisioning/` — Local development provisioning
|
|
49
|
-
- `README.md` — Human documentation
|
|
50
|
-
|
|
51
|
-
## Coding guidelines
|
|
52
|
-
|
|
53
|
-
- Use **TypeScript** and **functional React components**
|
|
54
|
-
- Use **@grafana/ui**, **@grafana/data**, **@grafana/runtime**
|
|
55
|
-
- Respect `width` and `height`; keep layout responsive
|
|
56
|
-
- Avoid unnecessary dependencies; ensure Grafana compatibility
|
|
57
|
-
- Use useTheme2() from @grafana/ui for visual tokens
|
|
58
|
-
- Never hardcode colors, spacing, padding, or font sizes.
|
|
59
|
-
- Use useStyles2(), Emotion and visual tokens from the theme to create styles.
|
|
60
|
-
- Follow existing file structure
|
|
61
|
-
- Keep code typed and predictable
|
|
62
|
-
|
|
63
|
-
## Boundaries
|
|
64
|
-
|
|
65
|
-
You must **not**:
|
|
66
|
-
|
|
67
|
-
- Change plugin IDs or plugin type in `plugin.json`
|
|
68
|
-
- Modify anything under `.config/*`
|
|
69
|
-
- Add a backend — panel plugins are **frontend only**
|
|
70
|
-
- Remove or change existing options without a migration handler
|
|
71
|
-
- Break public APIs (options, field configs, panel props)
|
|
72
|
-
- Store or use credentials.
|
|
73
|
-
|
|
74
|
-
You **should**:
|
|
75
|
-
|
|
76
|
-
- Keep the plugin backward compatible
|
|
77
|
-
- Preserve the existing options schema unless adding a migration handler
|
|
78
|
-
- Mirror patterns from Grafana’s official panel plugin examples
|
|
79
|
-
- Follow idiomatic React + TypeScript patterns used in official Grafana examples
|
|
80
|
-
|
|
81
|
-
## Instructions for specific tasks
|
|
82
|
-
|
|
83
|
-
- [Add panel options](./tasks/add-panel-options.md)
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
# Adding a New Panel Option
|
|
2
|
-
|
|
3
|
-
Panel options are settings the user configures to change panel behavior.
|
|
4
|
-
|
|
5
|
-
Always complete **all three steps**:
|
|
6
|
-
|
|
7
|
-
### **1. Extend the options type**
|
|
8
|
-
|
|
9
|
-
File: `src/types.ts`
|
|
10
|
-
|
|
11
|
-
```ts
|
|
12
|
-
export interface SimpleOptions {
|
|
13
|
-
// existing...
|
|
14
|
-
myOptionName: MyOptionType;
|
|
15
|
-
}
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
- Property name must match the builder `path`.
|
|
19
|
-
- Type must match expected editor output.
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
### **2. Register the option in `setPanelOptions`**
|
|
24
|
-
|
|
25
|
-
File: `src/module.ts` inside `setPanelOptions((builder) => { ... })`
|
|
26
|
-
|
|
27
|
-
Use the correct builder method:
|
|
28
|
-
|
|
29
|
-
| Type | Builder |
|
|
30
|
-
| ------------------ | -------------------- |
|
|
31
|
-
| boolean | `addBooleanSwitch` |
|
|
32
|
-
| number | `addNumberInput` |
|
|
33
|
-
| string | `addTextInput` |
|
|
34
|
-
| select | `addSelect` |
|
|
35
|
-
| radio | `addRadio` |
|
|
36
|
-
| radio group | `addRadio` |
|
|
37
|
-
| slider | `addSliderInput` |
|
|
38
|
-
| color picker | `addColorPicker` |
|
|
39
|
-
| unit picker | `addUnitPicker` |
|
|
40
|
-
| field namer picker | `addFieldNamePicker` |
|
|
41
|
-
|
|
42
|
-
Template:
|
|
43
|
-
|
|
44
|
-
```ts
|
|
45
|
-
builder.addXxx({
|
|
46
|
-
path: 'myOptionName', // must match type property
|
|
47
|
-
name: 'My option',
|
|
48
|
-
defaultValue: <default>,
|
|
49
|
-
description: '',
|
|
50
|
-
settings: { /* optional */ },
|
|
51
|
-
// Optional visibility rule:
|
|
52
|
-
// showIf: (opts) => opts.someOtherOption,
|
|
53
|
-
});
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Rules:
|
|
57
|
-
|
|
58
|
-
- Every option **must** have a `defaultValue`.
|
|
59
|
-
- Put numeric constraints in `settings` (`min`, `max`, `step`).
|
|
60
|
-
- Use `showIf` for conditional display.
|
|
61
|
-
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
### **3. Use the option in the panel component**
|
|
65
|
-
|
|
66
|
-
File: `src/Panel.tsx` (or equivalent)
|
|
67
|
-
|
|
68
|
-
```tsx
|
|
69
|
-
export const Panel = ({ options }) => {
|
|
70
|
-
const { myOptionName } = options;
|
|
71
|
-
// apply it in rendering/logic
|
|
72
|
-
};
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
No option may remain unused.
|
|
76
|
-
|
|
77
|
-
---
|
|
78
|
-
|
|
79
|
-
# Quick Editor Recipes
|
|
80
|
-
|
|
81
|
-
### **Boolean**
|
|
82
|
-
|
|
83
|
-
```ts
|
|
84
|
-
.addBooleanSwitch({ path: 'flag', name: 'Flag', defaultValue: false })
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### **Number**
|
|
88
|
-
|
|
89
|
-
```ts
|
|
90
|
-
.addNumberInput({
|
|
91
|
-
path: 'max',
|
|
92
|
-
name: 'Max value',
|
|
93
|
-
defaultValue: 10,
|
|
94
|
-
settings: { min: 1, max: 100, step: 1 },
|
|
95
|
-
})
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### **String**
|
|
99
|
-
|
|
100
|
-
```ts
|
|
101
|
-
.addTextInput({ path: 'label', name: 'Label', defaultValue: '' })
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### **Select**
|
|
105
|
-
|
|
106
|
-
```ts
|
|
107
|
-
.addSelect({
|
|
108
|
-
path: 'mode',
|
|
109
|
-
name: 'Mode',
|
|
110
|
-
defaultValue: 'auto',
|
|
111
|
-
settings: { options: [
|
|
112
|
-
{ value: 'a', label: 'A' },
|
|
113
|
-
{ value: 'b', label: 'B' },
|
|
114
|
-
]},
|
|
115
|
-
})
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### **Radio**
|
|
119
|
-
|
|
120
|
-
```ts
|
|
121
|
-
.addRadio({
|
|
122
|
-
path: 'size',
|
|
123
|
-
name: 'Size',
|
|
124
|
-
defaultValue: 'md',
|
|
125
|
-
settings: { options: [
|
|
126
|
-
{ value: 'sm', label: 'Small' },
|
|
127
|
-
{ value: 'md', label: 'Medium' },
|
|
128
|
-
{ value: 'lg', label: 'Large' },
|
|
129
|
-
]},
|
|
130
|
-
showIf: (o) => o.showSize,
|
|
131
|
-
})
|
|
132
|
-
```
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: panel-plugin-agent
|
|
3
|
-
description: Develops Grafana panel plugins
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## Project knowledge
|
|
7
|
-
|
|
8
|
-
This repository contains a **Grafana panel plugin**. Follow the [instructions](./.config/AGENTS/instructions.md) before doing any changes.
|
|
9
|
-
|
|
10
|
-
All build, lint, test, and Docker dev-server commands are documented in the "Getting started" section of [README.md](./README.md). Prefer running the non-watch versions of these commands.
|