Skip to content

Commit a0098a5

Browse files
authored
Bugfixes and Feature additions (#423)
* update packages and create-plugin updates * update snapshot * fix for composite auto-generation * add dashboard for testing composites * dashboard for testing csv content * update changelog * update cspell * bump min version to 9.5.x * remove v8 support * remove console output in tests
1 parent e073902 commit a0098a5

29 files changed

+5655
-4690
lines changed

.config/.cprc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "4.10.4"
2+
"version": "5.13.0"
33
}

.config/.eslintrc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
33
*
44
* In order to extend the configuration follow the steps in
5-
* https://grafana.com/developers/plugin-tools/create-a-plugin/extend-a-plugin/extend-configurations#extend-the-eslint-config
5+
* https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-eslint-config
66
*/
77
{
88
"extends": ["@grafana/eslint-config"],
@@ -20,6 +20,12 @@
2020
"parserOptions": {
2121
"project": "./tsconfig.json"
2222
}
23+
},
24+
{
25+
"files": ["./tests/**/*"],
26+
"rules": {
27+
"react-hooks/rules-of-hooks": "off",
28+
},
2329
}
2430
]
2531
}

.config/Dockerfile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ ARG grafana_image=grafana-enterprise
33

44
FROM grafana/${grafana_image}:${grafana_version}
55

6+
ARG anonymous_auth_enabled=true
67
ARG development=false
8+
ARG TARGETARCH
79

810

911
ENV DEV "${development}"
1012

1113
# Make it as simple as possible to access the grafana instance for development purposes
1214
# Do NOT enable these settings in a public facing / production grafana instance
1315
ENV GF_AUTH_ANONYMOUS_ORG_ROLE "Admin"
14-
ENV GF_AUTH_ANONYMOUS_ENABLED "true"
16+
ENV GF_AUTH_ANONYMOUS_ENABLED "${anonymous_auth_enabled}"
1517
ENV GF_AUTH_BASIC_ENABLED "false"
1618
# Set development mode so plugins can be loaded without the need to sign
1719
ENV GF_DEFAULT_APP_MODE "development"
@@ -27,14 +29,14 @@ USER root
2729
# Installing supervisor and inotify-tools
2830
RUN if [ "${development}" = "true" ]; then \
2931
if grep -i -q alpine /etc/issue; then \
30-
apk add supervisor inotify-tools git; \
32+
apk add supervisor inotify-tools git; \
3133
elif grep -i -q ubuntu /etc/issue; then \
32-
DEBIAN_FRONTEND=noninteractive && \
33-
apt-get update && \
34-
apt-get install -y supervisor inotify-tools git && \
35-
rm -rf /var/lib/apt/lists/*; \
34+
DEBIAN_FRONTEND=noninteractive && \
35+
apt-get update && \
36+
apt-get install -y supervisor inotify-tools git && \
37+
rm -rf /var/lib/apt/lists/*; \
3638
else \
37-
echo 'ERROR: Unsupported base image' && /bin/false; \
39+
echo 'ERROR: Unsupported base image' && /bin/false; \
3840
fi \
3941
fi
4042

.config/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,6 @@ services:
159159
grafana_image: ${GRAFANA_IMAGE:-grafana}
160160
```
161161
162-
In this example, we assign the environment variable `GRAFANA_IMAGE` to the build arg `grafana_image` with a default value of `grafana`. This will allow you to set the value while running the docker-compose commands, which might be convenient in some scenarios.
162+
In this example, we assign the environment variable `GRAFANA_IMAGE` to the build arg `grafana_image` with a default value of `grafana`. This will allow you to set the value while running the docker compose commands, which might be convenient in some scenarios.
163163

164164
---

.config/jest-setup.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
33
*
44
* In order to extend the configuration follow the steps in
5-
* https://grafana.com/developers/plugin-tools/create-a-plugin/extend-a-plugin/extend-configurations#extend-the-jest-config
5+
* https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-jest-config
66
*/
77

