Skip to content

Commit 9a237c3

Browse files
Bump the all-node-dependencies group across 1 directory with 30 updates (#337)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kevin Yu <[email protected]>
1 parent d24816e commit 9a237c3

25 files changed

+2810
-2232
lines changed

Diff for: .config/.cprc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "4.13.0"
2+
"version": "5.11.1"
33
}

Diff for: .config/.eslintrc

+7-1
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
}

Diff for: .config/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ ARG grafana_image=grafana-enterprise
44
FROM grafana/${grafana_image}:${grafana_version}
55

66
ARG development=false
7+
ARG TARGETARCH
78

89
ARG GO_VERSION=1.21.6
9-
ARG GO_ARCH=amd64
10+
ARG GO_ARCH=${TARGETARCH:-amd64}
1011

1112
ENV DEV "${development}"
1213

Diff for: .config/README.md

+1-1
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
---

Diff for: .config/jest-setup.js

+3-3
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 = () => {};

Diff for: .config/jest.config.js

+1-1
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');

Diff for: .config/tsconfig.json

+1-1
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": {

Diff for: .config/webpack/BuildModeWebpackPlugin.ts

+33
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+
}

Diff for: .config/webpack/utils.ts

+5
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
}

Diff for: .config/webpack/webpack.config.ts

+64-12
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,37 @@
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-webpack-config
5+
* https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-webpack-config
66
*/
77

88
import CopyWebpackPlugin from 'copy-webpack-plugin';
99
import ESLintPlugin from 'eslint-webpack-plugin';
1010
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
11-
import LiveReloadPlugin from 'webpack-livereload-plugin';
1211
import path from 'path';
1312
import ReplaceInFileWebpackPlugin from 'replace-in-file-webpack-plugin';
14-
import { Configuration } from 'webpack';
13+
import TerserPlugin from 'terser-webpack-plugin';
14+
import { SubresourceIntegrityPlugin } from 'webpack-subresource-integrity';
15+
import { type Configuration, BannerPlugin } from 'webpack';
16+
import LiveReloadPlugin from 'webpack-livereload-plugin';
17+
import VirtualModulesPlugin from 'webpack-virtual-modules';
1518

16-
import { getPackageJson, getPluginJson, hasReadme, getEntries, isWSL } from './utils';
17-
import { SOURCE_DIR, DIST_DIR } from './constants';
19+
import { BuildModeWebpackPlugin } from './BuildModeWebpackPlugin';
20+
import { DIST_DIR, SOURCE_DIR } from './constants';
21+
import { getCPConfigVersion, getEntries, getPackageJson, getPluginJson, hasReadme, isWSL } from './utils';
1822

1923
const pluginJson = getPluginJson();
24+
const cpVersion = getCPConfigVersion();
25+
26+
const virtualPublicPath = new VirtualModulesPlugin({
27+
'node_modules/grafana-public-path.js': `
28+
import amdMetaModule from 'amd-module';
29+
30+
__webpack_public_path__ =
31+
amdMetaModule && amdMetaModule.uri
32+
? amdMetaModule.uri.slice(0, amdMetaModule.uri.lastIndexOf('/') + 1)
33+
: 'public/plugins/${pluginJson.id}/';
34+
`,
35+
});
2036

