Skip to content

Commit 5ab4627

Browse files
authored
Chore: update deps (#31)
* update node version from 18 to 20 * update packages * remove feature toggle that was removed since v10.4 of @grafana/runtime * include TextEncoder and TextDecoder which are no longer include in the updated jsdom environment * migrate rollup config from v2 to v4 * add dependabot config * bump deps
1 parent b6f265f commit 5ab4627

File tree

7 files changed

+3861
-2515
lines changed

7 files changed

+3861
-2515
lines changed

.config/jest-setup.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66

77
import '@testing-library/jest-dom';
8+
import { TextEncoder, TextDecoder } from 'util';
9+
10+
Object.assign(global, { TextDecoder, TextEncoder });
811

912
// https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
1013
Object.defineProperty(global, 'matchMedia', {

.github/dependabot.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: 'github-actions'
9+
directory: '/'
10+
schedule:
11+
interval: 'weekly'
12+
groups:
13+
all-dependencies:
14+
patterns:
15+
- '*'
16+
- package-ecosystem: 'npm'
17+
directory: '/'
18+
schedule:
19+
interval: 'weekly'
20+
groups:
21+
all-dependencies:
22+
patterns:
23+
- '*'

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18
1+
20

package.json

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
"version": "0.2.0",
44
"description": "Async query support for Grafana",
55
"main": "dist/index.js",
6+
"module": "dist/esm/index.js",
7+
"types": "dist/index.d.ts",
68
"scripts": {
79
"dev": "yarn bundle --watch --watch.onStart=\"yarn typecheck\"",
810
"build": "yarn clean && yarn typecheck && yarn bundle",
9-
"bundle": "rollup -c rollup.config.ts",
11+
"bundle": "rollup -c rollup.config.ts --configPlugin esbuild",
1012
"clean": "rimraf ./dist ./compiled",
1113
"lint": "eslint --cache --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx ./src",
1214
"typecheck": "tsc -p ./tsconfig.build.json",
@@ -15,9 +17,6 @@
1517
"test:coverage": "jest --coverage"
1618
},
1719
"publishConfig": {
18-
"main": "dist/index.js",
19-
"module": "dist/esm/index.js",
20-
"types": "dist/index.d.ts",
2120
"access": "public"
2221
},
2322
"files": [
@@ -27,39 +26,45 @@
2726
"author": "Grafana Labs <team@grafana.com> (https://grafana.com)",
2827
"license": "Apache-2.0",
2928
"dependencies": {
30-
"tslib": "^2.4.1"
29+
"tslib": "^2.8.0"
3130
},
3231
"devDependencies": {
33-
"@grafana/data": "9.3.2",
34-
"@grafana/eslint-config": "^6.0.1",
35-
"@grafana/runtime": "9.3.2",
36-
"@grafana/tsconfig": "^1.2.0-rc1",
37-
"@grafana/ui": "9.3.2",
38-
"@rollup/plugin-node-resolve": "^15.0.1",
39-
"@swc/core": "^1.3.24",
40-
"@swc/jest": "^0.2.24",
41-
"@testing-library/jest-dom": "^5.11.10",
42-
"@testing-library/react": "12.1.5",
32+
"@grafana/data": "11.3.0",
33+
"@grafana/eslint-config": "^8.0.0",
34+
"@grafana/runtime": "11.3.0",
35+
"@grafana/tsconfig": "^2.0.0",
36+
"@grafana/ui": "11.3.0",
37+
"@rollup/plugin-node-resolve": "^15.3.0",
38+
"@stylistic/eslint-plugin-ts": "^2.9.0",
39+
"@swc/core": "^1.7.40",
40+
"@swc/jest": "^0.2.36",
41+
"@testing-library/dom": "^10.4.0",
42+
"@testing-library/jest-dom": "^6.6.2",
43+
"@testing-library/react": "16.0.1",
4344
"@testing-library/react-hooks": "^8.0.1",
44-
"@types/jest": "29.2.4",
45-
"@types/react": "17.0.42",
46-
"@types/react-dom": "17.0.14",
47-
"@typescript-eslint/eslint-plugin": "^5.48.0",
48-
"esbuild": "^0.16.10",
49-
"eslint": "^8.31.0",
50-
"eslint-plugin-jsdoc": "^46.7.0",
51-
"eslint-plugin-react": "^7.31.11",
52-
"eslint-plugin-react-hooks": "^4.6.0",
53-
"jest": "^29.3.1",
54-
"jest-environment-jsdom": "^29.3.1",
45+
"@types/jest": "29.5.14",
46+
"@types/react": "18.3.12",
47+
"@types/react-dom": "18.3.1",
48+
"@typescript-eslint/eslint-plugin": "^8.12.0",
49+
"@typescript-eslint/parser": "^8.12.0",
50+
"esbuild": "^0.24.0",
51+
"eslint": "^8.57.1",
52+
"eslint-config-prettier": "^9.1.0",
53+
"eslint-plugin-jsdoc": "^50.4.3",
54+
"eslint-plugin-react": "^7.37.2",
55+
"eslint-plugin-react-hooks": "^5.0.0",
56+
"identity-obj-proxy": "^3.0.0",
57+
"jest": "^29.7.0",
58+
"jest-environment-jsdom": "^29.7.0",
5559
"node-notifier": "^10.0.1",
56-
"react": "17.0.2",
57-
"react-dom": "17.0.2",
58-
"rimraf": "^3.0.2",
59-
"rollup": "^2.79.1",
60-
"rollup-plugin-dts": "^5.0.0",
61-
"rollup-plugin-esbuild": "^5.0.0",
62-
"rollup-plugin-node-externals": "^5.0.3",
63-
"typescript": "4.8.4"
60+
"react": "18.3.1",
61+
"react-dom": "18.3.1",
62+
"react-router-dom": "^6.27.0",
63+
"rimraf": "^6.0.1",
64+
"rollup": "^4.24.2",
65+
"rollup-plugin-dts": "^6.1.1",
66+
"rollup-plugin-esbuild": "^6.1.1",
67+
"rollup-plugin-node-externals": "^7.1.3",
68+
"typescript": "5.6.3"
6469
}
6570
}

rollup.config.ts

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,55 @@
11
import resolve from '@rollup/plugin-node-resolve';
2+
import { createRequire } from 'node:module';
23
import path from 'path';
34
import dts from 'rollup-plugin-dts';
45
import esbuild from 'rollup-plugin-esbuild';
5-
import { externals } from 'rollup-plugin-node-externals';
6+
import { nodeExternals } from 'rollup-plugin-node-externals';
67

7-
const pkg = require('./package.json');
8+
const rq = createRequire(import.meta.url);
9+
const pkg = rq('./package.json');
10+
11+
const legacyOutputDefaults = {
12+
esModule: true,
13+
interop: 'compat',
14+
};
815

916
export default [
1017
{
1118
input: 'src/index.ts',
1219
plugins: [
13-
externals({
20+
nodeExternals({
1421
deps: true,
1522
include: ['react', '@grafana/data', '@grafana/ui', '@grafana/runtime', 'lodash', 'rxjs'],
1623
packagePath: './package.json',
1724
}),
1825
resolve(),
19-
esbuild(),
26+
esbuild({
27+
target: 'es2018',
28+
tsconfig: 'tsconfig.build.json',
29+
}),
2030
],
2131
output: [
2232
{
2333
format: 'cjs',
2434
sourcemap: true,
25-
dir: path.dirname(pkg.publishConfig.main),
35+
dir: path.dirname(pkg.main),
36+
...legacyOutputDefaults,
2637
},
2738
{
2839
format: 'esm',
2940
sourcemap: true,
30-
dir: path.dirname(pkg.publishConfig.module),
41+
dir: path.dirname(pkg.module),
3142
preserveModules: true,
43+
preserveModulesRoot: './src',
44+
...legacyOutputDefaults,
3245
},
3346
],
3447
},
3548
{
3649
input: './compiled/index.d.ts',
3750
plugins: [dts()],
3851
output: {
39-
file: pkg.publishConfig.types,
52+
file: pkg.types,
4053
format: 'es',
4154
},
4255
watch: {

src/DatasourceWithAsyncBackend.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ export class DatasourceWithAsyncBackend<
138138
};
139139

140140
let headers = {};
141-
const cachingDisabled =
142-
!config.featureToggles.useCachingService || !config.featureToggles.awsAsyncQueryCaching;
141+
const cachingDisabled = !config.featureToggles.awsAsyncQueryCaching;
143142
if (cachingDisabled && isRunning(status)) {
144143
// bypass query caching for Grafana Enterprise to
145144
// prevent an infinite loop

0 commit comments

Comments
 (0)