88
import '@testing-library/jest-dom';
@@ -13,7 +13,7 @@ Object.assign(global, { TextDecoder, TextEncoder });
1313
// https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
1414
Object.defineProperty(global, 'matchMedia', {
1515
writable: true,
16-
value: jest.fn().mockImplementation((query) => ({
16+
value: (query) => ({
1717
matches: false,
1818
media: query,
1919
onchange: null,
@@ -22,7 +22,7 @@ Object.defineProperty(global, 'matchMedia', {
2222
addEventListener: jest.fn(),
2323
removeEventListener: jest.fn(),
2424
dispatchEvent: jest.fn(),
25-
})),
25+
}),
2626
});
2727

2828
HTMLCanvasElement.prototype.getContext = () => {};

.config/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
33
*
44
* In order to extend the configuration follow the steps in
5-
* https://grafana.com/developers/plugin-tools/create-a-plugin/extend-a-plugin/extend-configurations#extend-the-jest-config
5+
* https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-jest-config
66
*/
77

88
const path = require('path');

.config/jest/utils.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,41 @@ const grafanaESModules = [
1515
'.pnpm', // Support using pnpm symlinked packages
1616
'@grafana/schema',
1717
'd3',
18+
'd3-array',
19+
'd3-axis',
20+
'd3-brush',
21+
'd3-chord',
1822
'd3-color',
23+
'd3-contour',
24+
'd3-delaunay',
25+
'd3-dispatch',
26+
'd3-drag',
27+
'd3-dsv',
28+
'd3-ease',
29+
'd3-fetch',
1930
'd3-force',
31+
'd3-format',
32+
'd3-geo',
33+
'd3-hierarchy',
2034
'd3-interpolate',
35+
'd3-path',
36+
'd3-polygon',
37+
'd3-quadtree',
38+
'd3-random',
39+
'd3-scale',
2140
'd3-scale-chromatic',
41+
'd3-selection',
42+
'd3-shape',
43+
'd3-time',
44+
'd3-time-format',
45+
'd3-timer',
46+
'd3-transition',
47+
'd3-zoom',
48+
'delaunator',
49+
'internmap',
2250
'ol',
2351
'react-colorful',
52+
'robust-predicates',
2453
'rxjs',
2554
'uuid',
2655
];

.config/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
33
*
44
* In order to extend the configuration follow the steps in
5-
* https://grafana.com/developers/plugin-tools/create-a-plugin/extend-a-plugin/extend-configurations#extend-the-typescript-config
5+
* https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-typescript-config
66
*/
77
{
88
"compilerOptions": {
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import * as webpack from 'webpack';
2+
3+
const PLUGIN_NAME = 'BuildModeWebpack';
4+
5+
export class BuildModeWebpackPlugin {
6+
apply(compiler: webpack.Compiler) {
7+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
8+
compilation.hooks.processAssets.tap(
9+
{
10+
name: PLUGIN_NAME,
11+
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
12+
},
13+
async () => {
14+
const assets = compilation.getAssets();
15+
for (const asset of assets) {
16+
if (asset.name.endsWith('plugin.json')) {
17+
const pluginJsonString = asset.source.source().toString();
18+
const pluginJsonWithBuildMode = JSON.stringify(
19+
{
20+
...JSON.parse(pluginJsonString),
21+
buildMode: compilation.options.mode,
22+
},
23+
null,
24+
4
25+
);
26+
compilation.updateAsset(asset.name, new webpack.sources.RawSource(pluginJsonWithBuildMode));
27+
}
28+
}
29+
}
30+
);
31+
});
32+
}
33+
}

.config/webpack/utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ export function getPluginJson() {
2929
return require(path.resolve(process.cwd(), `${SOURCE_DIR}/plugin.json`));
3030
}
3131

32+
export function getCPConfigVersion() {
33+
const cprcJson = path.resolve(__dirname, '../', '.cprc.json');
34+
return fs.existsSync(cprcJson) ? require(cprcJson).version : { version: 'unknown' };
35+
}
36+
3237
export function hasReadme() {
3338
return fs.existsSync(path.resolve(process.cwd(), SOURCE_DIR, 'README.md'));
3439
}

0 commit comments

Comments
 (0)