@grafana/create-plugin 2.2.0 → 2.2.1-canary.481.f400697.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/dist/commands/generate.plopfile.js +10 -6
- package/dist/utils/tests/utils.templates.test.js +1 -1
- package/package.json +2 -2
- package/src/commands/generate.plopfile.ts +15 -8
- package/src/utils/tests/utils.templates.test.ts +1 -1
- package/templates/_partials/backend-getting-started.md +1 -1
- package/templates/_partials/distributing-your-plugin.md +2 -2
- package/templates/app/README.md +1 -1
- package/templates/backend/pkg/plugin/datasource.go +1 -1
- package/templates/common/src/README.md +1 -1
- package/templates/datasource/README.md +1 -1
- package/templates/github/ci/.github/workflows/release.yml +1 -1
- package/templates/panel/README.md +1 -1
- /package/templates/common/.config/{.eslintrc → _eslintrc} +0 -0
- /package/templates/common/{.eslintrc → _eslintrc} +0 -0
- /package/templates/common/{package.json → _package.json} +0 -0
|
@@ -186,13 +186,11 @@ function getActionsForTemplateFolder(_a) {
|
|
|
186
186
|
files = files.filter(function (file) { return path_1.default.basename(file) !== 'npmrc'; });
|
|
187
187
|
}
|
|
188
188
|
function getExportFileName(f) {
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
var baseName = path_1.default.basename(f);
|
|
190
|
+
if (Object.keys(configFileNamesMap).includes(baseName)) {
|
|
191
|
+
return configFileNamesMap[baseName];
|
|
191
192
|
}
|
|
192
|
-
|
|
193
|
-
return '.npmrc';
|
|
194
|
-
}
|
|
195
|
-
return path_1.default.extname(f) === '.hbs' ? path_1.default.basename(f, '.hbs') : path_1.default.basename(f);
|
|
193
|
+
return path_1.default.extname(f) === '.hbs' ? path_1.default.basename(f, '.hbs') : baseName;
|
|
196
194
|
}
|
|
197
195
|
function getExportPath(f) {
|
|
198
196
|
return path_1.default.relative(folderPath, path_1.default.dirname(f));
|
|
@@ -206,6 +204,12 @@ function getActionsForTemplateFolder(_a) {
|
|
|
206
204
|
data: __assign(__assign({}, constants_1.EXTRA_TEMPLATE_VARIABLES), templateData),
|
|
207
205
|
}); });
|
|
208
206
|
}
|
|
207
|
+
var configFileNamesMap = {
|
|
208
|
+
gitignore: '.gitignore',
|
|
209
|
+
npmrc: '.npmrc',
|
|
210
|
+
_eslintrc: '.eslintrc',
|
|
211
|
+
'_package.json': 'package.json',
|
|
212
|
+
};
|
|
209
213
|
function isFile(path) {
|
|
210
214
|
try {
|
|
211
215
|
return fs_1.default.lstatSync(path).isFile();
|
|
@@ -19,7 +19,7 @@ describe('Utils / Templates', function () {
|
|
|
19
19
|
expect(templateFiles.length).toBe(0);
|
|
20
20
|
});
|
|
21
21
|
test('should be possible to filter for multiple different files', function () {
|
|
22
|
-
var templateFiles = (0, utils_templates_1.getTemplateFiles)(constants_1.PLUGIN_TYPES.app, ['.
|
|
22
|
+
var templateFiles = (0, utils_templates_1.getTemplateFiles)(constants_1.PLUGIN_TYPES.app, ['.prettierrc.js', 'cypress.json', 'tsconfig.json']);
|
|
23
23
|
expect(Array.isArray(templateFiles)).toBe(true);
|
|
24
24
|
expect(templateFiles.length).toBe(3);
|
|
25
25
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "2.2.0",
|
|
3
|
+
"version": "2.2.1-canary.481.f400697.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"directory": "packages/create-plugin",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"engines": {
|
|
67
67
|
"node": ">=18"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "f40069751aa92d8136651fefac2bf57b1cd15c4d"
|
|
70
70
|
}
|
|
@@ -237,16 +237,13 @@ function getActionsForTemplateFolder({
|
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
function getExportFileName(f: string) {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
if (
|
|
243
|
-
return
|
|
244
|
-
}
|
|
245
|
-
if (path.basename(f) === 'npmrc') {
|
|
246
|
-
return '.npmrc';
|
|
240
|
+
const baseName = path.basename(f);
|
|
241
|
+
|
|
242
|
+
if (Object.keys(configFileNamesMap).includes(baseName)) {
|
|
243
|
+
return configFileNamesMap[baseName];
|
|
247
244
|
}
|
|
248
245
|
|
|
249
|
-
return path.extname(f) === '.hbs' ? path.basename(f, '.hbs') :
|
|
246
|
+
return path.extname(f) === '.hbs' ? path.basename(f, '.hbs') : baseName;
|
|
250
247
|
}
|
|
251
248
|
|
|
252
249
|
function getExportPath(f: string) {
|
|
@@ -269,6 +266,16 @@ function getActionsForTemplateFolder({
|
|
|
269
266
|
}));
|
|
270
267
|
}
|
|
271
268
|
|
|
269
|
+
// yarn and npm packing will not include `.gitignore` files
|
|
270
|
+
// so we have to manually rename them to add the dot prefix
|
|
271
|
+
// other config files trip up the tooling in the plugin-tools monorepo
|
|
272
|
+
const configFileNamesMap: Record<string, string> = {
|
|
273
|
+
gitignore: '.gitignore',
|
|
274
|
+
npmrc: '.npmrc',
|
|
275
|
+
_eslintrc: '.eslintrc',
|
|
276
|
+
'_package.json': 'package.json',
|
|
277
|
+
};
|
|
278
|
+
|
|
272
279
|
function isFile(path: string) {
|
|
273
280
|
try {
|
|
274
281
|
return fs.lstatSync(path).isFile();
|
|
@@ -28,7 +28,7 @@ describe('Utils / Templates', () => {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
test('should be possible to filter for multiple different files', () => {
|
|
31
|
-
const templateFiles = getTemplateFiles(PLUGIN_TYPES.app, ['.
|
|
31
|
+
const templateFiles = getTemplateFiles(PLUGIN_TYPES.app, ['.prettierrc.js', 'cypress.json', 'tsconfig.json']);
|
|
32
32
|
|
|
33
33
|
expect(Array.isArray(templateFiles)).toBe(true);
|
|
34
34
|
expect(templateFiles.length).toBe(3);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
### Backend
|
|
2
2
|
|
|
3
|
-
1. Update [Grafana plugin SDK for Go](https://grafana.com/
|
|
3
|
+
1. Update [Grafana plugin SDK for Go](https://grafana.com/developers/plugin-tools/introduction/grafana-plugin-sdk-for-go) dependency to the latest minor version:
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
go get -u github.com/grafana/grafana-plugin-sdk-go
|
|
@@ -6,11 +6,11 @@ _Note: It's not necessary to sign a plugin during development. The docker develo
|
|
|
6
6
|
|
|
7
7
|
## Initial steps
|
|
8
8
|
|
|
9
|
-
Before signing a plugin please read the Grafana [plugin publishing and signing criteria](https://grafana.com/
|
|
9
|
+
Before signing a plugin please read the Grafana [plugin publishing and signing criteria](https://grafana.com/legal/plugins/#plugin-publishing-and-signing-criteria) documentation carefully.
|
|
10
10
|
|
|
11
11
|
`@grafana/create-plugin` has added the necessary commands and workflows to make signing and distributing a plugin via the grafana plugins catalog as straightforward as possible.
|
|
12
12
|
|
|
13
|
-
Before signing a plugin for the first time please consult the Grafana [plugin signature levels](https://grafana.com/
|
|
13
|
+
Before signing a plugin for the first time please consult the Grafana [plugin signature levels](https://grafana.com/legal/plugins/#what-are-the-different-classifications-of-plugins) documentation to understand the differences between the types of signature level.
|
|
14
14
|
|
|
15
15
|
1. Create a [Grafana Cloud account](https://grafana.com/signup).
|
|
16
16
|
2. Make sure that the first part of the plugin ID matches the slug of your Grafana Cloud account.
|
package/templates/app/README.md
CHANGED
|
@@ -19,4 +19,4 @@ Below you can find source code for existing app plugins and other related docume
|
|
|
19
19
|
|
|
20
20
|
- [Basic app plugin example](https://github.com/grafana/grafana-plugin-examples/tree/master/examples/app-basic#readme)
|
|
21
21
|
- [`plugin.json` documentation](https://grafana.com/developers/plugin-tools/reference-plugin-json)
|
|
22
|
-
- [How to sign a plugin?](https://grafana.com/
|
|
22
|
+
- [How to sign a plugin?](https://grafana.com/developers/plugin-tools/publish-a-plugin/sign-a-plugin)
|
|
@@ -74,7 +74,7 @@ func (d *Datasource) query(_ context.Context, pCtx backend.PluginContext, query
|
|
|
74
74
|
|
|
75
75
|
// create data frame response.
|
|
76
76
|
// For an overview on data frames and how grafana handles them:
|
|
77
|
-
// https://grafana.com/
|
|
77
|
+
// https://grafana.com/developers/plugin-tools/introduction/data-frames
|
|
78
78
|
frame := data.NewFrame("response")
|
|
79
79
|
|
|
80
80
|
// add fields.
|
|
@@ -33,7 +33,7 @@ Consider other [badges](https://shields.io/badges) as you feel appropriate for y
|
|
|
33
33
|
Provide one or more paragraphs as an introduction to your plugin to help users understand why they should use it.
|
|
34
34
|
|
|
35
35
|
Consider including screenshots:
|
|
36
|
-
- in [plugin.json](https://grafana.com/
|
|
36
|
+
- in [plugin.json](https://grafana.com/developers/plugin-tools/reference-plugin-json#info) include them as relative links.
|
|
37
37
|
- in the README ensure they are absolute URLs.
|
|
38
38
|
|
|
39
39
|
## Requirements
|
|
@@ -19,4 +19,4 @@ Below you can find source code for existing app plugins and other related docume
|
|
|
19
19
|
|
|
20
20
|
- [Basic data source plugin example](https://github.com/grafana/grafana-plugin-examples/tree/master/examples/datasource-basic#readme)
|
|
21
21
|
- [`plugin.json` documentation](https://grafana.com/developers/plugin-tools/reference-plugin-json)
|
|
22
|
-
- [How to sign a plugin?](https://grafana.com/
|
|
22
|
+
- [How to sign a plugin?](https://grafana.com/developers/plugin-tools/publish-a-plugin/sign-a-plugin)
|
|
@@ -61,7 +61,7 @@ jobs:
|
|
|
61
61
|
|
|
62
62
|
- name: Warn missing Grafana access policy token
|
|
63
63
|
run: |
|
|
64
|
-
echo Please generate a Grafana access policy token: https://grafana.com/
|
|
64
|
+
echo Please generate a Grafana access policy token: https://grafana.com/developers/plugin-tools/publish-a-plugin/sign-a-plugin#generate-an-access-policy-token
|
|
65
65
|
echo Once done please follow the instructions found here: https://github.com/$\{{github.repository}}/blob/main/README.md#using-github-actions-release-workflow
|
|
66
66
|
if: $\{{ env.GRAFANA_ACCESS_POLICY_TOKEN == '' }}
|
|
67
67
|
|
|
@@ -20,4 +20,4 @@ Below you can find source code for existing app plugins and other related docume
|
|
|
20
20
|
|
|
21
21
|
- [Basic panel plugin example](https://github.com/grafana/grafana-plugin-examples/tree/master/examples/panel-basic#readme)
|
|
22
22
|
- [`plugin.json` documentation](https://grafana.com/developers/plugin-tools/reference-plugin-json)
|
|
23
|
-
- [How to sign a plugin?](https://grafana.com/
|
|
23
|
+
- [How to sign a plugin?](https://grafana.com/developers/plugin-tools/publish-a-plugin/sign-a-plugin)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|