Skip to content

Commit 9f0a729

Browse files
chore: update configuration to create-plugin 5.26.9
1 parent 3733c47 commit 9f0a729

File tree

12 files changed

+738
-616
lines changed

12 files changed

+738
-616
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": "5.22.4"
2+
"version": "5.26.9"
33
}

.config/.eslintrc

Lines changed: 4 additions & 5 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/get-started/set-up-development-environment#extend-the-eslint-config
5+
* https://grafana.com/developers/plugin-tools/how-to-guides/extend-configurations#extend-the-eslint-config
66
*/
77
{
88
"extends": ["@grafana/eslint-config"],
@@ -12,10 +12,9 @@
1212
},
1313
"overrides": [
1414
{
15-
"plugins": ["deprecation"],
1615
"files": ["src/**/*.{ts,tsx}"],
1716
"rules": {
18-
"deprecation/deprecation": "warn"
17+
"@typescript-eslint/no-deprecated": "warn"
1918
},
2019
"parserOptions": {
2120
"project": "./tsconfig.json"
@@ -24,8 +23,8 @@
2423
{
2524
"files": ["./tests/**/*"],
2625
"rules": {
27-
"react-hooks/rules-of-hooks": "off",
28-
},
26+
"react-hooks/rules-of-hooks": "off"
27+
}
2928
}
3029
]
3130
}

.config/bundler/externals.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import type { Configuration, ExternalItemFunctionData } from 'webpack';
2+
3+
type ExternalsType = Configuration['externals'];
4+
5+
export const externals: ExternalsType = [
6+
// Required for dynamic publicPath resolution
7+
{ 'amd-module': 'module' },
8+
'lodash',
9+
'jquery',
10+
'moment',
11+
'slate',
12+
'emotion',
13+
'@emotion/react',
14+
'@emotion/css',
15+
'prismjs',
16+
'slate-plain-serializer',
17+
'@grafana/slate-react',
18+
'react',
19+
'react-dom',
20+
'react-redux',
21+
'redux',
22+
'rxjs',
23+
'i18next',
24+
'react-router',
25+
'd3',
26+
'angular',
27+
/^@grafana\/ui/i,
28+
/^@grafana\/runtime/i,
29+
/^@grafana\/data/i,
30+
31+
// Mark legacy SDK imports as external if their name starts with the "grafana/" prefix
32+
({ request }: ExternalItemFunctionData, callback: (error?: Error, result?: string) => void) => {
33+
const prefix = 'grafana/';
34+
const hasPrefix = (request: string) => request.indexOf(prefix) === 0;
35+
const stripPrefix = (request: string) => request.slice(prefix.length);
36+
37+
if (request && hasPrefix(request)) {
38+
return callback(undefined, stripPrefix(request));
39+
}
40+
41+
callback();
42+
},
43+
];

.config/docker-compose-base.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ services:
77
context: .
88
args:
99
grafana_image: ${GRAFANA_IMAGE:-grafana-enterprise}
10-
grafana_version: ${GRAFANA_VERSION:-12.0.1}
10+
grafana_version: ${GRAFANA_VERSION:-12.2.0}
1111
development: ${DEVELOPMENT:-false}
1212
anonymous_auth_enabled: ${ANONYMOUS_AUTH_ENABLED:-true}
1313
ports:

.config/jest-setup.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/get-started/set-up-development-environment#extend-the-jest-config
5+
* https://grafana.com/developers/plugin-tools/how-to-guides/extend-configurations#extend-the-jest-config
66
*/
77

88
import '@testing-library/jest-dom';

.config/jest.config.js

Lines changed: 2 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/get-started/set-up-development-environment#extend-the-jest-config
5+
* https://grafana.com/developers/plugin-tools/how-to-guides/extend-configurations#extend-the-jest-config
66
*/
77

88
const path = require('path');
@@ -40,4 +40,5 @@ module.exports = {
4040
// Jest will throw `Cannot use import statement outside module` if it tries to load an
4141
// ES module without it being transformed first. ./config/README.md#esm-errors-with-jest
4242
transformIgnorePatterns: [nodeModulesToTransform(grafanaESModules)],
43+
watchPathIgnorePatterns: ['<rootDir>/node_modules', '<rootDir>/dist'],
4344
};

