Skip to content

Commit

Permalink
Chore: update deps (#31)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
kevinwcyu authored Oct 31, 2024
1 parent b6f265f commit 5ab4627
Show file tree
Hide file tree
Showing 7 changed files with 3,861 additions and 2,515 deletions.
3 changes: 3 additions & 0 deletions .config/jest-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/

import '@testing-library/jest-dom';
import { TextEncoder, TextDecoder } from 'util';

Object.assign(global, { TextDecoder, TextEncoder });

// https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
Object.defineProperty(global, 'matchMedia', {
Expand Down
23 changes: 23 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'weekly'
groups:
all-dependencies:
patterns:
- '*'
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'
groups:
all-dependencies:
patterns:
- '*'
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
73 changes: 39 additions & 34 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
"version": "0.2.0",
"description": "Async query support for Grafana",
"main": "dist/index.js",
"module": "dist/esm/index.js",
"types": "dist/index.d.ts",
"scripts": {
"dev": "yarn bundle --watch --watch.onStart=\"yarn typecheck\"",
"build": "yarn clean && yarn typecheck && yarn bundle",
"bundle": "rollup -c rollup.config.ts",
"bundle": "rollup -c rollup.config.ts --configPlugin esbuild",
"clean": "rimraf ./dist ./compiled",
"lint": "eslint --cache --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx ./src",
"typecheck": "tsc -p ./tsconfig.build.json",
Expand All @@ -15,9 +17,6 @@
"test:coverage": "jest --coverage"
},
"publishConfig": {
"main": "dist/index.js",
"module": "dist/esm/index.js",
"types": "dist/index.d.ts",
"access": "public"
},
"files": [
Expand All @@ -27,39 +26,45 @@
"author": "Grafana Labs <[email protected]> (https://grafana.com)",
"license": "Apache-2.0",
"dependencies": {
"tslib": "^2.4.1"
"tslib": "^2.8.0"
},
"devDependencies": {
"@grafana/data": "9.3.2",
"@grafana/eslint-config": "^6.0.1",
"@grafana/runtime": "9.3.2",
"@grafana/tsconfig": "^1.2.0-rc1",
"@grafana/ui": "9.3.2",
"@rollup/plugin-node-resolve": "^15.0.1",
"@swc/core": "^1.3.24",
"@swc/jest": "^0.2.24",
"@testing-library/jest-dom": "^5.11.10",
"@testing-library/react": "12.1.5",
"@grafana/data": "11.3.0",
"@grafana/eslint-config": "^8.0.0",
"@grafana/runtime": "11.3.0",
"@grafana/tsconfig": "^2.0.0",
"@grafana/ui": "11.3.0",
"@rollup/plugin-node-resolve": "^15.3.0",
"@stylistic/eslint-plugin-ts": "^2.9.0",
"@swc/core": "^1.7.40",
"@swc/jest": "^0.2.36",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.2",
"@testing-library/react": "16.0.1",
"@testing-library/react-hooks": "^8.0.1",
"@types/jest": "29.2.4",
"@types/react": "17.0.42",
"@types/react-dom": "17.0.14",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"esbuild": "^0.16.10",
"eslint": "^8.31.0",
"eslint-plugin-jsdoc": "^46.7.0",
"eslint-plugin-react": "^7.31.11",
"eslint-plugin-react-hooks": "^4.6.0",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"@types/jest": "29.5.14",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@typescript-eslint/eslint-plugin": "^8.12.0",
"@typescript-eslint/parser": "^8.12.0",
"esbuild": "^0.24.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsdoc": "^50.4.3",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"node-notifier": "^10.0.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"rimraf": "^3.0.2",
"rollup": "^2.79.1",
"rollup-plugin-dts": "^5.0.0",
"rollup-plugin-esbuild": "^5.0.0",
"rollup-plugin-node-externals": "^5.0.3",
"typescript": "4.8.4"
"react": "18.3.1",
"react-dom": "18.3.1",
"react-router-dom": "^6.27.0",
"rimraf": "^6.0.1",
"rollup": "^4.24.2",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-esbuild": "^6.1.1",
"rollup-plugin-node-externals": "^7.1.3",
"typescript": "5.6.3"
}
}
27 changes: 20 additions & 7 deletions rollup.config.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,55 @@
import resolve from '@rollup/plugin-node-resolve';
import { createRequire } from 'node:module';
import path from 'path';
import dts from 'rollup-plugin-dts';
import esbuild from 'rollup-plugin-esbuild';
import { externals } from 'rollup-plugin-node-externals';
import { nodeExternals } from 'rollup-plugin-node-externals';

const pkg = require('./package.json');
const rq = createRequire(import.meta.url);
const pkg = rq('./package.json');

const legacyOutputDefaults = {
esModule: true,
interop: 'compat',
};

export default [
{
input: 'src/index.ts',
plugins: [
externals({
nodeExternals({
deps: true,
include: ['react', '@grafana/data', '@grafana/ui', '@grafana/runtime', 'lodash', 'rxjs'],
packagePath: './package.json',
}),
resolve(),
esbuild(),
esbuild({
target: 'es2018',
tsconfig: 'tsconfig.build.json',
}),
],
output: [
{
format: 'cjs',
sourcemap: true,
dir: path.dirname(pkg.publishConfig.main),
dir: path.dirname(pkg.main),
...legacyOutputDefaults,
},
{
format: 'esm',
sourcemap: true,
dir: path.dirname(pkg.publishConfig.module),
dir: path.dirname(pkg.module),
preserveModules: true,
preserveModulesRoot: './src',
...legacyOutputDefaults,
},
],
},
{
input: './compiled/index.d.ts',
plugins: [dts()],
output: {
file: pkg.publishConfig.types,
file: pkg.types,
format: 'es',
},
watch: {
Expand Down
3 changes: 1 addition & 2 deletions src/DatasourceWithAsyncBackend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ export class DatasourceWithAsyncBackend<
};

let headers = {};
const cachingDisabled =
!config.featureToggles.useCachingService || !config.featureToggles.awsAsyncQueryCaching;
const cachingDisabled = !config.featureToggles.awsAsyncQueryCaching;
if (cachingDisabled && isRunning(status)) {
// bypass query caching for Grafana Enterprise to
// prevent an infinite loop
Expand Down
Loading

0 comments on commit 5ab4627

Please sign in to comment.