@grafana/create-plugin 5.26.4 → 5.26.5
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 +15 -0
- package/dist/migrations/scripts/001-update-grafana-compose-extend.js +6 -1
- package/package.json +3 -3
- package/src/migrations/scripts/001-update-grafana-compose-extend.test.ts +57 -0
- package/src/migrations/scripts/001-update-grafana-compose-extend.ts +13 -3
- package/templates/common/_package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# v5.26.5 (Thu Sep 18 2025)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- Create plugin: fix docker compose migration error [#2126](https://github.com/grafana/plugin-tools/pull/2126) ([@jackw](https://github.com/jackw))
|
|
6
|
+
- Update dependency @grafana/eslint-config to v8.2.0 [#1889](https://github.com/grafana/plugin-tools/pull/1889) ([@renovate[bot]](https://github.com/renovate[bot]) [@mckn](https://github.com/mckn))
|
|
7
|
+
|
|
8
|
+
#### Authors: 3
|
|
9
|
+
|
|
10
|
+
- [@renovate[bot]](https://github.com/renovate[bot])
|
|
11
|
+
- Jack Westbrook ([@jackw](https://github.com/jackw))
|
|
12
|
+
- Marcus Andersson ([@mckn](https://github.com/mckn))
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
1
16
|
# v5.26.4 (Fri Sep 12 2025)
|
|
2
17
|
|
|
3
18
|
#### 🐛 Bug Fix
|
|
@@ -16,6 +16,7 @@ async function migrate(context) {
|
|
|
16
16
|
if (buildContext?.toString() !== "./.config") {
|
|
17
17
|
return context;
|
|
18
18
|
}
|
|
19
|
+
const keyValuePairsToRemove = [];
|
|
19
20
|
visit(composeData, {
|
|
20
21
|
Pair: (_key, pair, path) => {
|
|
21
22
|
const keyPath = [];
|
|
@@ -30,11 +31,15 @@ async function migrate(context) {
|
|
|
30
31
|
if (keyPath[0] === "services" && keyPath[1] === "grafana") {
|
|
31
32
|
const baseValue = baseComposeData.getIn(keyPath);
|
|
32
33
|
if (baseValue && JSON.stringify(pair.value) === JSON.stringify(baseValue)) {
|
|
33
|
-
|
|
34
|
+
keyValuePairsToRemove.push(keyPath);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
});
|
|
39
|
+
keyValuePairsToRemove.sort((a, b) => b.length - a.length);
|
|
40
|
+
for (const keyPath of keyValuePairsToRemove) {
|
|
41
|
+
composeData.deleteIn(keyPath);
|
|
42
|
+
}
|
|
38
43
|
visit(composeData, {
|
|
39
44
|
Scalar: (_key, node, path) => {
|
|
40
45
|
const keyPath = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "5.26.
|
|
3
|
+
"version": "5.26.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"directory": "packages/create-plugin",
|
|
6
6
|
"url": "https://github.com/grafana/plugin-tools"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@libs/version": "^1.0.2",
|
|
47
47
|
"@types/glob": "^9.0.0",
|
|
48
48
|
"@types/minimist": "^1.2.5",
|
|
49
|
-
"@types/semver": "^7.7.
|
|
49
|
+
"@types/semver": "^7.7.1",
|
|
50
50
|
"@types/tmp": "^0.2.6",
|
|
51
51
|
"@types/which": "^3.0.4",
|
|
52
52
|
"eslint-plugin-react": "^7.37.5",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=20"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "d7fb24a37991be25f4f99fefd361a7e85e64309f"
|
|
65
65
|
}
|
|
@@ -262,6 +262,63 @@ describe('001-update-grafana-compose-extend', () => {
|
|
|
262
262
|
});
|
|
263
263
|
});
|
|
264
264
|
|
|
265
|
+
it('should remove child key-value pairs before parents', async () => {
|
|
266
|
+
const context = new Context('/virtual');
|
|
267
|
+
context.addFile(
|
|
268
|
+
'./docker-compose.yaml',
|
|
269
|
+
stringify({
|
|
270
|
+
services: {
|
|
271
|
+
grafana: {
|
|
272
|
+
build: {
|
|
273
|
+
context: './.config',
|
|
274
|
+
args: {
|
|
275
|
+
grafana_version: '${GRAFANA_VERSION:-9.5.3}',
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
environment: {
|
|
279
|
+
GF_INSTALL_PLUGINS: 'snuids-trafficlights-panel',
|
|
280
|
+
NODE_ENV: 'development',
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
})
|
|
285
|
+
);
|
|
286
|
+
context.addFile(
|
|
287
|
+
'./.config/docker-compose-base.yaml',
|
|
288
|
+
stringify({
|
|
289
|
+
services: {
|
|
290
|
+
grafana: {
|
|
291
|
+
build: {
|
|
292
|
+
context: '.',
|
|
293
|
+
args: {
|
|
294
|
+
grafana_version: '${GRAFANA_VERSION:-11.5.3}',
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
environment: {
|
|
298
|
+
GF_INSTALL_PLUGINS: 'snuids-trafficlights-panel',
|
|
299
|
+
NODE_ENV: 'development',
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
})
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
await migrate(context);
|
|
307
|
+
|
|
308
|
+
const result = parse(context.getFile('./docker-compose.yaml') || '');
|
|
309
|
+
expect(result.services.grafana).toEqual({
|
|
310
|
+
extends: {
|
|
311
|
+
file: '.config/docker-compose-base.yaml',
|
|
312
|
+
service: 'grafana',
|
|
313
|
+
},
|
|
314
|
+
build: {
|
|
315
|
+
args: {
|
|
316
|
+
grafana_version: '${GRAFANA_VERSION:-9.5.3}',
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
|
|
265
322
|
it('should preserve comments in the docker-compose file', async () => {
|
|
266
323
|
const context = new Context('/virtual');
|
|
267
324
|
const originalContent = `
|
|
@@ -24,8 +24,10 @@ export default async function migrate(context: Context) {
|
|
|
24
24
|
if (buildContext?.toString() !== './.config') {
|
|
25
25
|
return context;
|
|
26
26
|
}
|
|
27
|
+
// List of key value pairs to remove from the compose file
|
|
28
|
+
const keyValuePairsToRemove: string[][] = [];
|
|
27
29
|
|
|
28
|
-
//
|
|
30
|
+
// Visit key value pairs to find those that match the base configuration
|
|
29
31
|
visit(composeData, {
|
|
30
32
|
Pair: ((
|
|
31
33
|
_key: unknown,
|
|
@@ -44,17 +46,25 @@ export default async function migrate(context: Context) {
|
|
|
44
46
|
keyPath.push(pair.key.value as string);
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
//
|
|
49
|
+
// We only care about the grafana service
|
|
48
50
|
if (keyPath[0] === 'services' && keyPath[1] === 'grafana') {
|
|
49
51
|
const baseValue = baseComposeData.getIn(keyPath);
|
|
50
52
|
|
|
53
|
+
// If the current pair matches the base value, add it to the list of items to remove
|
|
51
54
|
if (baseValue && JSON.stringify(pair.value) === JSON.stringify(baseValue)) {
|
|
52
|
-
|
|
55
|
+
keyValuePairsToRemove.push(keyPath);
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
58
|
}) as visitorFn<Pair<unknown, unknown>>,
|
|
56
59
|
});
|
|
57
60
|
|
|
61
|
+
// Sort the key paths by length to remove children before parents
|
|
62
|
+
keyValuePairsToRemove.sort((a, b) => b.length - a.length);
|
|
63
|
+
|
|
64
|
+
for (const keyPath of keyValuePairsToRemove) {
|
|
65
|
+
composeData.deleteIn(keyPath);
|
|
66
|
+
}
|
|
67
|
+
|
|
58
68
|
visit(composeData, {
|
|
59
69
|
Scalar: ((_key: unknown, node: Scalar, path: ReadonlyArray<Node | Document | Pair<unknown, unknown>>) => {
|
|
60
70
|
const keyPath: string[] = [];
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
{{#if useCypress}} "@grafana/e2e": "^11.0.7",
|
|
22
22
|
"@grafana/e2e-selectors": "^12.1.0",{{/if}}
|
|
23
|
-
"@grafana/eslint-config": "^8.
|
|
23
|
+
"@grafana/eslint-config": "^8.2.0",{{#if usePlaywright}}
|
|
24
24
|
"@grafana/plugin-e2e": "^2.1.12",{{/if}}
|
|
25
25
|
"@grafana/tsconfig": "^2.0.0",{{#if usePlaywright}}
|
|
26
26
|
"@playwright/test": "^1.52.0",{{/if}}{{#if useExperimentalRspack}}
|