.config/jest/utils.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@ const nodeModulesToTransform = (moduleNames) => `node_modules\/(?!.*(${moduleNam
1414
const grafanaESModules = [
1515
'.pnpm', // Support using pnpm symlinked packages
1616
'@grafana/schema',
17+
'@wojtekmaj/date-utils',
1718
'd3',
1819
'd3-color',
1920
'd3-force',
2021
'd3-interpolate',
2122
'd3-scale-chromatic',
23+
'get-user-locale',
24+
'marked',
25+
'memoize',
26+
'mimic-function',
2227
'ol',
28+
'react-calendar',
2329
'react-colorful',
2430
'rxjs',
2531
'uuid',

.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/get-started/set-up-development-environment#extend-the-typescript-config
5+
* https://grafana.com/developers/plugin-tools/how-to-guides/extend-configurations#extend-the-typescript-config
66
*/
77
{
88
"compilerOptions": {

.config/webpack/webpack.config.ts

Lines changed: 8 additions & 41 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/get-started/set-up-development-environment#extend-the-webpack-config
5+
* https://grafana.com/developers/plugin-tools/how-to-guides/extend-configurations#extend-the-webpack-config
66
*/
77

88
import CopyWebpackPlugin from 'copy-webpack-plugin';
@@ -19,9 +19,11 @@ import VirtualModulesPlugin from 'webpack-virtual-modules';
1919
import { BuildModeWebpackPlugin } from './BuildModeWebpackPlugin.ts';
2020
import { DIST_DIR, SOURCE_DIR } from './constants.ts';
2121
import { getCPConfigVersion, getEntries, getPackageJson, getPluginJson, hasReadme, isWSL } from './utils.ts';
22+
import { externals } from '../bundler/externals.ts';
2223

2324
const pluginJson = getPluginJson();
2425
const cpVersion = getCPConfigVersion();
26+
const pluginVersion = getPackageJson().version;
2527

2628
const virtualPublicPath = new VirtualModulesPlugin({
2729
'node_modules/grafana-public-path.js': `
@@ -54,44 +56,7 @@ const config = async (env: Env): Promise<Configuration> => {
5456

5557
entry: await getEntries(),
5658

57-
externals: [
58-
// Required for dynamic publicPath resolution
59-
{ 'amd-module': 'module' },
60-
'lodash',
61-
'jquery',
62-
'moment',
63-
'slate',
64-
'emotion',
65-
'@emotion/react',
66-
'@emotion/css',
67-
'prismjs',
68-
'slate-plain-serializer',
69-
'@grafana/slate-react',
70-
'react',
71-
'react-dom',
72-
'react-redux',
73-
'redux',
74-
'rxjs',
75-
'react-router',
76-
'd3',
77-
'angular',
78-
/^@grafana\/ui/i,
79-
/^@grafana\/runtime/i,
80-
/^@grafana\/data/i,
81-
82-
// Mark legacy SDK imports as external if their name starts with the "grafana/" prefix
83-
({ request }, callback) => {
84-
const prefix = 'grafana/';
85-
const hasPrefix = (request: string) => request.indexOf(prefix) === 0;
86-
const stripPrefix = (request: string) => request.substr(prefix.length);
87-
88-
if (request && hasPrefix(request)) {
89-
return callback(undefined, stripPrefix(request));
90-
}
91-
92-
callback();
93-
},
94-
],
59+
externals,
9560

9661
// Support WebAssembly according to latest spec - makes WebAssembly module async
9762
experiments: {
@@ -195,7 +160,8 @@ const config = async (env: Env): Promise<Configuration> => {
195160
virtualPublicPath,
196161
// Insert create plugin version information into the bundle
197162
new webpack.BannerPlugin({
198-
banner: '/* [create-plugin] version: ' + cpVersion + ' */',
163+
banner: `/* [create-plugin] version: ${cpVersion} */
164+
/* [create-plugin] plugin: ${pluginJson.id}@${pluginVersion} */`,
199165
raw: true,
200166
entryOnly: true,
201167
}),
@@ -225,7 +191,7 @@ const config = async (env: Env): Promise<Configuration> => {
225191
rules: [
226192
{
227193
search: /\%VERSION\%/g,
228-
replace: getPackageJson().version,
194+
replace: pluginVersion,
229195
},
230196
{
231197
search: /\%TODAY\%/g,
@@ -254,6 +220,7 @@ const config = async (env: Env): Promise<Configuration> => {
254220
new ESLintPlugin({
255221
extensions: ['.ts', '.tsx'],
256222
lintDirtyModulesOnly: Boolean(env.development), // don't lint on start, only lint changed files
223+
failOnError: Boolean(env.production),
257224
}),
258225
]
259226
: []),

.cprc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"features": {
33
"bundleGrafanaUI": false,
4-
"useReactRouterV6": true
4+
"useReactRouterV6": true,
5+
"useExperimentalRspack": false
56
}
67
}

0 commit comments

Comments
 (0)