@grafana/create-plugin 0.4.1 → 0.5.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
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# v0.5.0 (Mon Nov 07 2022)
|
|
2
|
+
|
|
3
|
+
:tada: This release contains work from a new contributor! :tada:
|
|
4
|
+
|
|
5
|
+
Thank you, Giuseppe Guerra ([@xnyo](https://github.com/xnyo)), for all your work!
|
|
6
|
+
|
|
7
|
+
#### 🚀 Enhancement
|
|
8
|
+
|
|
9
|
+
- Create-Plugin: Implement DataSourceWithBackend for datasource plugins with backend [#134](https://github.com/grafana/plugin-tools/pull/134) ([@xnyo](https://github.com/xnyo))
|
|
10
|
+
|
|
11
|
+
#### 🐛 Bug Fix
|
|
12
|
+
|
|
13
|
+
- Use pluginId to generate the docker-compose.yml file [#128](https://github.com/grafana/plugin-tools/pull/128) ([@academo](https://github.com/academo))
|
|
14
|
+
|
|
15
|
+
#### Authors: 2
|
|
16
|
+
|
|
17
|
+
- Esteban Beltran ([@academo](https://github.com/academo))
|
|
18
|
+
- Giuseppe Guerra ([@xnyo](https://github.com/xnyo))
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
1
22
|
# v0.4.1 (Mon Oct 31 2022)
|
|
2
23
|
|
|
3
24
|
#### 🐛 Bug Fix
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
14
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
15
|
if (ar || !(i in from)) {
|
|
@@ -80,7 +91,12 @@ function default_1(plop) {
|
|
|
80
91
|
actions: function (_a) {
|
|
81
92
|
var pluginName = _a.pluginName, orgName = _a.orgName, pluginType = _a.pluginType, hasBackend = _a.hasBackend, hasGithubWorkflows = _a.hasGithubWorkflows, hasGithubLevitateWorkflow = _a.hasGithubLevitateWorkflow;
|
|
82
93
|
var exportPath = getExportPath(pluginName, orgName, pluginType);
|
|
83
|
-
var
|
|
94
|
+
var pluginId = (0, utils_handlebars_1.normalizeId)(pluginName, orgName, pluginType);
|
|
95
|
+
var commonActions = getActionsForTemplateFolder({
|
|
96
|
+
folderPath: constants_1.TEMPLATE_PATHS.common,
|
|
97
|
+
exportPath: exportPath,
|
|
98
|
+
templateData: { pluginId: pluginId }
|
|
99
|
+
});
|
|
84
100
|
var pluginTypeSpecificActions = getActionsForTemplateFolder({
|
|
85
101
|
folderPath: constants_1.TEMPLATE_PATHS[pluginType],
|
|
86
102
|
exportPath: exportPath
|
|
@@ -118,7 +134,7 @@ function replacePatternWithTemplateInReadme(pattern, partialsFile, exportPath) {
|
|
|
118
134
|
};
|
|
119
135
|
}
|
|
120
136
|
function getActionsForTemplateFolder(_a) {
|
|
121
|
-
var folderPath = _a.folderPath, exportPath = _a.exportPath;
|
|
137
|
+
var folderPath = _a.folderPath, exportPath = _a.exportPath, _b = _a.templateData, templateData = _b === void 0 ? {} : _b;
|
|
122
138
|
var files = glob_1["default"].sync("".concat(folderPath, "/**"), { dot: true });
|
|
123
139
|
function getExportFileName(f) {
|
|
124
140
|
if (path_1["default"].basename(f) === 'gitignore') {
|
|
@@ -135,7 +151,7 @@ function getActionsForTemplateFolder(_a) {
|
|
|
135
151
|
path: path_1["default"].join(exportPath, getExportPath(f), getExportFileName(f)),
|
|
136
152
|
force: constants_1.IS_DEV,
|
|
137
153
|
abortOnFail: false,
|
|
138
|
-
data: constants_1.EXTRA_TEMPLATE_VARIABLES
|
|
154
|
+
data: __assign(__assign({}, constants_1.EXTRA_TEMPLATE_VARIABLES), templateData)
|
|
139
155
|
}); });
|
|
140
156
|
}
|
|
141
157
|
function isFile(path) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"directory": "packages/create-plugin",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=16"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "e1bd595325dbb9ff838c2e3d674ab5c4f4a67a92"
|
|
63
63
|
}
|
|
@@ -93,8 +93,13 @@ export default function (plop: NodePlopAPI) {
|
|
|
93
93
|
hasGithubLevitateWorkflow,
|
|
94
94
|
}: CliArgs) {
|
|
95
95
|
const exportPath = getExportPath(pluginName, orgName, pluginType);
|
|
96
|
+
const pluginId = normalizeId(pluginName, orgName, pluginType);
|
|
96
97
|
// Copy over files that are shared between plugins types
|
|
97
|
-
const commonActions = getActionsForTemplateFolder({
|
|
98
|
+
const commonActions = getActionsForTemplateFolder({
|
|
99
|
+
folderPath: TEMPLATE_PATHS.common,
|
|
100
|
+
exportPath,
|
|
101
|
+
templateData: { pluginId },
|
|
102
|
+
});
|
|
98
103
|
|
|
99
104
|
// Copy over files from the plugin type specific folder, e.g. "tempaltes/app" for "app" plugins ("app" | "panel" | "datasource").
|
|
100
105
|
const pluginTypeSpecificActions = getActionsForTemplateFolder({
|
|
@@ -163,7 +168,15 @@ function replacePatternWithTemplateInReadme(
|
|
|
163
168
|
}
|
|
164
169
|
|
|
165
170
|
// TODO<use Plop action `addMany` instead>
|
|
166
|
-
function getActionsForTemplateFolder({
|
|
171
|
+
function getActionsForTemplateFolder({
|
|
172
|
+
folderPath,
|
|
173
|
+
exportPath,
|
|
174
|
+
templateData = {},
|
|
175
|
+
}: {
|
|
176
|
+
folderPath: string;
|
|
177
|
+
exportPath: string;
|
|
178
|
+
templateData?: Record<string, string>;
|
|
179
|
+
}) {
|
|
167
180
|
const files = glob.sync(`${folderPath}/**`, { dot: true });
|
|
168
181
|
function getExportFileName(f: string) {
|
|
169
182
|
// yarn and npm packing will not include `.gitignore` files
|
|
@@ -186,7 +199,10 @@ function getActionsForTemplateFolder({ folderPath, exportPath }: { folderPath: s
|
|
|
186
199
|
force: IS_DEV,
|
|
187
200
|
// We would still like to scaffold as many files as possible even if one fails
|
|
188
201
|
abortOnFail: false,
|
|
189
|
-
data:
|
|
202
|
+
data: {
|
|
203
|
+
...EXTRA_TEMPLATE_VARIABLES,
|
|
204
|
+
...templateData,
|
|
205
|
+
},
|
|
190
206
|
}));
|
|
191
207
|
}
|
|
192
208
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DataSourceInstanceSettings } from '@grafana/data';
|
|
2
|
+
|
|
3
|
+
import { MyQuery, MyDataSourceOptions } from './types';
|
|
4
|
+
import { DataSourceWithBackend } from '@grafana/runtime';
|
|
5
|
+
|
|
6
|
+
export class DataSource extends DataSourceWithBackend<MyQuery, MyDataSourceOptions> {
|
|
7
|
+
constructor(instanceSettings: DataSourceInstanceSettings<MyDataSourceOptions>) {
|
|
8
|
+
super(instanceSettings);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -2,7 +2,7 @@ version: '3.0'
|
|
|
2
2
|
|
|
3
3
|
services:
|
|
4
4
|
grafana:
|
|
5
|
-
container_name: '{{
|
|
5
|
+
container_name: '{{ pluginId }}'
|
|
6
6
|
build:
|
|
7
7
|
context: ./.config
|
|
8
8
|
args:
|
|
@@ -10,5 +10,5 @@ services:
|
|
|
10
10
|
ports:
|
|
11
11
|
- 3000:3000/tcp
|
|
12
12
|
volumes:
|
|
13
|
-
- ./dist:/var/lib/grafana/plugins/{{
|
|
13
|
+
- ./dist:/var/lib/grafana/plugins/{{ pluginId }}
|
|
14
14
|
- ./provisioning:/etc/grafana/provisioning
|