@grafana/create-plugin 1.1.1-canary.216.7c199b2.0 → 1.1.1
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/commands/generate-actions/update-go-sdk-and-packages.js +17 -54
- package/package.json +2 -2
- package/src/commands/generate-actions/update-go-sdk-and-packages.ts +19 -42
- package/templates/backend/go.mod +16 -15
- package/templates/backend/go.sum +322 -40
- package/templates/backend-app/go.mod +12 -21
- package/templates/backend-app/go.sum +319 -65
- package/templates/common/.config/webpack/utils.ts +2 -4
- package/templates/common/.config/webpack/webpack.config.ts +7 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# v1.1.1 (Tue Mar 07 2023)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- Keep custom executable name if defined [#207](https://github.com/grafana/plugin-tools/pull/207) ([@academo](https://github.com/academo))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- Esteban Beltran ([@academo](https://github.com/academo))
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
1
13
|
# v1.1.0 (Mon Mar 06 2023)
|
|
2
14
|
|
|
3
15
|
:tada: This release contains work from a new contributor! :tada:
|
|
@@ -46,71 +46,34 @@ var fs_1 = __importDefault(require("fs"));
|
|
|
46
46
|
var child_process_1 = require("child_process");
|
|
47
47
|
var SDK_GO_MODULE = 'github.com/grafana/grafana-plugin-sdk-go';
|
|
48
48
|
function updateGoSdkAndModules(_a) {
|
|
49
|
+
var _this = this;
|
|
49
50
|
var pluginName = _a.pluginName, orgName = _a.orgName, pluginType = _a.pluginType;
|
|
50
|
-
return __awaiter(
|
|
51
|
-
var exportPath, goModPath, goBinaryPath,
|
|
52
|
-
return __generator(this, function (
|
|
53
|
-
switch (
|
|
51
|
+
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
52
|
+
var exportPath, goModPath, goBinaryPath, command;
|
|
53
|
+
return __generator(this, function (_a) {
|
|
54
|
+
switch (_a.label) {
|
|
54
55
|
case 0:
|
|
55
56
|
exportPath = (0, utils_path_1.getExportPath)(pluginName, orgName, pluginType);
|
|
56
57
|
goModPath = "".concat(exportPath, "/go.mod");
|
|
57
58
|
if (!fs_1["default"].existsSync(goModPath)) {
|
|
58
|
-
|
|
59
|
+
resolve('');
|
|
59
60
|
}
|
|
60
61
|
return [4, (0, which_1["default"])('go', { nothrow: true })];
|
|
61
62
|
case 1:
|
|
62
|
-
goBinaryPath =
|
|
63
|
+
goBinaryPath = _a.sent();
|
|
63
64
|
if (!goBinaryPath) {
|
|
64
|
-
|
|
65
|
+
resolve('');
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
_c.sent();
|
|
75
|
-
return [3, 6];
|
|
76
|
-
case 5:
|
|
77
|
-
_b = _c.sent();
|
|
78
|
-
throw new Error('There was an error trying to update the grafana go sdk. Please run `go get github.com/grafana/grafana-plugin-sdk-go` manually in your plugin directory.');
|
|
79
|
-
case 6: return [2, 'Grafana go sdk updated successfully.'];
|
|
67
|
+
command = "go get ".concat(SDK_GO_MODULE);
|
|
68
|
+
(0, child_process_1.exec)(command, { cwd: exportPath }, function (error) {
|
|
69
|
+
if (error) {
|
|
70
|
+
reject('There was an error trying to update the grafana go sdk. Please run `go get github.com/grafana/grafana-plugin-sdk-go` manually in your plugin directory.');
|
|
71
|
+
}
|
|
72
|
+
resolve('Grafana go sdk updated successfully.');
|
|
73
|
+
});
|
|
74
|
+
return [2];
|
|
80
75
|
}
|
|
81
76
|
});
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
exports.updateGoSdkAndModules = updateGoSdkAndModules;
|
|
85
|
-
function updateSdk(exportPath) {
|
|
86
|
-
var _this = this;
|
|
87
|
-
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
88
|
-
var command;
|
|
89
|
-
return __generator(this, function (_a) {
|
|
90
|
-
command = "go get ".concat(SDK_GO_MODULE);
|
|
91
|
-
(0, child_process_1.exec)(command, { cwd: exportPath }, function (error) {
|
|
92
|
-
if (error) {
|
|
93
|
-
reject();
|
|
94
|
-
}
|
|
95
|
-
resolve();
|
|
96
|
-
});
|
|
97
|
-
return [2];
|
|
98
|
-
});
|
|
99
|
-
}); });
|
|
100
|
-
}
|
|
101
|
-
function updateGoMod(exportPath) {
|
|
102
|
-
var _this = this;
|
|
103
|
-
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
104
|
-
var command;
|
|
105
|
-
return __generator(this, function (_a) {
|
|
106
|
-
command = "go mod tidy";
|
|
107
|
-
(0, child_process_1.exec)(command, { cwd: exportPath }, function (error) {
|
|
108
|
-
if (error) {
|
|
109
|
-
reject();
|
|
110
|
-
}
|
|
111
|
-
resolve();
|
|
112
|
-
});
|
|
113
|
-
return [2];
|
|
114
|
-
});
|
|
115
77
|
}); });
|
|
116
78
|
}
|
|
79
|
+
exports.updateGoSdkAndModules = updateGoSdkAndModules;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "1.1.1
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"directory": "packages/create-plugin",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=16"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "b1ae2f0b26beeeff35206df2a28a9d8c6482b16c"
|
|
67
67
|
}
|
|
@@ -6,57 +6,34 @@ import { exec } from 'child_process';
|
|
|
6
6
|
|
|
7
7
|
const SDK_GO_MODULE = 'github.com/grafana/grafana-plugin-sdk-go';
|
|
8
8
|
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// check if there is a go.mod file in exportPath
|
|
14
|
-
const goModPath = `${exportPath}/go.mod`;
|
|
15
|
-
if (!fs.existsSync(goModPath)) {
|
|
16
|
-
// skip if there is no go.mod file
|
|
17
|
-
return '';
|
|
18
|
-
}
|
|
9
|
+
export function updateGoSdkAndModules({ pluginName, orgName, pluginType }: CliArgs): Promise<string> {
|
|
10
|
+
return new Promise(async (resolve, reject) => {
|
|
11
|
+
// plugin directory
|
|
12
|
+
const exportPath = getExportPath(pluginName, orgName, pluginType);
|
|
19
13
|
|
|
20
|
-
|
|
14
|
+
// check if there is a go.mod file in exportPath
|
|
15
|
+
const goModPath = `${exportPath}/go.mod`;
|
|
16
|
+
if (!fs.existsSync(goModPath)) {
|
|
17
|
+
// skip if there is no go.mod file
|
|
18
|
+
resolve('');
|
|
19
|
+
}
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
if (!goBinaryPath) {
|
|
24
|
-
return '';
|
|
25
|
-
}
|
|
21
|
+
const goBinaryPath = await which('go', { nothrow: true });
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
throw new Error(
|
|
32
|
-
'There was an error trying to update the grafana go sdk. Please run `go get github.com/grafana/grafana-plugin-sdk-go` manually in your plugin directory.'
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
return 'Grafana go sdk updated successfully.';
|
|
36
|
-
}
|
|
23
|
+
// if no go binary is found, skip
|
|
24
|
+
if (!goBinaryPath) {
|
|
25
|
+
resolve('');
|
|
26
|
+
}
|
|
37
27
|
|
|
38
|
-
function updateSdk(exportPath: string): Promise<void> {
|
|
39
|
-
return new Promise(async (resolve, reject) => {
|
|
40
28
|
// run go get SDK_GO_MODULE to update the go.mod file
|
|
41
29
|
const command = `go get ${SDK_GO_MODULE}`;
|
|
42
30
|
exec(command, { cwd: exportPath }, (error) => {
|
|
43
31
|
if (error) {
|
|
44
|
-
reject(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function updateGoMod(exportPath: string): Promise<void> {
|
|
52
|
-
return new Promise(async (resolve, reject) => {
|
|
53
|
-
// run go get SDK_GO_MODULE to update the go.mod file
|
|
54
|
-
const command = `go mod tidy`;
|
|
55
|
-
exec(command, { cwd: exportPath }, (error) => {
|
|
56
|
-
if (error) {
|
|
57
|
-
reject();
|
|
32
|
+
reject(
|
|
33
|
+
'There was an error trying to update the grafana go sdk. Please run `go get github.com/grafana/grafana-plugin-sdk-go` manually in your plugin directory.'
|
|
34
|
+
);
|
|
58
35
|
}
|
|
59
|
-
resolve();
|
|
36
|
+
resolve('Grafana go sdk updated successfully.');
|
|
60
37
|
});
|
|
61
38
|
});
|
|
62
39
|
}
|
package/templates/backend/go.mod
CHANGED
|
@@ -2,16 +2,16 @@ module github.com/{{ kebabCase orgName }}/{{ kebabCase pluginName }}
|
|
|
2
2
|
|
|
3
3
|
go 1.19
|
|
4
4
|
|
|
5
|
-
require github.com/grafana/grafana-plugin-sdk-go v0.
|
|
5
|
+
require github.com/grafana/grafana-plugin-sdk-go v0.143.0
|
|
6
6
|
|
|
7
7
|
require (
|
|
8
|
-
github.com/BurntSushi/toml
|
|
8
|
+
github.com/BurntSushi/toml v0.3.1 // indirect
|
|
9
9
|
github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 // indirect
|
|
10
10
|
github.com/beorn7/perks v1.0.1 // indirect
|
|
11
11
|
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
|
12
12
|
github.com/cheekybits/genny v1.0.0 // indirect
|
|
13
13
|
github.com/chromedp/cdproto v0.0.0-20220208224320-6efb837e6bc2 // indirect
|
|
14
|
-
github.com/cpuguy83/go-md2man/v2 v2.0.
|
|
14
|
+
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
|
|
15
15
|
github.com/elazarl/goproxy v0.0.0-20220115173737-adb46da277ac // indirect
|
|
16
16
|
github.com/fatih/color v1.7.0 // indirect
|
|
17
17
|
github.com/getkin/kin-openapi v0.94.0 // indirect
|
|
@@ -21,7 +21,7 @@ require (
|
|
|
21
21
|
github.com/golang/protobuf v1.5.2 // indirect
|
|
22
22
|
github.com/golang/snappy v0.0.3 // indirect
|
|
23
23
|
github.com/google/flatbuffers v2.0.0+incompatible // indirect
|
|
24
|
-
github.com/google/go-cmp v0.5.
|
|
24
|
+
github.com/google/go-cmp v0.5.7 // indirect
|
|
25
25
|
github.com/google/uuid v1.3.0 // indirect
|
|
26
26
|
github.com/gorilla/mux v1.8.0 // indirect
|
|
27
27
|
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
|
|
@@ -38,29 +38,30 @@ require (
|
|
|
38
38
|
github.com/mattn/go-colorable v0.1.4 // indirect
|
|
39
39
|
github.com/mattn/go-isatty v0.0.10 // indirect
|
|
40
40
|
github.com/mattn/go-runewidth v0.0.9 // indirect
|
|
41
|
-
github.com/matttproud/golang_protobuf_extensions v1.0.
|
|
41
|
+
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
|
42
42
|
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
|
|
43
43
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
|
44
44
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
|
45
45
|
github.com/oklog/run v1.0.0 // indirect
|
|
46
46
|
github.com/olekukonko/tablewriter v0.0.5 // indirect
|
|
47
47
|
github.com/pierrec/lz4/v4 v4.1.8 // indirect
|
|
48
|
-
github.com/prometheus/client_golang v1.
|
|
49
|
-
github.com/prometheus/client_model v0.
|
|
50
|
-
github.com/prometheus/common v0.
|
|
51
|
-
github.com/prometheus/procfs v0.
|
|
52
|
-
github.com/russross/blackfriday/v2 v2.1
|
|
48
|
+
github.com/prometheus/client_golang v1.12.1 // indirect
|
|
49
|
+
github.com/prometheus/client_model v0.2.0 // indirect
|
|
50
|
+
github.com/prometheus/common v0.32.1 // indirect
|
|
51
|
+
github.com/prometheus/procfs v0.7.3 // indirect
|
|
52
|
+
github.com/russross/blackfriday/v2 v2.0.1 // indirect
|
|
53
|
+
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
|
|
53
54
|
github.com/unknwon/bra v0.0.0-20200517080246-1e3013ecaff8 // indirect
|
|
54
55
|
github.com/unknwon/com v1.0.1 // indirect
|
|
55
56
|
github.com/unknwon/log v0.0.0-20150304194804-e617c87089d3 // indirect
|
|
56
|
-
github.com/urfave/cli v1.22.
|
|
57
|
-
golang.org/x/net v0.
|
|
58
|
-
golang.org/x/sys v0.
|
|
59
|
-
golang.org/x/text v0.
|
|
57
|
+
github.com/urfave/cli v1.22.1 // indirect
|
|
58
|
+
golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect
|
|
59
|
+
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect
|
|
60
|
+
golang.org/x/text v0.3.6 // indirect
|
|
60
61
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
|
|
61
62
|
google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 // indirect
|
|
62
63
|
google.golang.org/grpc v1.41.0 // indirect
|
|
63
|
-
google.golang.org/protobuf v1.
|
|
64
|
+
google.golang.org/protobuf v1.27.1 // indirect
|
|
64
65
|
gopkg.in/fsnotify/fsnotify.v1 v1.4.7 // indirect
|
|
65
66
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
|
66
67
|
)
|