Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .config/.cprc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"version": "5.22.1"
"version": "6.1.7",
"features": {}
}
31 changes: 0 additions & 31 deletions .config/.eslintrc

This file was deleted.

44 changes: 44 additions & 0 deletions .config/bundler/externals.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import type { Configuration, ExternalItemFunctionData } from 'webpack';

type ExternalsType = Configuration['externals'];

export const externals: ExternalsType = [
// 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',
'i18next',
'react-router',
'react-router-dom',
'd3',
'angular',
/^@grafana\/ui/i,
/^@grafana\/runtime/i,
/^@grafana\/data/i,

// Mark legacy SDK imports as external if their name starts with the "grafana/" prefix
({ request }: ExternalItemFunctionData, callback: (error?: Error, result?: string) => void) => {
const prefix = 'grafana/';
const hasPrefix = (request: string) => request.indexOf(prefix) === 0;
const stripPrefix = (request: string) => request.slice(prefix.length);

if (request && hasPrefix(request)) {
return callback(undefined, stripPrefix(request));
}

callback();
},
];
2 changes: 1 addition & 1 deletion .config/docker-compose-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
context: .
args:
grafana_image: ${GRAFANA_IMAGE:-grafana-enterprise}
grafana_version: ${GRAFANA_VERSION:-11.5.3}
grafana_version: ${GRAFANA_VERSION:-12.2.0}
development: ${DEVELOPMENT:-false}
anonymous_auth_enabled: ${ANONYMOUS_AUTH_ENABLED:-true}
ports:
Expand Down
31 changes: 31 additions & 0 deletions .config/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { defineConfig } from 'eslint/config';
import grafanaConfig from '@grafana/eslint-config/flat.js';

export default defineConfig([
...grafanaConfig,
{
rules: {
'react/prop-types': 'off',
},
},
{
files: ['src/**/*.{ts,tsx}'],

languageOptions: {
parserOptions: {
project: './tsconfig.json',
},
},

rules: {
'@typescript-eslint/no-deprecated': 'warn',
},
},
{
files: ['./tests/**/*'],

rules: {
'react-hooks/rules-of-hooks': 'off',
},
},
]);
2 changes: 1 addition & 1 deletion .config/jest-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-jest-config
* https://grafana.com/developers/plugin-tools/how-to-guides/extend-configurations#extend-the-jest-config
*/

import '@testing-library/jest-dom';
Expand Down
3 changes: 2 additions & 1 deletion .config/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-jest-config
* https://grafana.com/developers/plugin-tools/how-to-guides/extend-configurations#extend-the-jest-config
*/

