From e86be12e64c53e9c3eba315c907234e7de95ac89 Mon Sep 17 00:00:00 2001 From: Jackson Goode Date: Fri, 20 Sep 2024 15:49:32 -0700 Subject: [PATCH] Plugin migrations and bump --- .config/.cprc.json | 2 +- .config/README.md | 2 +- .config/jest-setup.js | 4 ++-- .config/webpack/webpack.config.ts | 26 +++++++++++++++----------- package.json | 5 +++-- 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/.config/.cprc.json b/.config/.cprc.json index e09ce20..d01d58d 100644 --- a/.config/.cprc.json +++ b/.config/.cprc.json @@ -1,3 +1,3 @@ { - "version": "5.2.1" + "version": "5.3.10" } diff --git a/.config/README.md b/.config/README.md index a23b6d1..4de64b5 100644 --- a/.config/README.md +++ b/.config/README.md @@ -159,6 +159,6 @@ services: grafana_image: ${GRAFANA_IMAGE:-grafana} ``` -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. +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. --- diff --git a/.config/jest-setup.js b/.config/jest-setup.js index 0687875..74832e3 100644 --- a/.config/jest-setup.js +++ b/.config/jest-setup.js @@ -13,7 +13,7 @@ Object.assign(global, { TextDecoder, TextEncoder }); // https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom Object.defineProperty(global, 'matchMedia', { writable: true, - value: jest.fn().mockImplementation((query) => ({ + value: (query) => ({ matches: false, media: query, onchange: null, @@ -22,7 +22,7 @@ Object.defineProperty(global, 'matchMedia', { addEventListener: jest.fn(), removeEventListener: jest.fn(), dispatchEvent: jest.fn(), - })), + }), }); HTMLCanvasElement.prototype.getContext = () => {}; diff --git a/.config/webpack/webpack.config.ts b/.config/webpack/webpack.config.ts index 4e9934f..4f66814 100644 --- a/.config/webpack/webpack.config.ts +++ b/.config/webpack/webpack.config.ts @@ -96,6 +96,18 @@ const config = async (env): Promise => { module: { rules: [ + // This must come first in the rules array otherwise it breaks sourcemaps. + { + test: /src\/(?:.*\/)?module\.tsx?$/, + use: [ + { + loader: 'imports-loader', + options: { + imports: `side-effects grafana-public-path`, + }, + }, + ], + }, { exclude: /(node_modules)/, test: /\.[tj]sx?$/, @@ -116,17 +128,6 @@ const config = async (env): Promise => { }, }, }, - { - test: /src\/(?:.*\/)?module\.tsx?$/, - use: [ - { - loader: 'imports-loader', - options: { - imports: `side-effects grafana-public-path`, - }, - }, - ], - }, { test: /\.css$/, use: ['style-loader', 'css-loader'], @@ -160,6 +161,9 @@ const config = async (env): Promise => { format: { comments: (_, { type, value }) => type === 'comment2' && value.trim().startsWith('[create-plugin]'), }, + compress: { + drop_console: ['log', 'info'], + }, }, }), ], diff --git a/package.json b/package.json index 80050c3..8d61770 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "package": "./package.sh", "release": "tag=$(git describe --abbrev=0) && gh release create ${tag} ./nline-plotlyjs-panel-${tag}.zip ./nline-plotlyjs-panel-${tag}.zip.md5", "upload": "tag=$(git describe --abbrev=0) && gh release upload ${tag} ./nline-plotlyjs-panel-${tag}.zip ./nline-plotlyjs-panel-${tag}.zip.md5 --clobber", - "server": "docker-compose up --build", + "server": "docker compose up --build", "sign": "npx --yes @grafana/sign-plugin@latest", "test": "jest --watch --onlyChanged", "test:ci": "jest --passWithNoTests --maxWorkers 4", @@ -72,7 +72,8 @@ "webpack": "^5.94.0", "webpack-cli": "^5.1.4", "webpack-livereload-plugin": "^3.0.2", - "webpack-virtual-modules": "^0.6.2" + "webpack-virtual-modules": "^0.6.2", + "terser-webpack-plugin": "^5.3.10" }, "dependencies": { "@emotion/css": "^11.13.0",