@grafana/create-plugin 0.8.2-canary.182.e5280e4.0 → 0.8.2
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 +16 -0
- package/dist/commands/generate.plopfile.js +8 -4
- package/package.json +2 -2
- package/src/commands/generate.plopfile.ts +8 -4
- package/templates/app/README.md +1 -1
- package/templates/common/.config/webpack/utils.ts +11 -12
- package/templates/datasource/README.md +1 -1
- package/templates/panel/README.md +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
# v0.8.2 (Wed Jan 11 2023)
|
|
2
|
+
|
|
3
|
+
:tada: This release contains work from a new contributor! :tada:
|
|
4
|
+
|
|
5
|
+
Thank you, Sarah Zinger ([@sarahzinger](https://github.com/sarahzinger)), for all your work!
|
|
6
|
+
|
|
7
|
+
#### 🐛 Bug Fix
|
|
8
|
+
|
|
9
|
+
- Create Plugin: Update docs to build backend before running docker [#167](https://github.com/grafana/plugin-tools/pull/167) ([@sarahzinger](https://github.com/sarahzinger))
|
|
10
|
+
|
|
11
|
+
#### Authors: 1
|
|
12
|
+
|
|
13
|
+
- Sarah Zinger ([@sarahzinger](https://github.com/sarahzinger))
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
1
17
|
# v0.8.1 (Tue Dec 13 2022)
|
|
2
18
|
|
|
3
19
|
:tada: This release contains work from a new contributor! :tada:
|
|
@@ -68,7 +68,7 @@ function default_1(plop) {
|
|
|
68
68
|
name: 'pluginType',
|
|
69
69
|
type: 'list',
|
|
70
70
|
choices: [constants_1.PLUGIN_TYPES.app, constants_1.PLUGIN_TYPES.datasource, constants_1.PLUGIN_TYPES.panel],
|
|
71
|
-
message: 'What
|
|
71
|
+
message: 'What kind of plugin would you like? '
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
name: 'hasBackend',
|
|
@@ -191,11 +191,15 @@ function printSuccessMessage(answers) {
|
|
|
191
191
|
var commands = __spreadArray(__spreadArray([
|
|
192
192
|
"- `cd ./".concat(directory, "`"),
|
|
193
193
|
'- `yarn install` to install frontend dependencies.',
|
|
194
|
-
'- `docker-compose up` to start a grafana development server.',
|
|
195
194
|
'- `yarn dev` to build (and watch) the plugin frontend code.'
|
|
196
|
-
], (answers.hasBackend
|
|
195
|
+
], (answers.hasBackend
|
|
196
|
+
? [
|
|
197
|
+
'- `mage -v build:linux` to build the plugin backend code. Rerun this command every time you edit your backend files.',
|
|
198
|
+
]
|
|
199
|
+
: []), true), [
|
|
200
|
+
'- `docker-compose up` to start a grafana development server. Restart this command after each time you run mage to run your new backend code.',
|
|
197
201
|
'- Open http://localhost:3000 in your browser to create a dashboard to begin developing your plugin.',
|
|
198
202
|
], false);
|
|
199
|
-
var msg = "\nCongratulations on scaffolding a Grafana ".concat(answers.pluginType, " plugin! \uD83D\uDE80\n\n## What's next?\n\nRun the following commands to get started:\n").concat(commands.map(function (command) { return command; }).join('\n'), "\n\n_Note: We strongly recommend creating a new Git repository by running `git init` in ./").concat(directory, " before continuing._\n\n- View
|
|
203
|
+
var msg = "\nCongratulations on scaffolding a Grafana ".concat(answers.pluginType, " plugin! \uD83D\uDE80\n\n## What's next?\n\nRun the following commands to get started:\n").concat(commands.map(function (command) { return command; }).join('\n'), "\n\n_Note: We strongly recommend creating a new Git repository by running `git init` in ./").concat(directory, " before continuing._\n\n- View ./").concat(directory, "/README.md\n- Learn more about Grafana Plugins at https://grafana.com/docs/grafana/latest/plugins/developing/development/\n");
|
|
200
204
|
return (0, utils_console_1.displayAsMarkdown)(msg);
|
|
201
205
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "0.8.2
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"directory": "packages/create-plugin",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=16"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "4bdbc3b4f52e243ec28419cfb8a263b7c6b5dffb"
|
|
64
64
|
}
|
|
@@ -65,7 +65,7 @@ export default function (plop: NodePlopAPI) {
|
|
|
65
65
|
name: 'pluginType',
|
|
66
66
|
type: 'list',
|
|
67
67
|
choices: [PLUGIN_TYPES.app, PLUGIN_TYPES.datasource, PLUGIN_TYPES.panel],
|
|
68
|
-
message: 'What
|
|
68
|
+
message: 'What kind of plugin would you like? ',
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
name: 'hasBackend',
|
|
@@ -252,9 +252,13 @@ function printSuccessMessage(answers: CliArgs) {
|
|
|
252
252
|
const commands = [
|
|
253
253
|
`- \`cd ./${directory}\``,
|
|
254
254
|
'- `yarn install` to install frontend dependencies.',
|
|
255
|
-
'- `docker-compose up` to start a grafana development server.',
|
|
256
255
|
'- `yarn dev` to build (and watch) the plugin frontend code.',
|
|
257
|
-
...(answers.hasBackend
|
|
256
|
+
...(answers.hasBackend
|
|
257
|
+
? [
|
|
258
|
+
'- `mage -v build:linux` to build the plugin backend code. Rerun this command every time you edit your backend files.',
|
|
259
|
+
]
|
|
260
|
+
: []),
|
|
261
|
+
'- `docker-compose up` to start a grafana development server. Restart this command after each time you run mage to run your new backend code.',
|
|
258
262
|
'- Open http://localhost:3000 in your browser to create a dashboard to begin developing your plugin.',
|
|
259
263
|
];
|
|
260
264
|
|
|
@@ -268,7 +272,7 @@ ${commands.map((command) => command).join('\n')}
|
|
|
268
272
|
|
|
269
273
|
_Note: We strongly recommend creating a new Git repository by running \`git init\` in ./${directory} before continuing._
|
|
270
274
|
|
|
271
|
-
- View
|
|
275
|
+
- View ./${directory}/README.md
|
|
272
276
|
- Learn more about Grafana Plugins at https://grafana.com/docs/grafana/latest/plugins/developing/development/
|
|
273
277
|
`;
|
|
274
278
|
|
package/templates/app/README.md
CHANGED
|
@@ -8,8 +8,8 @@ App plugins can let you create a custom out-of-the-box monitoring experience by
|
|
|
8
8
|
|
|
9
9
|
## Getting started
|
|
10
10
|
|
|
11
|
-
-- INSERT FRONTEND GETTING STARTED --
|
|
12
11
|
{{#if hasBackend}}-- INSERT BACKEND GETTING STARTED --{{/if}}
|
|
12
|
+
-- INSERT FRONTEND GETTING STARTED --
|
|
13
13
|
|
|
14
14
|
-- INSERT DISTRIBUTING YOUR PLUGIN --
|
|
15
15
|
|
|
@@ -21,22 +21,21 @@ export function hasReadme() {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export async function getEntries(): Promise<Record<string, string>> {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
})
|
|
30
|
-
);
|
|
24
|
+
const parent = '..';
|
|
25
|
+
const pluginsJson = await globAsync('**/src/**/plugin.json');
|
|
26
|
+
|
|
27
|
+
const plugins = await Promise.all(pluginsJson.map(pluginJson => {
|
|
28
|
+
const folder = path.dirname(pluginJson);
|
|
29
|
+
return globAsync(`${folder}/module.{ts,tsx,js}`);
|
|
30
|
+
}));
|
|
31
31
|
|
|
32
32
|
return plugins.reduce((result, modules) => {
|
|
33
33
|
return modules.reduce((result, module) => {
|
|
34
|
-
const pluginPath = path.dirname(module);
|
|
34
|
+
const pluginPath = path.resolve(path.dirname(module), parent);
|
|
35
35
|
const pluginName = path.basename(pluginPath);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
result[entryName] = module;
|
|
36
|
+
const entryName = plugins.length > 1 ? `${pluginName}/module` : 'module';
|
|
37
|
+
|
|
38
|
+
result[entryName] = path.join(parent, module);
|
|
40
39
|
return result;
|
|
41
40
|
}, result);
|
|
42
41
|
}, {});
|
|
@@ -8,8 +8,8 @@ Grafana supports a wide range of data sources, including Prometheus, MySQL, and
|
|
|
8
8
|
|
|
9
9
|
## Getting started
|
|
10
10
|
|
|
11
|
-
-- INSERT FRONTEND GETTING STARTED --
|
|
12
11
|
{{#if hasBackend}}-- INSERT BACKEND GETTING STARTED --{{/if}}
|
|
12
|
+
-- INSERT FRONTEND GETTING STARTED --
|
|
13
13
|
|
|
14
14
|
-- INSERT DISTRIBUTING YOUR PLUGIN --
|
|
15
15
|
|