@grafana/create-plugin 6.1.13-canary.2313.19498365291.0 → 6.1.13
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/migrations/migrations.js +5 -0
- package/dist/migrations/scripts/007-remove-testing-library-types.js +25 -0
- package/package.json +2 -2
- package/src/migrations/migrations.ts +6 -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 +47 -67
- package/templates/backend/go.sum +222 -197
- package/templates/backend-app/go.mod +48 -67
- package/templates/backend-app/go.sum +222 -197
- package/templates/common/.config/types/setupTests.d.ts +1 -0
- package/templates/common/_package.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# v6.1.13 (Wed Nov 19 2025)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- Create Plugin: remove types/testing-library__jest-dom [#2250](https://github.com/grafana/plugin-tools/pull/2250) ([@jackw](https://github.com/jackw))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- Jack Westbrook ([@jackw](https://github.com/jackw))
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
1
13
|
# v6.1.12 (Mon Nov 17 2025)
|
|
2
14
|
|
|
3
15
|
#### 🐛 Bug Fix
|
|
@@ -31,6 +31,11 @@ var defaultMigrations = {
|
|
|
31
31
|
version: "6.1.11",
|
|
32
32
|
description: "Fix webpack variable replacement in nested plugins files.",
|
|
33
33
|
migrationScript: "./scripts/006-webpack-nested-fix.js"
|
|
34
|
+
},
|
|
35
|
+
"007-remove-testing-library-types": {
|
|
36
|
+
version: "6.1.13",
|
|
37
|
+
description: "Add setupTests.d.ts for @testing-library/jest-dom types and remove @types/testing-library__jest-dom npm package.",
|
|
38
|
+
migrationScript: "./scripts/007-remove-testing-library-types.js"
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
41
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { isVersionGreater, removeDependenciesFromPackageJson } from '../utils.js';
|
|
2
|
+
|
|
3
|
+
function migrate(context) {
|
|
4
|
+
if (context.doesFileExist("package.json")) {
|
|
5
|
+
const packageJson = JSON.parse(context.getFile("package.json") || "{}");
|
|
6
|
+
if (isVersionGreater(packageJson.devDependencies["@testing-library/jest-dom"], "6.0.0", true)) {
|
|
7
|
+
if (context.doesFileExist("./.config/types/setupTests.d.ts")) {
|
|
8
|
+
const setupTestsContent = context.getFile("./.config/types/setupTests.d.ts");
|
|
9
|
+
if (!setupTestsContent?.includes("@testing-library/jest-dom")) {
|
|
10
|
+
context.updateFile(
|
|
11
|
+
"./.config/types/setupTests.d.ts",
|
|
12
|
+
`import '@testing-library/jest-dom';
|
|
13
|
+
${setupTestsContent}`
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
} else {
|
|
17
|
+
context.addFile("./.config/types/setupTests.d.ts", "import '@testing-library/jest-dom';\n");
|
|
18
|
+
}
|
|
19
|
+
removeDependenciesFromPackageJson(context, [], ["@types/testing-library__jest-dom"]);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return context;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { migrate as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "6.1.13
|
|
3
|
+
"version": "6.1.13",
|
|
4
4
|
"repository": {
|
|
5
5
|
"directory": "packages/create-plugin",
|
|
6
6
|
"url": "https://github.com/grafana/plugin-tools"
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=20"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "4972c492a7372870b54c37ca2334b077823f903e"
|
|
64
64
|
}
|
|
@@ -45,5 +45,11 @@ export default {
|
|
|
45
45
|
description: 'Fix webpack variable replacement in nested plugins files.',
|
|
46
46
|
migrationScript: './scripts/006-webpack-nested-fix.js',
|
|
47
47
|
},
|
|
48
|
+
'007-remove-testing-library-types': {
|
|
49
|
+
version: '6.1.13',
|
|
50
|
+
description:
|
|
51
|
+
'Add setupTests.d.ts for @testing-library/jest-dom types and remove @types/testing-library__jest-dom npm package.',
|
|
52
|
+
migrationScript: './scripts/007-remove-testing-library-types.js',
|
|
53
|
+
},
|
|
48
54
|
},
|
|
49
55
|
} as Migrations;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import migrate from './007-remove-testing-library-types.js';
|
|
3
|
+
import { Context } from '../context.js';
|
|
4
|
+
|
|
5
|
+
describe('006-remove-testing-library-types', () => {
|
|
6
|
+
it('should create setupTests.d.ts, remove types package, and add @testing-library/jest-dom when file does not exist', () => {
|
|
7
|
+
const context = new Context('/virtual');
|
|
8
|
+
|
|
9
|
+
context.addFile(
|
|
10
|
+
'package.json',
|
|
11
|
+
JSON.stringify({
|
|
12
|
+
devDependencies: {
|
|
13
|
+
'@types/testing-library__jest-dom': '^6.0.0',
|
|
14
|
+
'@testing-library/jest-dom': '6.0.0',
|
|
15
|
+
'@testing-library/react': '14.0.0',
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const result = migrate(context);
|
|
21
|
+
const setupTestsContent = result.getFile('./.config/types/setupTests.d.ts');
|
|
22
|
+
expect(setupTestsContent).toBe("import '@testing-library/jest-dom';\n");
|
|
23
|
+
|
|
24
|
+
const packageJson = JSON.parse(result.getFile('package.json') || '{}');
|
|
25
|
+
expect(packageJson.devDependencies).toEqual({
|
|
26
|
+
'@testing-library/jest-dom': '6.0.0',
|
|
27
|
+
'@testing-library/react': '14.0.0',
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should add import to existing setupTests.d.ts, remove types package, and add @testing-library/jest-dom if missing', () => {
|
|
32
|
+
const context = new Context('/virtual');
|
|
33
|
+
|
|
34
|
+
const existingContent = '// Some other type declarations\n';
|
|
35
|
+
context.addFile('./.config/types/setupTests.d.ts', existingContent);
|
|
36
|
+
context.addFile(
|
|
37
|
+
'package.json',
|
|
38
|
+
JSON.stringify({
|
|
39
|
+
devDependencies: {
|
|
40
|
+
'@types/testing-library__jest-dom': '^6.0.0',
|
|
41
|
+
'@testing-library/jest-dom': '6.1.4',
|
|
42
|
+
'@testing-library/react': '14.0.0',
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const result = migrate(context);
|
|
48
|
+
const setupTestsContent = result.getFile('./.config/types/setupTests.d.ts');
|
|
49
|
+
expect(setupTestsContent).toBe(`import '@testing-library/jest-dom';\n${existingContent}`);
|
|
50
|
+
|
|
51
|
+
const packageJson = JSON.parse(result.getFile('package.json') || '{}');
|
|
52
|
+
expect(packageJson.devDependencies).toEqual({
|
|
53
|
+
'@testing-library/jest-dom': '6.1.4',
|
|
54
|
+
'@testing-library/react': '14.0.0',
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should not modify setupTests.d.ts if import already exists', () => {
|
|
59
|
+
const context = new Context('/virtual');
|
|
60
|
+
|
|
61
|
+
const existingContent = "// Other content\nimport 'react';\nimport '@testing-library/jest-dom';\n";
|
|
62
|
+
context.addFile('./.config/types/setupTests.d.ts', existingContent);
|
|
63
|
+
context.addFile(
|
|
64
|
+
'package.json',
|
|
65
|
+
JSON.stringify({
|
|
66
|
+
devDependencies: {
|
|
67
|
+
'@types/testing-library__jest-dom': '^6.0.0',
|
|
68
|
+
'@testing-library/jest-dom': '6.1.4',
|
|
69
|
+
'@testing-library/react': '14.0.0',
|
|
70
|
+
},
|
|
71
|
+
})
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const result = migrate(context);
|
|
75
|
+
|
|
76
|
+
const setupTestsContent = result.getFile('./.config/types/setupTests.d.ts');
|
|
77
|
+
expect(setupTestsContent).toBe(existingContent);
|
|
78
|
+
|
|
79
|
+
const packageJson = JSON.parse(result.getFile('package.json') || '{}');
|
|
80
|
+
expect(packageJson.devDependencies).toEqual({
|
|
81
|
+
'@testing-library/jest-dom': '6.1.4',
|
|
82
|
+
'@testing-library/react': '14.0.0',
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('should not modify anything if @testing-library/jest-dom is not greater than 6.0.0', () => {
|
|
87
|
+
const context = new Context('/virtual');
|
|
88
|
+
const packageJsonContent = JSON.stringify({
|
|
89
|
+
devDependencies: { '@testing-library/jest-dom': '5.14.2' },
|
|
90
|
+
});
|
|
91
|
+
context.addFile('package.json', packageJsonContent);
|
|
92
|
+
|
|
93
|
+
const result = migrate(context);
|
|
94
|
+
expect(result.getFile('package.json')).toEqual(packageJsonContent);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should handle package.json without the types package', () => {
|
|
98
|
+
const context = new Context('/virtual');
|
|
99
|
+
|
|
100
|
+
context.addFile(
|
|
101
|
+
'package.json',
|
|
102
|
+
JSON.stringify({
|
|
103
|
+
devDependencies: {
|
|
104
|
+
'@testing-library/react': '14.0.0',
|
|
105
|
+
'@testing-library/jest-dom': '6.1.4',
|
|
106
|
+
},
|
|
107
|
+
})
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
const result = migrate(context);
|
|
111
|
+
const setupTestsContent = result.getFile('./.config/types/setupTests.d.ts');
|
|
112
|
+
expect(setupTestsContent).toBe("import '@testing-library/jest-dom';\n");
|
|
113
|
+
|
|
114
|
+
const packageJson = JSON.parse(result.getFile('package.json') || '{}');
|
|
115
|
+
expect(packageJson.devDependencies).toEqual({
|
|
116
|
+
'@testing-library/jest-dom': '6.1.4',
|
|
117
|
+
'@testing-library/react': '14.0.0',
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('should be idempotent', async () => {
|
|
122
|
+
const context = new Context('/virtual');
|
|
123
|
+
|
|
124
|
+
context.addFile(
|
|
125
|
+
'package.json',
|
|
126
|
+
JSON.stringify({
|
|
127
|
+
devDependencies: {
|
|
128
|
+
'@types/testing-library__jest-dom': '^6.0.0',
|
|
129
|
+
'@testing-library/jest-dom': '6.1.4',
|
|
130
|
+
'@testing-library/react': '14.0.0',
|
|
131
|
+
},
|
|
132
|
+
})
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
await expect(migrate).toBeIdempotent(context);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Context } from '../context.js';
|
|
2
|
+
import { removeDependenciesFromPackageJson, isVersionGreater } from '../utils.js';
|
|
3
|
+
|
|
4
|
+
export default function migrate(context: Context) {
|
|
5
|
+
if (context.doesFileExist('package.json')) {
|
|
6
|
+
const packageJson = JSON.parse(context.getFile('package.json') || '{}');
|
|
7
|
+
if (isVersionGreater(packageJson.devDependencies['@testing-library/jest-dom'], '6.0.0', true)) {
|
|
8
|
+
if (context.doesFileExist('./.config/types/setupTests.d.ts')) {
|
|
9
|
+
const setupTestsContent = context.getFile('./.config/types/setupTests.d.ts');
|
|
10
|
+
if (!setupTestsContent?.includes('@testing-library/jest-dom')) {
|
|
11
|
+
context.updateFile(
|
|
12
|
+
'./.config/types/setupTests.d.ts',
|
|
13
|
+
`import '@testing-library/jest-dom';\n${setupTestsContent}`
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
} else {
|
|
17
|
+
context.addFile('./.config/types/setupTests.d.ts', "import '@testing-library/jest-dom';\n");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
removeDependenciesFromPackageJson(context, [], ['@types/testing-library__jest-dom']);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return context;
|
|
25
|
+
}
|
package/templates/backend/go.mod
CHANGED
|
@@ -1,86 +1,66 @@
|
|
|
1
1
|
module github.com/{{ kebabCase orgName }}/{{ kebabCase pluginName }}
|
|
2
2
|
|
|
3
|
-
go 1.
|
|
3
|
+
go 1.22
|
|
4
4
|
|
|
5
|
-
require github.com/grafana/grafana-plugin-sdk-go v0.
|
|
5
|
+
require github.com/grafana/grafana-plugin-sdk-go v0.156.0
|
|
6
6
|
|
|
7
7
|
require (
|
|
8
|
-
github.com/BurntSushi/toml v1.
|
|
9
|
-
github.com/apache/arrow
|
|
8
|
+
github.com/BurntSushi/toml v1.2.1 // indirect
|
|
9
|
+
github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 // indirect
|
|
10
10
|
github.com/beorn7/perks v1.0.1 // indirect
|
|
11
|
-
github.com/
|
|
12
|
-
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
|
11
|
+
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
|
13
12
|
github.com/cheekybits/genny v1.0.0 // indirect
|
|
14
|
-
github.com/
|
|
15
|
-
github.com/
|
|
16
|
-
github.com/
|
|
17
|
-
github.com/
|
|
18
|
-
github.com/
|
|
19
|
-
github.com/
|
|
20
|
-
github.com/
|
|
21
|
-
github.com/
|
|
22
|
-
github.com/
|
|
23
|
-
github.com/
|
|
24
|
-
github.com/google/
|
|
25
|
-
github.com/
|
|
26
|
-
github.com/
|
|
27
|
-
github.com/
|
|
28
|
-
github.com/grpc-ecosystem/go-grpc-middleware
|
|
29
|
-
github.com/grpc-ecosystem/grpc-
|
|
30
|
-
github.com/hashicorp/go-hclog
|
|
31
|
-
github.com/hashicorp/go-plugin v1.
|
|
32
|
-
github.com/hashicorp/yamux v0.
|
|
33
|
-
github.com/
|
|
13
|
+
github.com/chromedp/cdproto v0.0.0-20220208224320-6efb837e6bc2 // indirect
|
|
14
|
+
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
|
15
|
+
github.com/elazarl/goproxy v0.0.0-20220115173737-adb46da277ac // indirect
|
|
16
|
+
github.com/fatih/color v1.7.0 // indirect
|
|
17
|
+
github.com/getkin/kin-openapi v0.94.0 // indirect
|
|
18
|
+
github.com/ghodss/yaml v1.0.0 // indirect
|
|
19
|
+
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
|
20
|
+
github.com/go-openapi/swag v0.19.15 // indirect
|
|
21
|
+
github.com/golang/protobuf v1.5.2 // indirect
|
|
22
|
+
github.com/golang/snappy v0.0.3 // indirect
|
|
23
|
+
github.com/google/flatbuffers v2.0.0+incompatible // indirect
|
|
24
|
+
github.com/google/go-cmp v0.5.9 // indirect
|
|
25
|
+
github.com/google/uuid v1.3.0 // indirect
|
|
26
|
+
github.com/gorilla/mux v1.8.0 // indirect
|
|
27
|
+
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
|
|
28
|
+
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
|
|
29
|
+
github.com/hashicorp/go-hclog v0.14.1 // indirect
|
|
30
|
+
github.com/hashicorp/go-plugin v1.4.3 // indirect
|
|
31
|
+
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
|
|
32
|
+
github.com/josharian/intern v1.0.0 // indirect
|
|
34
33
|
github.com/json-iterator/go v1.1.12 // indirect
|
|
35
|
-
github.com/klauspost/compress v1.
|
|
36
|
-
github.com/
|
|
37
|
-
github.com/
|
|
34
|
+
github.com/klauspost/compress v1.13.1 // indirect
|
|
35
|
+
github.com/magefile/mage v1.14.0 // indirect
|
|
36
|
+
github.com/mailru/easyjson v0.7.7 // indirect
|
|
38
37
|
github.com/mattetti/filebuffer v1.0.1 // indirect
|
|
39
|
-
github.com/mattn/go-colorable v0.1.
|
|
40
|
-
github.com/mattn/go-isatty v0.0.
|
|
41
|
-
github.com/mattn/go-runewidth v0.0.
|
|
38
|
+
github.com/mattn/go-colorable v0.1.4 // indirect
|
|
39
|
+
github.com/mattn/go-isatty v0.0.10 // indirect
|
|
40
|
+
github.com/mattn/go-runewidth v0.0.9 // indirect
|
|
41
|
+
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
|
42
|
+
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
|
|
42
43
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
|
43
44
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
|
44
|
-
github.com/
|
|
45
|
-
github.com/oklog/run v1.1.0 // indirect
|
|
45
|
+
github.com/oklog/run v1.0.0 // indirect
|
|
46
46
|
github.com/olekukonko/tablewriter v0.0.5 // indirect
|
|
47
|
-
github.com/
|
|
48
|
-
github.com/
|
|
49
|
-
github.com/prometheus/
|
|
50
|
-
github.com/prometheus/
|
|
51
|
-
github.com/prometheus/
|
|
52
|
-
github.com/prometheus/procfs v0.16.1 // indirect
|
|
53
|
-
github.com/rivo/uniseg v0.4.7 // indirect
|
|
47
|
+
github.com/pierrec/lz4/v4 v4.1.8 // indirect
|
|
48
|
+
github.com/prometheus/client_golang v1.14.0 // indirect
|
|
49
|
+
github.com/prometheus/client_model v0.3.0 // indirect
|
|
50
|
+
github.com/prometheus/common v0.40.0 // indirect
|
|
51
|
+
github.com/prometheus/procfs v0.8.0 // indirect
|
|
54
52
|
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
|
55
53
|
github.com/unknwon/bra v0.0.0-20200517080246-1e3013ecaff8 // indirect
|
|
56
54
|
github.com/unknwon/com v1.0.1 // indirect
|
|
57
55
|
github.com/unknwon/log v0.0.0-20150304194804-e617c87089d3 // indirect
|
|
58
|
-
github.com/urfave/cli v1.22.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
go.opentelemetry.io/contrib/propagators/jaeger v1.38.0 // indirect
|
|
64
|
-
go.opentelemetry.io/contrib/samplers/jaegerremote v0.32.0 // indirect
|
|
65
|
-
go.opentelemetry.io/otel v1.38.0 // indirect
|
|
66
|
-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect
|
|
67
|
-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 // indirect
|
|
68
|
-
go.opentelemetry.io/otel/metric v1.38.0 // indirect
|
|
69
|
-
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
|
|
70
|
-
go.opentelemetry.io/otel/trace v1.38.0 // indirect
|
|
71
|
-
go.opentelemetry.io/proto/otlp v1.7.1 // indirect
|
|
72
|
-
go.yaml.in/yaml/v2 v2.4.3 // indirect
|
|
73
|
-
golang.org/x/exp v0.0.0-20251002181428-27f1f14c8bb9 // indirect
|
|
74
|
-
golang.org/x/mod v0.28.0 // indirect
|
|
75
|
-
golang.org/x/net v0.46.0 // indirect
|
|
76
|
-
golang.org/x/sync v0.18.0 // indirect
|
|
77
|
-
golang.org/x/sys v0.37.0 // indirect
|
|
78
|
-
golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053 // indirect
|
|
79
|
-
golang.org/x/text v0.30.0 // indirect
|
|
80
|
-
golang.org/x/tools v0.37.0 // indirect
|
|
81
|
-
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
|
|
56
|
+
github.com/urfave/cli v1.22.12 // indirect
|
|
57
|
+
golang.org/x/net v0.8.0 // indirect
|
|
58
|
+
golang.org/x/sys v0.6.0 // indirect
|
|
59
|
+
golang.org/x/text v0.8.0 // indirect
|
|
60
|
+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
|
|
82
61
|
google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 // indirect
|
|
83
|
-
google.golang.org/grpc v1.
|
|
84
|
-
google.golang.org/protobuf v1.
|
|
62
|
+
google.golang.org/grpc v1.41.0 // indirect
|
|
63
|
+
google.golang.org/protobuf v1.28.1 // indirect
|
|
85
64
|
gopkg.in/fsnotify/fsnotify.v1 v1.4.7 // indirect
|
|
65
|
+
gopkg.in/yaml.v2 v2.4.0 // indirect
|
|
86
66
|
)
|