@grafana/create-plugin 1.0.0 → 1.0.1-canary.207.0ad7d49.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "1.0.0",
|
|
3
|
+
"version": "1.0.1-canary.207.0ad7d49.0",
|
|
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": "0ad7d495e1e58bcd9f5c2c07d6d8114218465d76"
|
|
64
64
|
}
|
|
@@ -9,7 +9,6 @@ import (
|
|
|
9
9
|
|
|
10
10
|
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
|
11
11
|
"github.com/grafana/grafana-plugin-sdk-go/backend/instancemgmt"
|
|
12
|
-
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
|
|
13
12
|
"github.com/grafana/grafana-plugin-sdk-go/data"
|
|
14
13
|
)
|
|
15
14
|
|
|
@@ -45,10 +44,6 @@ func (d *Datasource) Dispose() {
|
|
|
45
44
|
// The QueryDataResponse contains a map of RefID to the response for each query, and each response
|
|
46
45
|
// contains Frames ([]*Frame).
|
|
47
46
|
func (d *Datasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) {
|
|
48
|
-
// when logging at a non-Debug level, make sure you don't include sensitive information in the message
|
|
49
|
-
// (like the *backend.QueryDataRequest)
|
|
50
|
-
log.DefaultLogger.Debug("QueryData called", "numQueries", len(req.Queries))
|
|
51
|
-
|
|
52
47
|
// create response struct
|
|
53
48
|
response := backend.NewQueryDataResponse()
|
|
54
49
|
|
|
@@ -99,10 +94,6 @@ func (d *Datasource) query(_ context.Context, pCtx backend.PluginContext, query
|
|
|
99
94
|
// datasource configuration page which allows users to verify that
|
|
100
95
|
// a datasource is working as expected.
|
|
101
96
|
func (d *Datasource) CheckHealth(_ context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error) {
|
|
102
|
-
// when logging at a non-Debug level, make sure you don't include sensitive information in the message
|
|
103
|
-
// (like the *backend.QueryDataRequest)
|
|
104
|
-
log.DefaultLogger.Debug("CheckHealth called")
|
|
105
|
-
|
|
106
97
|
var status = backend.HealthStatusOk
|
|
107
98
|
var message = "Data source is working"
|
|
108
99
|
|
|
@@ -10,10 +10,8 @@ export function getPackageJson() {
|
|
|
10
10
|
return require(path.resolve(process.cwd(), 'package.json'));
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return id;
|
|
13
|
+
export function getPluginJson() {
|
|
14
|
+
return require(path.resolve(process.cwd(), `${SOURCE_DIR}/plugin.json`));
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
export function hasReadme() {
|
|
@@ -13,9 +13,11 @@ import path from 'path';
|
|
|
13
13
|
import ReplaceInFileWebpackPlugin from 'replace-in-file-webpack-plugin';
|
|
14
14
|
import { Configuration } from 'webpack';
|
|
15
15
|
|
|
16
|
-
import { getPackageJson,
|
|
16
|
+
import { getPackageJson, getPluginJson, hasReadme, getEntries } from './utils';
|
|
17
17
|
import { SOURCE_DIR, DIST_DIR } from './constants';
|
|
18
18
|
|
|
19
|
+
const pluginJson = getPluginJson();
|
|
20
|
+
|
|
19
21
|
const config = async (env): Promise<Configuration> => ({
|
|
20
22
|
cache: {
|
|
21
23
|
type: 'filesystem',
|
|
@@ -105,7 +107,7 @@ const config = async (env): Promise<Configuration> => ({
|
|
|
105
107
|
type: 'asset/resource',
|
|
106
108
|
generator: {
|
|
107
109
|
// Keep publicPath relative for host.com/grafana/ deployments
|
|
108
|
-
publicPath: `public/plugins/${
|
|
110
|
+
publicPath: `public/plugins/${pluginJson.id}/img/`,
|
|
109
111
|
outputPath: 'img/',
|
|
110
112
|
filename: Boolean(env.production) ? '[hash][ext]' : '[name][ext]',
|
|
111
113
|
},
|
|
@@ -115,7 +117,7 @@ const config = async (env): Promise<Configuration> => ({
|
|
|
115
117
|
type: 'asset/resource',
|
|
116
118
|
generator: {
|
|
117
119
|
// Keep publicPath relative for host.com/grafana/ deployments
|
|
118
|
-
publicPath: `public/plugins/${
|
|
120
|
+
publicPath: `public/plugins/${pluginJson.id}/fonts`,
|
|
119
121
|
outputPath: 'fonts/',
|
|
120
122
|
filename: Boolean(env.production) ? '[hash][ext]' : '[name][ext]',
|
|
121
123
|
},
|
|
@@ -125,7 +127,7 @@ const config = async (env): Promise<Configuration> => ({
|
|
|
125
127
|
|
|
126
128
|
output: {
|
|
127
129
|
clean: {
|
|
128
|
-
keep:
|
|
130
|
+
keep: new RegExp(`.*?_(amd64|arm(64)?)(.exe)?`),
|
|
129
131
|
},
|
|
130
132
|
filename: '[name].js',
|
|
131
133
|
library: {
|
|
@@ -169,7 +171,7 @@ const config = async (env): Promise<Configuration> => ({
|
|
|
169
171
|
},
|
|
170
172
|
{
|
|
171
173
|
search: /\%PLUGIN_ID\%/g,
|
|
172
|
-
replace:
|
|
174
|
+
replace: pluginJson.id,
|
|
173
175
|
},
|
|
174
176
|
],
|
|
175
177
|
},
|