From 38aba770cc8d27b81302add786522f551b060990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Fri, 9 Aug 2024 18:25:07 +0200 Subject: [PATCH] misc: npx -y @grafana/create-plugin@latest update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan-Otto Kröpke --- .config/.cprc.json | 3 + .config/.eslintrc | 4 +- .config/.prettierrc.js | 18 +- .config/Dockerfile | 1 + .config/README.md | 6 +- .config/entrypoint.sh | 1 + .config/jest-setup.js | 5 +- .config/jest.config.js | 2 +- .config/supervisord/supervisord.conf | 2 +- .config/tsconfig.json | 4 +- .config/webpack/utils.ts | 27 +- .config/webpack/webpack.config.ts | 409 +++++++++++++++------------ .cprc.json | 6 + DEVELOPMENT.md | 20 +- docker-compose.yaml | 2 +- package.json | 32 ++- 16 files changed, 315 insertions(+), 227 deletions(-) create mode 100644 .config/.cprc.json create mode 100644 .cprc.json diff --git a/.config/.cprc.json b/.config/.cprc.json new file mode 100644 index 0000000..c672c95 --- /dev/null +++ b/.config/.cprc.json @@ -0,0 +1,3 @@ +{ + "version": "5.2.2" +} diff --git a/.config/.eslintrc b/.config/.eslintrc index 245c7a6..b614760 100755 --- a/.config/.eslintrc +++ b/.config/.eslintrc @@ -2,9 +2,9 @@ * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ * * In order to extend the configuration follow the steps in - * https://grafana.github.io/plugin-tools/docs/advanced-configuration#extending-the-eslint-config + * https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-eslint-config */ - { +{ "extends": ["@grafana/eslint-config"], "root": true, "rules": { diff --git a/.config/.prettierrc.js b/.config/.prettierrc.js index 66a76ec..bf506f5 100755 --- a/.config/.prettierrc.js +++ b/.config/.prettierrc.js @@ -5,12 +5,12 @@ */ module.exports = { - "endOfLine": "auto", - "printWidth": 120, - "trailingComma": "es5", - "semi": true, - "jsxSingleQuote": false, - "singleQuote": true, - "useTabs": false, - "tabWidth": 2 -}; \ No newline at end of file + endOfLine: 'auto', + printWidth: 120, + trailingComma: 'es5', + semi: true, + jsxSingleQuote: false, + singleQuote: true, + useTabs: false, + tabWidth: 2, +}; diff --git a/.config/Dockerfile b/.config/Dockerfile index 22c7d24..26e5443 100755 --- a/.config/Dockerfile +++ b/.config/Dockerfile @@ -72,6 +72,7 @@ RUN if [ "${development}" = "true" ]; then \ # Inject livereload script into grafana index.html RUN sed -i 's|||g' /usr/share/grafana/public/views/index.html + COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] diff --git a/.config/README.md b/.config/README.md index f1ded34..a23b6d1 100755 --- a/.config/README.md +++ b/.config/README.md @@ -56,7 +56,7 @@ set up the Jest DOM for the testing library and to apply some polyfills. ([link #### ESM errors with Jest -A common issue found with the current jest config involves importing an npm package which only offers an ESM build. These packages cause jest to error with `SyntaxError: Cannot use import statement outside a module`. To work around this we provide a list of known packages to pass to the `[transformIgnorePatterns](https://jestjs.io/docs/configuration#transformignorepatterns-arraystring)` jest configuration property. If need be this can be extended in the following way: +A common issue with the current jest config involves importing an npm package that only offers an ESM build. These packages cause jest to error with `SyntaxError: Cannot use import statement outside a module`. To work around this, we provide a list of known packages to pass to the `[transformIgnorePatterns](https://jestjs.io/docs/configuration#transformignorepatterns-arraystring)` jest configuration property. If need be, this can be extended in the following way: ```javascript process.env.TZ = 'UTC'; @@ -142,7 +142,7 @@ We need to update the `scripts` in the `package.json` to use the extended Webpac ### Configure grafana image to use when running docker -By default `grafana-enterprise` will be used as the docker image for all docker related commands. If you want to override this behaviour simply alter the `docker-compose.yaml` by adding the following build arg `grafana_image`. +By default, `grafana-enterprise` will be used as the docker image for all docker related commands. If you want to override this behavior, simply alter the `docker-compose.yaml` by adding the following build arg `grafana_image`. **Example:** @@ -159,6 +159,6 @@ services: grafana_image: ${GRAFANA_IMAGE:-grafana} ``` -In this example we are assigning the environment variable `GRAFANA_IMAGE` to the build arg `grafana_image` with a default value of `grafana`. This will give you the possibility to set the value while running the docker-compose commands which might be convinent 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/entrypoint.sh b/.config/entrypoint.sh index 622e126..00c69f2 100644 --- a/.config/entrypoint.sh +++ b/.config/entrypoint.sh @@ -15,3 +15,4 @@ else echo 'ERROR: Unsupported base image' exit 1 fi + diff --git a/.config/jest-setup.js b/.config/jest-setup.js index 575b354..0687875 100755 --- a/.config/jest-setup.js +++ b/.config/jest-setup.js @@ -2,10 +2,13 @@ * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ * * In order to extend the configuration follow the steps in - * https://grafana.github.io/plugin-tools/docs/advanced-configuration#extending-the-jest-config + * https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-jest-config */ 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', { diff --git a/.config/jest.config.js b/.config/jest.config.js index 3cb011e..09704b4 100755 --- a/.config/jest.config.js +++ b/.config/jest.config.js @@ -2,7 +2,7 @@ * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ * * In order to extend the configuration follow the steps in - * https://grafana.github.io/plugin-tools/docs/advanced-configuration#extending-the-jest-config + * https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-jest-config */ const path = require('path'); diff --git a/.config/supervisord/supervisord.conf b/.config/supervisord/supervisord.conf index d5b7f26..462c94a 100644 --- a/.config/supervisord/supervisord.conf +++ b/.config/supervisord/supervisord.conf @@ -5,7 +5,7 @@ user=root [program:grafana] user=root directory=/var/lib/grafana -command=bash -c 'while [ ! -f /root/mahendrapaipuri-dashboardreporter-app/dist/gpx_app-mahendrapaipuri-dashboardreporter-app* ]; do sleep 1; done; /run.sh' +command=bash -c 'while [ ! -f /root/mahendrapaipuri-dashboardreporter-app/dist/gpx_dashboardreporter-app* ]; do sleep 1; done; /run.sh' stdout_logfile=/dev/fd/1 stdout_logfile_maxbytes=0 redirect_stderr=true diff --git a/.config/tsconfig.json b/.config/tsconfig.json index 64b3769..15e64ac 100755 --- a/.config/tsconfig.json +++ b/.config/tsconfig.json @@ -2,9 +2,9 @@ * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ * * In order to extend the configuration follow the steps in - * https://grafana.github.io/plugin-tools/docs/advanced-configuration#extending-the-typescript-config + * https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-typescript-config */ - { +{ "compilerOptions": { "alwaysStrict": true, "declaration": false, diff --git a/.config/webpack/utils.ts b/.config/webpack/utils.ts index c2691e6..015aa05 100755 --- a/.config/webpack/utils.ts +++ b/.config/webpack/utils.ts @@ -1,9 +1,26 @@ import fs from 'fs'; +import process from 'process'; +import os from 'os'; import path from 'path'; -import util from 'util'; import { glob } from 'glob'; import { SOURCE_DIR } from './constants'; +export function isWSL() { + if (process.platform !== 'linux') { + return false; + } + + if (os.release().toLowerCase().includes('microsoft')) { + return true; + } + + try { + return fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft'); + } catch { + return false; + } +} + export function getPackageJson() { return require(path.resolve(process.cwd(), 'package.json')); } @@ -12,6 +29,11 @@ export function getPluginJson() { return require(path.resolve(process.cwd(), `${SOURCE_DIR}/plugin.json`)); } +export function getCPConfigVersion() { + const cprcJson = path.resolve(__dirname, '../', '.cprc.json'); + return fs.existsSync(cprcJson) ? require(cprcJson).version : { version: 'unknown' }; +} + export function hasReadme() { return fs.existsSync(path.resolve(process.cwd(), SOURCE_DIR, 'README.md')); } @@ -21,7 +43,8 @@ export function hasReadme() { export async function getEntries(): Promise> { const pluginsJson = await glob('**/src/**/plugin.json', { absolute: true }); - const plugins = await Promise.all(pluginsJson.map((pluginJson) => { + const plugins = await Promise.all( + pluginsJson.map((pluginJson) => { const folder = path.dirname(pluginJson); return glob(`${folder}/module.{ts,tsx,js,jsx}`, { absolute: true }); }) diff --git a/.config/webpack/webpack.config.ts b/.config/webpack/webpack.config.ts index 7d339cf..4e9934f 100755 --- a/.config/webpack/webpack.config.ts +++ b/.config/webpack/webpack.config.ts @@ -2,204 +2,263 @@ * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ * * In order to extend the configuration follow the steps in - * https://grafana.github.io/plugin-tools/docs/advanced-configuration#extending-the-webpack-config + * https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-webpack-config */ import CopyWebpackPlugin from 'copy-webpack-plugin'; import ESLintPlugin from 'eslint-webpack-plugin'; import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'; -import LiveReloadPlugin from 'webpack-livereload-plugin'; import path from 'path'; import ReplaceInFileWebpackPlugin from 'replace-in-file-webpack-plugin'; -import { Configuration } from 'webpack'; +import TerserPlugin from 'terser-webpack-plugin'; +import { type Configuration, BannerPlugin } from 'webpack'; +import LiveReloadPlugin from 'webpack-livereload-plugin'; +import VirtualModulesPlugin from 'webpack-virtual-modules'; -import { getPackageJson, getPluginJson, hasReadme, getEntries } from './utils'; -import { SOURCE_DIR, DIST_DIR } from './constants'; +import { DIST_DIR, SOURCE_DIR } from './constants'; +import { getCPConfigVersion, getEntries, getPackageJson, getPluginJson, hasReadme, isWSL } from './utils'; const pluginJson = getPluginJson(); +const cpVersion = getCPConfigVersion(); -const config = async (env): Promise => ({ - cache: { - type: 'filesystem', - buildDependencies: { - config: [__filename], +const virtualPublicPath = new VirtualModulesPlugin({ + 'node_modules/grafana-public-path.js': ` +import amdMetaModule from 'amd-module'; + +__webpack_public_path__ = + amdMetaModule && amdMetaModule.uri + ? amdMetaModule.uri.slice(0, amdMetaModule.uri.lastIndexOf('/') + 1) + : 'public/plugins/${pluginJson.id}/'; +`, +}); + +const config = async (env): Promise => { + const baseConfig: Configuration = { + cache: { + type: 'filesystem', + buildDependencies: { + config: [__filename], + }, }, - }, - - context: path.join(process.cwd(), SOURCE_DIR), - - devtool: env.production ? 'source-map' : 'eval-source-map', - - entry: await getEntries(), - - externals: [ - 'lodash', - 'jquery', - 'moment', - 'slate', - 'emotion', - '@emotion/react', - '@emotion/css', - 'prismjs', - 'slate-plain-serializer', - '@grafana/slate-react', - 'react', - 'react-dom', - 'react-redux', - 'redux', - 'rxjs', - 'react-router', - 'react-router-dom', - 'd3', - 'angular', - '@grafana/ui', - '@grafana/runtime', - '@grafana/data', - - // Mark legacy SDK imports as external if their name starts with the "grafana/" prefix - ({ request }, callback) => { - const prefix = 'grafana/'; - const hasPrefix = (request) => request.indexOf(prefix) === 0; - const stripPrefix = (request) => request.substr(prefix.length); - - if (hasPrefix(request)) { - return callback(undefined, stripPrefix(request)); - } - - callback(); + + context: path.join(process.cwd(), SOURCE_DIR), + + devtool: env.production ? 'source-map' : 'eval-source-map', + + entry: await getEntries(), + + externals: [ + // Required for dynamic publicPath resolution + { 'amd-module': 'module' }, + 'lodash', + 'jquery', + 'moment', + 'slate', + 'emotion', + '@emotion/react', + '@emotion/css', + 'prismjs', + 'slate-plain-serializer', + '@grafana/slate-react', + 'react', + 'react-dom', + 'react-redux', + 'redux', + 'rxjs', + 'react-router', + 'react-router-dom', + 'd3', + 'angular', + '@grafana/ui', + '@grafana/runtime', + '@grafana/data', + + // Mark legacy SDK imports as external if their name starts with the "grafana/" prefix + ({ request }, callback) => { + const prefix = 'grafana/'; + const hasPrefix = (request) => request.indexOf(prefix) === 0; + const stripPrefix = (request) => request.substr(prefix.length); + + if (hasPrefix(request)) { + return callback(undefined, stripPrefix(request)); + } + + callback(); + }, + ], + + // Support WebAssembly according to latest spec - makes WebAssembly module async + experiments: { + asyncWebAssembly: true, }, - ], - - mode: env.production ? 'production' : 'development', - - module: { - rules: [ - { - exclude: /(node_modules)/, - test: /\.[tj]sx?$/, - use: { - loader: 'swc-loader', - options: { - jsc: { - baseUrl: './src', - target: 'es2015', - loose: false, - parser: { - syntax: 'typescript', - tsx: true, - decorators: false, - dynamicImport: true, + + mode: env.production ? 'production' : 'development', + + module: { + rules: [ + { + exclude: /(node_modules)/, + test: /\.[tj]sx?$/, + use: { + loader: 'swc-loader', + options: { + jsc: { + baseUrl: path.resolve(process.cwd(), SOURCE_DIR), + target: 'es2015', + loose: false, + parser: { + syntax: 'typescript', + tsx: true, + decorators: false, + dynamicImport: true, + }, }, }, }, }, - }, - { - test: /\.md$/, - use: 'raw-loader' - }, - { - test: /\.css$/, - use: ["style-loader", "css-loader"] - }, - { - test: /\.s[ac]ss$/, - use: ['style-loader', 'css-loader', 'sass-loader'], - }, - { - test: /\.(png|jpe?g|gif|svg)$/, - type: 'asset/resource', - generator: { - // Keep publicPath relative for host.com/grafana/ deployments - publicPath: `public/plugins/${pluginJson.id}/img/`, - outputPath: 'img/', - filename: Boolean(env.production) ? '[hash][ext]' : '[name][ext]', + { + test: /src\/(?:.*\/)?module\.tsx?$/, + use: [ + { + loader: 'imports-loader', + options: { + imports: `side-effects grafana-public-path`, + }, + }, + ], }, - }, - { - test: /\.(woff|woff2|eot|ttf|otf)(\?v=\d+\.\d+\.\d+)?$/, - type: 'asset/resource', - generator: { - // Keep publicPath relative for host.com/grafana/ deployments - publicPath: `public/plugins/${pluginJson.id}/fonts/`, - outputPath: 'fonts/', - filename: Boolean(env.production) ? '[hash][ext]' : '[name][ext]', + { + test: /\.css$/, + use: ['style-loader', 'css-loader'], }, - }, - ], - }, - - output: { - clean: { - keep: new RegExp(`.*?_(amd64|arm(64)?)(.exe)?`), - }, - filename: '[name].js', - library: { - type: 'amd', - }, - path: path.resolve(process.cwd(), DIST_DIR), - publicPath: '/', - }, - - plugins: [ - new CopyWebpackPlugin({ - patterns: [ - // If src/README.md exists use it; otherwise the root README - // To `compiler.options.output` - { from: hasReadme() ? 'README.md' : '../README.md', to: '.', force: true }, - { from: 'plugin.json', to: '.' }, - { from: '../LICENSE', to: '.' }, - { from: '../CHANGELOG.md', to: '.', force: true }, - { from: '**/*.json', to: '.' }, // TODO - { from: '**/*.svg', to: '.', noErrorOnMissing: true }, // Optional - { from: '**/*.png', to: '.', noErrorOnMissing: true }, // Optional - { from: '**/*.html', to: '.', noErrorOnMissing: true }, // Optional - { from: 'img/**/*', to: '.', noErrorOnMissing: true }, // Optional - { from: 'libs/**/*', to: '.', noErrorOnMissing: true }, // Optional - { from: 'static/**/*', to: '.', noErrorOnMissing: true }, // Optional - ], - }), - // Replace certain template-variables in the README and plugin.json - new ReplaceInFileWebpackPlugin([ - { - dir: DIST_DIR, - files: ['plugin.json', 'README.md'], - rules: [ - { - search: /\%VERSION\%/g, - replace: getPackageJson().version, + { + test: /\.s[ac]ss$/, + use: ['style-loader', 'css-loader', 'sass-loader'], + }, + { + test: /\.(png|jpe?g|gif|svg)$/, + type: 'asset/resource', + generator: { + filename: Boolean(env.production) ? '[hash][ext]' : '[file]', }, - { - search: /\%TODAY\%/g, - replace: new Date().toISOString().substring(0, 10), + }, + { + test: /\.(woff|woff2|eot|ttf|otf)(\?v=\d+\.\d+\.\d+)?$/, + type: 'asset/resource', + generator: { + filename: Boolean(env.production) ? '[hash][ext]' : '[file]', }, - { - search: /\%PLUGIN_ID\%/g, - replace: pluginJson.id, + }, + ], + }, + + optimization: { + minimize: Boolean(env.production), + minimizer: [ + new TerserPlugin({ + terserOptions: { + format: { + comments: (_, { type, value }) => type === 'comment2' && value.trim().startsWith('[create-plugin]'), + }, }, - ], + }), + ], + }, + + output: { + clean: { + keep: new RegExp(`(.*?_(amd64|arm(64)?)(.exe)?|go_plugin_build_manifest)`), }, - ]), - new ForkTsCheckerWebpackPlugin({ - async: Boolean(env.development), - issue: { - include: [{ file: '**/*.{ts,tsx}' }], + filename: '[name].js', + library: { + type: 'amd', }, - typescript: { configFile: path.join(process.cwd(), 'tsconfig.json') }, - }), - new ESLintPlugin({ - extensions: ['.ts', '.tsx'], - lintDirtyModulesOnly: Boolean(env.development), // don't lint on start, only lint changed files - }), - ...(env.development ? [new LiveReloadPlugin()] : []), - ], - - resolve: { - extensions: ['.js', '.jsx', '.ts', '.tsx'], - // handle resolving "rootDir" paths - modules: [path.resolve(process.cwd(), 'src'), 'node_modules'], - unsafeCache: true, - }, -}); + path: path.resolve(process.cwd(), DIST_DIR), + publicPath: `public/plugins/${pluginJson.id}/`, + uniqueName: pluginJson.id, + }, + + plugins: [ + virtualPublicPath, + // Insert create plugin version information into the bundle + new BannerPlugin({ + banner: '/* [create-plugin] version: ' + cpVersion + ' */', + raw: true, + entryOnly: true, + }), + new CopyWebpackPlugin({ + patterns: [ + // If src/README.md exists use it; otherwise the root README + // To `compiler.options.output` + { from: hasReadme() ? 'README.md' : '../README.md', to: '.', force: true }, + { from: 'plugin.json', to: '.' }, + { from: '../LICENSE', to: '.' }, + { from: '../CHANGELOG.md', to: '.', force: true }, + { from: '**/*.json', to: '.' }, // TODO + { from: '**/*.svg', to: '.', noErrorOnMissing: true }, // Optional + { from: '**/*.png', to: '.', noErrorOnMissing: true }, // Optional + { from: '**/*.html', to: '.', noErrorOnMissing: true }, // Optional + { from: 'img/**/*', to: '.', noErrorOnMissing: true }, // Optional + { from: 'libs/**/*', to: '.', noErrorOnMissing: true }, // Optional + { from: 'static/**/*', to: '.', noErrorOnMissing: true }, // Optional + { from: '**/query_help.md', to: '.', noErrorOnMissing: true }, // Optional + ], + }), + // Replace certain template-variables in the README and plugin.json + new ReplaceInFileWebpackPlugin([ + { + dir: DIST_DIR, + files: ['plugin.json', 'README.md'], + rules: [ + { + search: /\%VERSION\%/g, + replace: getPackageJson().version, + }, + { + search: /\%TODAY\%/g, + replace: new Date().toISOString().substring(0, 10), + }, + { + search: /\%PLUGIN_ID\%/g, + replace: pluginJson.id, + }, + ], + }, + ]), + ...(env.development + ? [ + new LiveReloadPlugin(), + new ForkTsCheckerWebpackPlugin({ + async: Boolean(env.development), + issue: { + include: [{ file: '**/*.{ts,tsx}' }], + }, + typescript: { configFile: path.join(process.cwd(), 'tsconfig.json') }, + }), + new ESLintPlugin({ + extensions: ['.ts', '.tsx'], + lintDirtyModulesOnly: Boolean(env.development), // don't lint on start, only lint changed files + }), + ] + : []), + ], + + resolve: { + extensions: ['.js', '.jsx', '.ts', '.tsx'], + // handle resolving "rootDir" paths + modules: [path.resolve(process.cwd(), 'src'), 'node_modules'], + unsafeCache: true, + }, + }; + + if (isWSL()) { + baseConfig.watchOptions = { + poll: 3000, + ignored: /node_modules/, + }; + } + + return baseConfig; +}; export default config; diff --git a/.cprc.json b/.cprc.json new file mode 100644 index 0000000..d3e88c3 --- /dev/null +++ b/.cprc.json @@ -0,0 +1,6 @@ +{ + "features": { + "bundleGrafanaUI": false, + "useReactRouterV6": false + } +} diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 089946f..867bb2a 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -90,20 +90,10 @@ Following prerequisites must be installed for developing the plugin 4. Navigate to the [Locally Running Grafana](http://localhost:3000). ### Debugging - -1. Build backend plugin binaries in debug mode for Linux, Windows and Darwin: - ```bash - mage build:debug - ``` - -2. Start docker compose - - ```bash - docker compose up -d - ``` +in `docker-compose.yaml` file, search for `development: false` and replace it with `development: true`. -3. Attach debugger - ```bash - docker compose exec grafana sh -c 'dlv attach --headless --listen=:2345 $(pidof gpx_dashboardreporter-app_linux_*)' - ``` +This starts an enhanced framework that automatically rebuilds and reloads the plugin inside the grafana container. +The go debugger is attached to the plugin and listen on localhost:2345. + +You can start a debug session from your local IDE and set breaking points as you would do on local development. diff --git a/docker-compose.yaml b/docker-compose.yaml index bc188fe..c7fa915 100755 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,7 +7,7 @@ services: args: grafana_image: ${GRAFANA_IMAGE:-grafana-oss} grafana_version: ${GRAFANA_VERSION:-11.1.0} - development: true + development: false cap_add: - SYS_PTRACE security_opt: diff --git a/package.json b/package.json index b1894d2..6ae77ab 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "package": "yarn build:plugin && zip -r mahendrapaipuri-dashboardreporter-app.zip", "dev": "webpack -w -c ./.config/webpack/webpack.config.ts --env development", "e2e:update": "playwright test --update-screenshots", - "e2e": "yarn playwright install && playwright test", + "e2e": "playwright test", "e2e:server:up": "docker compose -f .ci/docker-compose.yaml up --build -d", "e2e:server:down": "docker compose -f .ci/docker-compose.yaml down", "e2e:server:podman:up": "podman-compose -f .ci/docker-compose.yaml up --build -d", @@ -23,7 +23,7 @@ "e2e:report:update:plain": "curl -f -o .ci/reports/default.pdf $npm_package_config_plainUrl", "e2e:report:update:tls": "curl -k -f -o .ci/reports/alternative.pdf $npm_package_config_tlsUrl", "e2e:report:update": "yarn e2e:report:update:plain && yarn e2e:report:update:tls", - "lint:fix": "npm run lint -- --fix", + "lint:fix": "yarn run lint --fix", "lint": "eslint --cache --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx .", "server": "docker compose up --build", "server:podman": "podman-compose up --build", @@ -37,19 +37,19 @@ "devDependencies": { "@babel/core": "^7.21.4", "@grafana/eslint-config": "^7.0.0", - "@grafana/plugin-e2e": "^1.0.1", + "@grafana/plugin-e2e": "^1.6.1", "@grafana/tsconfig": "1.3.0-rc1", "@grafana/plugin-meta-extractor": "^0.0.2", "@playwright/test": "^1.41.2", - "@swc/core": "1.3.75", + "@swc/core": "^1.3.90", "@swc/helpers": "^0.5.0", "@swc/jest": "^0.2.26", "@testing-library/jest-dom": "6.1.4", - "@testing-library/react": "^12.1.4", + "@testing-library/react": "14.0.0", "@types/glob": "^8.0.0", "@types/jest": "^29.5.0", "@types/lodash": "^4.14.194", - "@types/node": "^18.15.11", + "@types/node": "^20.8.7", "@types/testing-library__jest-dom": "5.14.8", "@types/react-router-dom": "^5.3.3", "copy-webpack-plugin": "^11.0.0", @@ -57,32 +57,34 @@ "eslint-plugin-deprecation": "^2.0.0", "eslint-webpack-plugin": "^4.0.1", "fork-ts-checker-webpack-plugin": "^8.0.0", - "glob": "^10.1.0", + "glob": "^10.2.7", "identity-obj-proxy": "3.0.0", "jest": "^29.5.0", "jest-environment-jsdom": "^29.5.0", "prettier": "^2.8.7", "raw-loader": "^4.0.2", "replace-in-file-webpack-plugin": "^1.0.6", - "sass": "1.62.1", - "sass-loader": "13.2.2", - "style-loader": "3.3.2", + "sass": "1.63.2", + "sass-loader": "13.3.1", + "style-loader": "3.3.3", "swc-loader": "^0.2.3", "ts-node": "^10.9.1", "tsconfig-paths": "^4.2.0", "typescript": "5.5.4", "webpack": "^5.93.0", - "webpack-cli": "^5.0.1", - "webpack-livereload-plugin": "^3.0.2" + "webpack-cli": "^5.1.4", + "webpack-livereload-plugin": "^3.0.2", + "imports-loader": "^5.0.0", + "webpack-virtual-modules": "^0.6.2" }, "engines": { "node": ">=20" }, "dependencies": { "@emotion/css": "11.10.6", - "@grafana/data": "10.3.3", - "@grafana/runtime": "10.4.6", - "@grafana/ui": "10.3.3", + "@grafana/data": "^11.1.3", + "@grafana/runtime": "^11.1.3", + "@grafana/ui": "^11.1.3", "@grafana/experimental": "1.7.12", "@grafana/schema": "11.1.3", "react": "18.2.0",