const path = require('path');
Expand Down Expand Up @@ -40,4 +40,5 @@ module.exports = {
// Jest will throw `Cannot use import statement outside module` if it tries to load an
// ES module without it being transformed first. ./config/README.md#esm-errors-with-jest
transformIgnorePatterns: [nodeModulesToTransform(grafanaESModules)],
watchPathIgnorePatterns: ['<rootDir>/node_modules', '<rootDir>/dist'],
};
6 changes: 6 additions & 0 deletions .config/jest/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@ const nodeModulesToTransform = (moduleNames) => `node_modules\/(?!.*(${moduleNam
const grafanaESModules = [
'.pnpm', // Support using pnpm symlinked packages
'@grafana/schema',
'@wojtekmaj/date-utils',
'd3',
'd3-color',
'd3-force',
'd3-interpolate',
'd3-scale-chromatic',
'get-user-locale',
'marked',
'memoize',
'mimic-function',
'ol',
'react-calendar',
'react-colorful',
'rxjs',
'uuid',
Expand Down
2 changes: 1 addition & 1 deletion .config/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-typescript-config
* https://grafana.com/developers/plugin-tools/how-to-guides/extend-configurations#extend-the-typescript-config
*/
{
"compilerOptions": {
Expand Down
50 changes: 8 additions & 42 deletions .config/webpack/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-webpack-config
* https://grafana.com/developers/plugin-tools/how-to-guides/extend-configurations#extend-the-webpack-config
*/

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

const pluginJson = getPluginJson();
const cpVersion = getCPConfigVersion();
const pluginVersion = getPackageJson().version;

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

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/i,
/^@grafana\/runtime/i,
/^@grafana\/data/i,

// Mark legacy SDK imports as external if their name starts with the "grafana/" prefix
({ request }, callback) => {
const prefix = 'grafana/';
const hasPrefix = (request: string) => request.indexOf(prefix) === 0;
const stripPrefix = (request: string) => request.substr(prefix.length);

if (request && hasPrefix(request)) {
return callback(undefined, stripPrefix(request));
}

callback();
},
],
externals,

// Support WebAssembly according to latest spec - makes WebAssembly module async
experiments: {
Expand Down Expand Up @@ -196,7 +160,8 @@ const config = async (env: Env): Promise<Configuration> => {
virtualPublicPath,
// Insert create plugin version information into the bundle
new webpack.BannerPlugin({
banner: '/* [create-plugin] version: ' + cpVersion + ' */',
banner: `/* [create-plugin] version: ${cpVersion} */
/* [create-plugin] plugin: ${pluginJson.id}@${pluginVersion} */`,
raw: true,
entryOnly: true,
}),
Expand Down Expand Up @@ -226,7 +191,7 @@ const config = async (env: Env): Promise<Configuration> => {
rules: [
{
search: /\%VERSION\%/g,
replace: getPackageJson().version,
replace: pluginVersion,
},
{
search: /\%TODAY\%/g,
Expand Down Expand Up @@ -255,6 +220,7 @@ const config = async (env: Env): Promise<Configuration> => {
new ESLintPlugin({
extensions: ['.ts', '.tsx'],
lintDirtyModulesOnly: Boolean(env.development), // don't lint on start, only lint changed files
failOnError: Boolean(env.production),
}),
]
: []),
Expand Down
3 changes: 2 additions & 1 deletion .cprc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"features": {
"bundleGrafanaUI": false,
"useReactRouterV6": false
"useReactRouterV6": false,
"useExperimentalRspack": false
}
}
12 changes: 0 additions & 12 deletions .eslintrc

This file was deleted.

13 changes: 12 additions & 1 deletion .github/workflows/is-compatible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,16 @@ jobs:
run: pnpm install --frozen-lockfile --prefer-offline
- name: Build plugin
run: pnpm run build
- name: Find module.ts or module.tsx
id: find-module-ts
run: >-
MODULETS="$(find ./src -type f \( -name "module.ts" -o -name
"module.tsx" \))"

echo "modulets=${MODULETS}" >> $GITHUB_OUTPUT
- name: Compatibility check
run: npx --yes @grafana/levitate@latest is-compatible --path $(find ./src -type f \( -name "module.ts" -o -name "module.tsx" \)) --target @grafana/data,@grafana/ui,@grafana/runtime
uses: grafana/plugin-actions/is-compatible@main
with:
module: ${{ steps.find-module-ts.outputs.modulets }}
comment-pr: no
fail-if-incompatible: yes
23 changes: 3 additions & 20 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
services:
grafana:
user: root
container_name: 'gapit-htmlgraphics-panel'

build:
context: ./.config
args:
grafana_image: ${GRAFANA_IMAGE:-grafana-enterprise}
grafana_version: ${GRAFANA_VERSION:-11.3.2}
development: ${DEVELOPMENT:-false}
anonymous_auth_enabled: ${ANONYMOUS_AUTH_ENABLED:-true}
ports:
- 3000:3000/tcp
volumes:
- ./dist:/var/lib/grafana/plugins/gapit-htmlgraphics-panel
- ./provisioning:/etc/grafana/provisioning
- .:/root/gapit-htmlgraphics-panel

environment:
NODE_ENV: development
GF_LOG_FILTERS: plugin.gapit-htmlgraphics-panel:debug
GF_LOG_LEVEL: debug
GF_DATAPROXY_LOGGING: 1
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: gapit-htmlgraphics-panel
extends:
file: .config/docker-compose-base.yaml
service: grafana
43 changes: 43 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { defineConfig } from 'eslint/config';
import baseConfig from './.config/eslint.config.mjs';

export default defineConfig([
{
ignores: [
'**/logs',
'**/*.log',
'**/npm-debug.log*',
'**/yarn-debug.log*',
'**/yarn-error.log*',
'**/.pnpm-debug.log*',
'**/node_modules/',
'**/pids',
'**/*.pid',
'**/*.seed',
'**/*.pid.lock',
'**/lib-cov',
'**/coverage',
'**/dist/',
'**/artifacts/',
'**/work/',
'**/ci/',
'test-results/',
'playwright-report/',
'blob-report/',
'playwright/.cache/',
'playwright/.auth/',
'**/.idea',
'**/.eslintcache',
'**/public/build',
'website/'
],
},
...baseConfig,
{
files: ['src/components/CodeEditor/declarations/**/*.ts'],

rules: {
'@typescript-eslint/no-deprecated': 'off',
},
},
]);
Loading