2137
const config = async (env): Promise<Configuration> => {
2238
const baseConfig: Configuration = {
@@ -34,6 +50,8 @@ const config = async (env): Promise<Configuration> => {
3450
entry: await getEntries(),
3551

3652
externals: [
53+
// Required for dynamic publicPath resolution
54+
{ 'amd-module': 'module' },
3755
'lodash',
3856
'jquery',
3957
'moment',
@@ -80,6 +98,18 @@ const config = async (env): Promise<Configuration> => {
8098

8199
module: {
82100
rules: [
101+
// This must come first in the rules array otherwise it breaks sourcemaps.
102+
{
103+
test: /src\/(?:.*\/)?module\.tsx?$/,
104+
use: [
105+
{
106+
loader: 'imports-loader',
107+
options: {
108+
imports: `side-effects grafana-public-path`,
109+
},
110+
},
111+
],
112+
},
83113
{
84114
exclude: /(node_modules)/,
85115
test: /\.[tj]sx?$/,
@@ -112,25 +142,35 @@ const config = async (env): Promise<Configuration> => {
112142
test: /\.(png|jpe?g|gif|svg)$/,
113143
type: 'asset/resource',
114144
generator: {
115-
// Keep publicPath relative for host.com/grafana/ deployments
116-
publicPath: `public/plugins/${pluginJson.id}/img/`,
117-
outputPath: 'img/',
118145
filename: Boolean(env.production) ? '[hash][ext]' : '[file]',
119146
},
120147
},
121148
{
122149
test: /\.(woff|woff2|eot|ttf|otf)(\?v=\d+\.\d+\.\d+)?$/,
123150
type: 'asset/resource',
124151
generator: {
125-
// Keep publicPath relative for host.com/grafana/ deployments
126-
publicPath: `public/plugins/${pluginJson.id}/fonts/`,
127-
outputPath: 'fonts/',
128-
filename: Boolean(env.production) ? '[hash][ext]' : '[name][ext]',
152+
filename: Boolean(env.production) ? '[hash][ext]' : '[file]',
129153
},
130154
},
131155
],
132156
},
133157

158+
optimization: {
159+
minimize: Boolean(env.production),
160+
minimizer: [
161+
new TerserPlugin({
162+
terserOptions: {
163+
format: {
164+
comments: (_, { type, value }) => type === 'comment2' && value.trim().startsWith('[create-plugin]'),
165+
},
166+
compress: {
167+
drop_console: ['log', 'info'],
168+
},
169+
},
170+
}),
171+
],
172+
},
173+
134174
output: {
135175
clean: {
136176
keep: new RegExp(`(.*?_(amd64|arm(64)?)(.exe)?|go_plugin_build_manifest)`),
@@ -142,9 +182,18 @@ const config = async (env): Promise<Configuration> => {
142182
path: path.resolve(process.cwd(), DIST_DIR),
143183
publicPath: `public/plugins/${pluginJson.id}/`,
144184
uniqueName: pluginJson.id,
185+
crossOriginLoading: 'anonymous',
145186
},
146187

147188
plugins: [
189+
new BuildModeWebpackPlugin(),
190+
virtualPublicPath,
191+
// Insert create plugin version information into the bundle
192+
new BannerPlugin({
193+
banner: '/* [create-plugin] version: ' + cpVersion + ' */',
194+
raw: true,
195+
entryOnly: true,
196+
}),
148197
new CopyWebpackPlugin({
149198
patterns: [
150199
// If src/README.md exists use it; otherwise the root README
@@ -184,6 +233,9 @@ const config = async (env): Promise<Configuration> => {
184233
],
185234
},
186235
]),
236+
new SubresourceIntegrityPlugin({
237+
hashFuncNames: ['sha256'],
238+
}),
187239
...(env.development
188240
? [
189241
new LiveReloadPlugin(),

Diff for: .cprc.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"features": {
3+
"bundleGrafanaUI": false,
4+
"useReactRouterV6": false
5+
}
6+
}

Diff for: .eslintrc

-3
This file was deleted.

Diff for: .github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ updates:
2020
directory: '/'
2121
schedule:
2222
interval: 'weekly'
23+
ignore:
24+
- dependency-name: '@grafana/e2e*'
25+
- dependency-name: 'react'
26+
update-types: ['version-update:semver-major']
27+
- dependency-name: 'react-dom'
28+
update-types: ['version-update:semver-major']
2329
groups:
2430
all-node-dependencies:
2531
patterns:

Diff for: .prettierrc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
// Prettier configuration provided by Grafana scaffolding
3-
...require("./.config/.prettierrc.js")
4-
};
3+
...require('./.config/.prettierrc.js'),
4+
};

Diff for: cspell.config.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"provisioning/**",
88
"src/dashboards/**",
99
"yarn.lock",
10+
"go.mod",
1011
"go.sum",
1112
"mage_output_file.go",
1213
"pkg/timestream/testdata/**",
@@ -97,6 +98,7 @@
9798
"sqlutil",
9899
"errorsource",
99100
"tibdex",
100-
"sqlds"
101+
"sqlds",
102+
"subresource"
101103
]
102104
}

Diff for: eslint.config.mjs

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import path from 'node:path';
2+
import { fileURLToPath } from 'node:url';
3+
import js from '@eslint/js';
4+
import { FlatCompat } from '@eslint/eslintrc';
5+
6+
const __filename = fileURLToPath(import.meta.url);
7+
const __dirname = path.dirname(__filename);
8+
const compat = new FlatCompat({
9+
baseDirectory: __dirname,
10+
recommendedConfig: js.configs.recommended,
11+
allConfig: js.configs.all,
12+
});
13+
export default [
14+
{
15+
ignores: ['**/node_modules', '**/build', '**/dist', '**/playwright-report', '**/test-results'],
16+
},
17+
...compat.extends('./.config/.eslintrc'),
18+
{
19+
rules: {
20+
'deprecation/deprecation': 'off',
21+
},
22+
},
23+
{
24+
files: ['src/**/*.{ts,tsx,js,jsx}'],
25+
rules: {
26+
'@typescript-eslint/no-deprecated': 'warn',
27+
},
28+
},
29+
];

0 commit comments

Comments
 (0)