diff --git a/.betterer.results b/.betterer.results index edf78f5e317..ebc179e8f69 100644 --- a/.betterer.results +++ b/.betterer.results @@ -689,6 +689,11 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "2"], [0, 0, 0, "Styles should be written using objects.", "3"] ], + "packages/grafana-plugin-configs/webpack.config.ts:5381": [ + [0, 0, 0, "Unexpected any. Specify a different type.", "0"], + [0, 0, 0, "Unexpected any. Specify a different type.", "1"], + [0, 0, 0, "Unexpected any. Specify a different type.", "2"] + ], "packages/grafana-runtime/src/analytics/types.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 29082081247..6f64cde93fd 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -18,7 +18,7 @@ "@locker/near-membrane-shared", // critical library. we need to bump this only intentionally "@locker/near-membrane-shared-dom", // critical library. we need to bump this only intentionally ], - "includePaths": ["package.json", "packages/**"], + "includePaths": ["package.json", "packages/**", "public/app/plugins/**"], "ignorePaths": ["emails/**", "plugins-bundled/**", "**/mocks/**"], "labels": ["area/frontend", "dependencies", "no-backport", "no-changelog"], "postUpdateOptions": ["yarnDedupeHighest"], diff --git a/.gitignore b/.gitignore index e7580cc5fb8..b8b8a3ffed0 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,7 @@ tsconfig.tsbuildinfo __debug_bin* # Yarn -.yarn/* +.yarn/ !.yarn/patches !.yarn/releases !.yarn/plugins @@ -200,3 +200,6 @@ deployment_tools_config.json # Temporary file for backporting PRs .pr-body.txt + +# Core plugin builds +public/app/plugins/**/dist/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 22e1f102583..fc73ee1d659 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,7 @@ COPY package.json yarn.lock .yarnrc.yml ./ COPY .yarn .yarn COPY packages packages COPY plugins-bundled plugins-bundled +COPY public public RUN yarn install --immutable diff --git a/package.json b/package.json index f945fb6f60d..3743a19391d 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "lint:sass": "yarn stylelint '{public/sass,packages}/**/*.scss' --cache", "test:ci": "yarn i18n:compile && mkdir -p reports/junit && JEST_JUNIT_OUTPUT_DIR=reports/junit jest --ci --reporters=default --reporters=jest-junit -w ${TEST_MAX_WORKERS:-100%}", "lint:fix": "yarn lint:ts --fix", - "packages:build": "lerna run build --ignore @grafana-plugins/input-datasource", + "packages:build": "lerna run build --ignore '@grafana-plugins/*'", "packages:clean": "rimraf ./npm-artifacts && lerna run clean --parallel", "packages:prepare": "lerna version --no-push --no-git-tag-version --force-publish --exact", "packages:pack": "mkdir -p ./npm-artifacts && lerna exec --no-private -- yarn pack --out \"../../npm-artifacts/%s-%v.tgz\"", @@ -54,7 +54,10 @@ "betterer:merge": "betterer merge", "betterer:stats": "ts-node --transpile-only --project ./scripts/cli/tsconfig.json ./scripts/cli/reportBettererStats.ts", "betterer:issues": "ts-node --transpile-only --project ./scripts/cli/tsconfig.json ./scripts/cli/generateBettererIssues.ts", - "generate-icons-bundle-cache-file": "node ./scripts/generate-icon-bundle.js" + "generate-icons-bundle-cache-file": "node ./scripts/generate-icon-bundle.js", + "plugin:build": "lerna run build --ignore=\"@grafana/*\"", + "plugin:build:commit": "lerna run build:commit --ignore=\"@grafana/*\"", + "plugin:build:dev": "lerna run dev --ignore=\"@grafana/*\"" }, "grafana": { "whatsNewUrl": "https://grafana.com/docs/grafana/next/whatsnew/whats-new-in-v10-1/", @@ -241,6 +244,7 @@ "@emotion/react": "11.11.1", "@fingerprintjs/fingerprintjs": "^3.4.2", "@glideapps/glide-data-grid": "^5.2.1", + "@grafana-plugins/grafana-testdata-datasource": "workspace:*", "@grafana/aws-sdk": "0.1.3", "@grafana/data": "workspace:*", "@grafana/e2e-selectors": "workspace:*", @@ -434,7 +438,8 @@ "workspaces": { "packages": [ "packages/*", - "plugins-bundled/internal/*" + "plugins-bundled/internal/*", + "public/app/plugins/*/*" ] }, "engines": { diff --git a/packages/grafana-plugin-configs/constants.ts b/packages/grafana-plugin-configs/constants.ts new file mode 100644 index 00000000000..4ad1a179e18 --- /dev/null +++ b/packages/grafana-plugin-configs/constants.ts @@ -0,0 +1 @@ +export const DIST_DIR = 'dist'; diff --git a/packages/grafana-plugin-configs/package.json b/packages/grafana-plugin-configs/package.json new file mode 100644 index 00000000000..e786d8f2514 --- /dev/null +++ b/packages/grafana-plugin-configs/package.json @@ -0,0 +1,19 @@ +{ + "name": "@grafana/plugin-configs", + "description": "Shared dependencies and files for core plugins", + "private": true, + "version": "10.2.0-pre", + "dependencies": { + "tslib": "2.6.0" + }, + "devDependencies": { + "@grafana/tsconfig": "^1.2.0-rc1", + "copy-webpack-plugin": "11.0.0", + "eslint-webpack-plugin": "4.0.1", + "fork-ts-checker-webpack-plugin": "8.0.0", + "glob": "10.3.3", + "replace-in-file-webpack-plugin": "1.0.6", + "webpack": "5.88.1" + }, + "packageManager": "yarn@3.6.0" +} diff --git a/packages/grafana-plugin-configs/tsconfig.json b/packages/grafana-plugin-configs/tsconfig.json new file mode 100644 index 00000000000..5fa5336e958 --- /dev/null +++ b/packages/grafana-plugin-configs/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "alwaysStrict": true, + "declaration": false, + "resolveJsonModule": true + }, + "ts-node": { + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "esModuleInterop": true + }, + "transpileOnly": true + }, + "extends": "@grafana/tsconfig", + + "exclude": ["**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.spec.tsx"], + "include": ["./types", "."] +} diff --git a/packages/grafana-plugin-configs/types/custom.d.ts b/packages/grafana-plugin-configs/types/custom.d.ts new file mode 100644 index 00000000000..64e6eaa6f23 --- /dev/null +++ b/packages/grafana-plugin-configs/types/custom.d.ts @@ -0,0 +1,37 @@ +// Image declarations +declare module '*.gif' { + const src: string; + export default src; +} + +declare module '*.jpg' { + const src: string; + export default src; +} + +declare module '*.jpeg' { + const src: string; + export default src; +} + +declare module '*.png' { + const src: string; + export default src; +} + +declare module '*.webp' { + const src: string; + export default src; +} + +declare module '*.svg' { + const content: string; + export default content; +} + +// Font declarations +declare module '*.woff'; +declare module '*.woff2'; +declare module '*.eot'; +declare module '*.ttf'; +declare module '*.otf'; diff --git a/packages/grafana-plugin-configs/utils.ts b/packages/grafana-plugin-configs/utils.ts new file mode 100644 index 00000000000..a02a2d8d16f --- /dev/null +++ b/packages/grafana-plugin-configs/utils.ts @@ -0,0 +1,26 @@ +import fs from 'fs'; +import { glob } from 'glob'; +import path from 'path'; +import process from 'process'; + +export function getPackageJson() { + return require(path.resolve(process.cwd(), 'package.json')); +} + +export function getPluginJson() { + return require(path.resolve(process.cwd(), 'plugin.json')); +} + +export async function getEntries(): Promise> { + const pluginModules = await glob(path.resolve(process.cwd(), `module.{ts,tsx}`)); + if (pluginModules.length > 0) { + return { + module: pluginModules[0], + }; + } + throw new Error('Could not find module.ts or module.tsx file'); +} + +export function hasLicense() { + return fs.existsSync(path.resolve(process.cwd(), 'LICENSE')); +} diff --git a/packages/grafana-plugin-configs/webpack.config.ts b/packages/grafana-plugin-configs/webpack.config.ts new file mode 100644 index 00000000000..243cf76d308 --- /dev/null +++ b/packages/grafana-plugin-configs/webpack.config.ts @@ -0,0 +1,208 @@ +import CopyWebpackPlugin from 'copy-webpack-plugin'; +import ESLintPlugin from 'eslint-webpack-plugin'; +import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'; +import path from 'path'; +import ReplaceInFileWebpackPlugin from 'replace-in-file-webpack-plugin'; +import { Configuration } from 'webpack'; + +import { DIST_DIR } from './constants'; +import { getPackageJson, getPluginJson, getEntries, hasLicense } from './utils'; + +function skipFiles(f: string): boolean { + if (f.includes('/dist/')) { + // avoid copying files already in dist + return false; + } + if (f.includes('/tsconfig.json')) { + // avoid copying tsconfig.json + return false; + } + return true; +} + +const config = async (env: any): Promise => { + const pluginJson = getPluginJson(); + const baseConfig: Configuration = { + cache: { + type: 'filesystem', + buildDependencies: { + config: [__filename], + }, + }, + + context: process.cwd(), + + 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: any) => request.indexOf(prefix) === 0; + const stripPrefix = (request: any) => request.substr(prefix.length); + + if (hasPrefix(request)) { + return callback(undefined, stripPrefix(request)); + } + + callback(); + }, + ], + + mode: env.production ? 'production' : 'development', + + module: { + rules: [ + { + exclude: /(node_modules)/, + test: /\.[tj]sx?$/, + use: { + loader: 'swc-loader', + options: { + jsc: { + baseUrl: '.', + target: 'es2015', + loose: false, + parser: { + syntax: 'typescript', + tsx: true, + decorators: false, + dynamicImport: true, + }, + }, + }, + }, + }, + { + 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: /\.(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]', + }, + }, + ], + }, + + output: { + clean: { + keep: new RegExp(`(.*?_(amd64|arm(64)?)(.exe)?|go_plugin_build_manifest)`), + }, + filename: '[name].js', + library: { + type: 'amd', + }, + path: path.resolve(process.cwd(), DIST_DIR), + publicPath: `public/plugins/${pluginJson.id}/`, + }, + + plugins: [ + new CopyWebpackPlugin({ + patterns: [ + // To `compiler.options.output` + { from: 'README.md', to: '.', force: true }, + { from: 'plugin.json', to: '.' }, + { from: hasLicense() ? 'LICENSE' : '../../../../../LICENSE', to: '.' }, // Point to Grafana License by default + { from: 'CHANGELOG.md', to: '.', force: true }, + { from: '**/*.json', to: '.', filter: skipFiles }, // TODO + { from: '**/*.svg', to: '.', noErrorOnMissing: true, filter: skipFiles }, // Optional + { from: '**/*.png', to: '.', noErrorOnMissing: true, filter: skipFiles }, // Optional + { from: '**/*.html', to: '.', noErrorOnMissing: true, filter: skipFiles }, // Optional + { from: 'img/**/*', to: '.', noErrorOnMissing: true, filter: skipFiles }, // Optional + { from: 'libs/**/*', to: '.', noErrorOnMissing: true, filter: skipFiles }, // Optional + { from: 'static/**/*', to: '.', noErrorOnMissing: true, filter: skipFiles }, // Optional + ], + }), + // Replace certain template-variables in the README and plugin.json + new ReplaceInFileWebpackPlugin([ + { + dir: path.resolve(DIST_DIR), + files: ['plugin.json', 'README.md'], + rules: [ + { + search: /\%VERSION\%/g, + replace: env.commit ? `${getPackageJson().version}-${env.commit}` : getPackageJson().version, + }, + { + search: /\%TODAY\%/g, + replace: new Date().toISOString().substring(0, 10), + }, + { + search: /\%PLUGIN_ID\%/g, + replace: pluginJson.id, + }, + ], + }, + ]), + 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'], + unsafeCache: true, + }, + + watchOptions: { + ignored: ['**/node_modules', '**/dist', '**/.yarn'], + }, + }; + + return baseConfig; +}; + +export default config; diff --git a/packages/grafana-schema/src/raw/composable/testdata/dataquery/x/TestDataDataQuery_types.gen.ts b/packages/grafana-schema/src/raw/composable/testdata/dataquery/x/TestDataDataQuery_types.gen.ts index c8fb0c9fcd5..de0ca9740f0 100644 --- a/packages/grafana-schema/src/raw/composable/testdata/dataquery/x/TestDataDataQuery_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/testdata/dataquery/x/TestDataDataQuery_types.gen.ts @@ -11,7 +11,7 @@ import * as common from '@grafana/schema'; -export const pluginVersion = "10.2.0-pre"; +export const pluginVersion = "%VERSION%"; export enum TestDataQueryType { Annotations = 'annotations', diff --git a/pkg/plugins/manager/loader/assetpath/assetpath.go b/pkg/plugins/manager/loader/assetpath/assetpath.go index bcdbc1a627d..0306c823f4f 100644 --- a/pkg/plugins/manager/loader/assetpath/assetpath.go +++ b/pkg/plugins/manager/loader/assetpath/assetpath.go @@ -45,7 +45,8 @@ func DefaultService(cfg *config.Cfg) *Service { // Base returns the base path for the specified plugin. func (s *Service) Base(n PluginInfo) (string, error) { if n.class == plugins.ClassCore { - return path.Join("/", s.cfg.GrafanaAppSubURL, "/public/app/plugins", string(n.pluginJSON.Type), filepath.Base(n.dir)), nil + baseDir := getBaseDir(n.dir) + return path.Join("/", s.cfg.GrafanaAppSubURL, "/public/app/plugins", string(n.pluginJSON.Type), baseDir), nil } if s.cdn.PluginSupported(n.pluginJSON.ID) { return s.cdn.AssetURL(n.pluginJSON.ID, n.pluginJSON.Info.Version, "") @@ -56,7 +57,8 @@ func (s *Service) Base(n PluginInfo) (string, error) { // Module returns the module.js path for the specified plugin. func (s *Service) Module(n PluginInfo) (string, error) { if n.class == plugins.ClassCore { - return path.Join("core:plugin", filepath.Base(n.dir)), nil + baseDir := getBaseDir(n.dir) + return path.Join("core:plugin", baseDir), nil } if s.cdn.PluginSupported(n.pluginJSON.ID) { return s.cdn.AssetURL(n.pluginJSON.ID, n.pluginJSON.Info.Version, "module.js") @@ -94,3 +96,12 @@ func (s *Service) RelativeURL(n PluginInfo, pathStr string) (string, error) { func (s *Service) DefaultLogoPath(pluginType plugins.Type) string { return path.Join("/", s.cfg.GrafanaAppSubURL, fmt.Sprintf("/public/img/icn-%s.svg", string(pluginType))) } + +func getBaseDir(pluginDir string) string { + baseDir := filepath.Base(pluginDir) + // Decoupled core plugins will be suffixed with "dist" if they have been built + if baseDir == "dist" { + return filepath.Base(strings.TrimSuffix(pluginDir, baseDir)) + } + return baseDir +} diff --git a/public/app/features/plugins/built_in_plugins.ts b/public/app/features/plugins/built_in_plugins.ts index 40d6bf59874..fe48f0b03ae 100644 --- a/public/app/features/plugins/built_in_plugins.ts +++ b/public/app/features/plugins/built_in_plugins.ts @@ -28,7 +28,7 @@ const prometheusPlugin = async () => const mssqlPlugin = async () => await import(/* webpackChunkName: "mssqlPlugin" */ 'app/plugins/datasource/mssql/module'); const testDataDSPlugin = async () => - await import(/* webpackChunkName: "testDataDSPlugin" */ 'app/plugins/datasource/grafana-testdata-datasource/module'); + await import(/* webpackChunkName: "testDataDSPlugin" */ '@grafana-plugins/grafana-testdata-datasource/module'); const cloudMonitoringPlugin = async () => await import(/* webpackChunkName: "cloudMonitoringPlugin" */ 'app/plugins/datasource/cloud-monitoring/module'); const azureMonitorPlugin = async () => diff --git a/public/app/features/scenes/scenes/gridMultiTimeRange.tsx b/public/app/features/scenes/scenes/gridMultiTimeRange.tsx index 25511bb9605..c10d6847a22 100644 --- a/public/app/features/scenes/scenes/gridMultiTimeRange.tsx +++ b/public/app/features/scenes/scenes/gridMultiTimeRange.tsx @@ -7,7 +7,7 @@ import { SceneGridItem, PanelBuilders, } from '@grafana/scenes'; -import { TestDataQueryType } from 'app/plugins/datasource/grafana-testdata-datasource/dataquery.gen'; +import { TestDataQueryType } from '@grafana-plugins/grafana-testdata-datasource/dataquery.gen'; import { DashboardScene } from '../../dashboard-scene/scene/DashboardScene'; diff --git a/public/app/features/scenes/scenes/gridWithMultipleData.tsx b/public/app/features/scenes/scenes/gridWithMultipleData.tsx index 8cee30efece..3d382b53a05 100644 --- a/public/app/features/scenes/scenes/gridWithMultipleData.tsx +++ b/public/app/features/scenes/scenes/gridWithMultipleData.tsx @@ -7,7 +7,7 @@ import { SceneGridItem, PanelBuilders, } from '@grafana/scenes'; -import { TestDataQueryType } from 'app/plugins/datasource/grafana-testdata-datasource/dataquery.gen'; +import { TestDataQueryType } from '@grafana-plugins/grafana-testdata-datasource/dataquery.gen'; import { DashboardScene } from '../../dashboard-scene/scene/DashboardScene'; diff --git a/public/app/features/scenes/scenes/queries.ts b/public/app/features/scenes/scenes/queries.ts index 3bf3df1b2a6..a87957a9a11 100644 --- a/public/app/features/scenes/scenes/queries.ts +++ b/public/app/features/scenes/scenes/queries.ts @@ -1,5 +1,5 @@ import { QueryRunnerState, SceneQueryRunner } from '@grafana/scenes'; -import { TestData } from 'app/plugins/datasource/grafana-testdata-datasource/dataquery.gen'; +import { TestData } from '@grafana-plugins/grafana-testdata-datasource/dataquery.gen'; export function getQueryRunnerWithRandomWalkQuery( overrides?: Partial, diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/.eslintignore b/public/app/plugins/datasource/grafana-testdata-datasource/.eslintignore new file mode 100644 index 00000000000..59ac0834c7a --- /dev/null +++ b/public/app/plugins/datasource/grafana-testdata-datasource/.eslintignore @@ -0,0 +1,2 @@ +# TS generate from cue by cuetsy +**/*.gen.ts diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/CHANGELOG.md b/public/app/plugins/datasource/grafana-testdata-datasource/CHANGELOG.md new file mode 100644 index 00000000000..825c32f0d03 --- /dev/null +++ b/public/app/plugins/datasource/grafana-testdata-datasource/CHANGELOG.md @@ -0,0 +1 @@ +# Changelog diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/README.md b/public/app/plugins/datasource/grafana-testdata-datasource/README.md new file mode 100644 index 00000000000..fa12e4ebd54 --- /dev/null +++ b/public/app/plugins/datasource/grafana-testdata-datasource/README.md @@ -0,0 +1,3 @@ +# Grafana TestData data source + +This data source is used for testing and development of Grafana. Generates test data in different forms. diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/package.json b/public/app/plugins/datasource/grafana-testdata-datasource/package.json new file mode 100644 index 00000000000..a8570eeb31e --- /dev/null +++ b/public/app/plugins/datasource/grafana-testdata-datasource/package.json @@ -0,0 +1,42 @@ +{ + "name": "@grafana-plugins/grafana-testdata-datasource", + "description": "Generates test data in different forms", + "private": true, + "version": "10.2.0-pre", + "dependencies": { + "@emotion/css": "11.11.2", + "@grafana/data": "10.2.0-pre", + "@grafana/experimental": "1.7.0", + "@grafana/runtime": "10.2.0-pre", + "@grafana/schema": "10.2.0-pre", + "@grafana/ui": "10.2.0-pre", + "lodash": "4.17.21", + "react": "18.2.0", + "react-use": "17.4.0", + "rxjs": "7.8.1", + "tslib": "2.6.0" + }, + "devDependencies": { + "@grafana/e2e-selectors": "10.2.0-pre", + "@grafana/plugin-configs": "10.2.0-pre", + "@testing-library/react": "14.0.0", + "@testing-library/user-event": "14.4.3", + "@types/jest": "29.5.4", + "@types/lodash": "4.14.195", + "@types/node": "18.16.16", + "@types/react": "18.2.15", + "@types/testing-library__jest-dom": "5.14.8", + "swc-loader": "0.2.3", + "ts-node": "10.9.1", + "webpack": "5.88.1" + }, + "peerDependencies": { + "@grafana/runtime": "*" + }, + "scripts": { + "build": "webpack -c ./webpack.config.ts --env production", + "build:commit": "webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)", + "dev": "webpack -w -c ./webpack.config.ts --env development" + }, + "packageManager": "yarn@3.6.0" +} diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/plugin.json b/public/app/plugins/datasource/grafana-testdata-datasource/plugin.json index 2792259a779..fb45906c187 100644 --- a/public/app/plugins/datasource/grafana-testdata-datasource/plugin.json +++ b/public/app/plugins/datasource/grafana-testdata-datasource/plugin.json @@ -3,6 +3,7 @@ "name": "TestData", "id": "grafana-testdata-datasource", "aliasIDs": ["testdata"], + "executable": "gpx_testdata", "metrics": true, "logs": true, @@ -24,7 +25,8 @@ "logos": { "small": "img/testdata.svg", "large": "img/testdata.svg" - } + }, + "version": "%VERSION%" }, "includes": [ diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/tsconfig.json b/public/app/plugins/datasource/grafana-testdata-datasource/tsconfig.json new file mode 100644 index 00000000000..7daf2ee8aba --- /dev/null +++ b/public/app/plugins/datasource/grafana-testdata-datasource/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "@grafana/plugin-configs/tsconfig.json", + "include": ["."] +} diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/webpack.config.ts b/public/app/plugins/datasource/grafana-testdata-datasource/webpack.config.ts new file mode 100644 index 00000000000..4da5a990cfa --- /dev/null +++ b/public/app/plugins/datasource/grafana-testdata-datasource/webpack.config.ts @@ -0,0 +1,3 @@ +import config from '@grafana/plugin-configs/webpack.config'; + +export default config; diff --git a/scripts/check-breaking-changes.sh b/scripts/check-breaking-changes.sh index 74d76eaa120..31de6ecbbaa 100755 --- a/scripts/check-breaking-changes.sh +++ b/scripts/check-breaking-changes.sh @@ -4,6 +4,7 @@ PACKAGES=$(ls -d ./packages/*/) EXIT_CODE=0 GITHUB_MESSAGE="" +SKIP_PACKAGES=("grafana-eslint-rules" "grafana-plugin-configs") # Loop through the packages while IFS=" " read -r -a package; do @@ -16,7 +17,7 @@ while IFS=" " read -r -a package; do CURRENT="./pr/$PACKAGE_PATH" # Temporarily skipping these packages as they don't have any exposed static typing - if [[ "$PACKAGE_PATH" == 'grafana-eslint-rules' ]]; then + if [[ ${SKIP_PACKAGES[@]} =~ "$PACKAGE_PATH" ]]; then continue fi diff --git a/tsconfig.json b/tsconfig.json index fa4ee214a1c..65e4f668b3b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,5 +23,6 @@ "public/vendor/**/*.ts", "packages/grafana-data/typings", "packages/grafana-ui/src/types" - ] + ], + "exclude": ["public/app/**/webpack.config.ts"] } diff --git a/yarn.lock b/yarn.lock index 284b54f815b..87bd5d45669 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2834,6 +2834,38 @@ __metadata: languageName: node linkType: hard +"@grafana-plugins/grafana-testdata-datasource@workspace:*, @grafana-plugins/grafana-testdata-datasource@workspace:public/app/plugins/datasource/grafana-testdata-datasource": + version: 0.0.0-use.local + resolution: "@grafana-plugins/grafana-testdata-datasource@workspace:public/app/plugins/datasource/grafana-testdata-datasource" + dependencies: + "@emotion/css": 11.11.2 + "@grafana/data": 10.2.0-pre + "@grafana/e2e-selectors": 10.2.0-pre + "@grafana/experimental": 1.7.0 + "@grafana/plugin-configs": 10.2.0-pre + "@grafana/runtime": 10.2.0-pre + "@grafana/schema": 10.2.0-pre + "@grafana/ui": 10.2.0-pre + "@testing-library/react": 14.0.0 + "@testing-library/user-event": 14.4.3 + "@types/jest": 29.5.4 + "@types/lodash": 4.14.195 + "@types/node": 18.16.16 + "@types/react": 18.2.15 + "@types/testing-library__jest-dom": 5.14.8 + lodash: 4.17.21 + react: 18.2.0 + react-use: 17.4.0 + rxjs: 7.8.1 + swc-loader: 0.2.3 + ts-node: 10.9.1 + tslib: 2.6.0 + webpack: 5.88.1 + peerDependencies: + "@grafana/runtime": "*" + languageName: unknown + linkType: soft + "@grafana-plugins/input-datasource@workspace:plugins-bundled/internal/input-datasource": version: 0.0.0-use.local resolution: "@grafana-plugins/input-datasource@workspace:plugins-bundled/internal/input-datasource" @@ -3193,7 +3225,22 @@ __metadata: languageName: node linkType: hard -"@grafana/runtime@workspace:*, @grafana/runtime@workspace:packages/grafana-runtime": +"@grafana/plugin-configs@10.2.0-pre, @grafana/plugin-configs@workspace:packages/grafana-plugin-configs": + version: 0.0.0-use.local + resolution: "@grafana/plugin-configs@workspace:packages/grafana-plugin-configs" + dependencies: + "@grafana/tsconfig": ^1.2.0-rc1 + copy-webpack-plugin: 11.0.0 + eslint-webpack-plugin: 4.0.1 + fork-ts-checker-webpack-plugin: 8.0.0 + glob: 10.3.3 + replace-in-file-webpack-plugin: 1.0.6 + tslib: 2.6.0 + webpack: 5.88.1 + languageName: unknown + linkType: soft + +"@grafana/runtime@10.2.0-pre, @grafana/runtime@workspace:*, @grafana/runtime@workspace:packages/grafana-runtime": version: 0.0.0-use.local resolution: "@grafana/runtime@workspace:packages/grafana-runtime" dependencies: @@ -8368,6 +8415,15 @@ __metadata: languageName: node linkType: hard +"@testing-library/user-event@npm:14.4.3": + version: 14.4.3 + resolution: "@testing-library/user-event@npm:14.4.3" + peerDependencies: + "@testing-library/dom": ">=7.21.4" + checksum: 852c48ea6db1c9471b18276617c84fec4320771e466cd58339a732ca3fd73ad35e5a43ae14f51af51a8d0a150dcf60fcaab049ef367871207bea8f92c4b8195e + languageName: node + linkType: hard + "@testing-library/user-event@npm:14.5.1": version: 14.5.1 resolution: "@testing-library/user-event@npm:14.5.1" @@ -9350,6 +9406,13 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:18.16.16": + version: 18.16.16 + resolution: "@types/node@npm:18.16.16" + checksum: 0efad726dd1e0bef71c392c708fc5d78c5b39c46b0ac5186fee74de4ccb1b2e847b3fa468da67d62812f56569da721b15bf31bdc795e6c69b56c73a45079ed2d + languageName: node + linkType: hard + "@types/node@npm:^14.14.31": version: 14.18.36 resolution: "@types/node@npm:14.18.36" @@ -9774,7 +9837,7 @@ __metadata: languageName: node linkType: hard -"@types/testing-library__jest-dom@npm:5.14.8, @types/testing-library__jest-dom@npm:^5.9.1": +"@types/testing-library__jest-dom@npm:5.14.8": version: 5.14.8 resolution: "@types/testing-library__jest-dom@npm:5.14.8" dependencies: @@ -9783,6 +9846,15 @@ __metadata: languageName: node linkType: hard +"@types/testing-library__jest-dom@npm:^5.9.1": + version: 5.14.9 + resolution: "@types/testing-library__jest-dom@npm:5.14.9" + dependencies: + "@types/jest": "*" + checksum: d364494fc2545316292e88861146146af1e3818792ca63b62a63758b2f737669b687f4aaddfcfbcb7d0e1ed7890a9bd05de23ff97f277d5e68de574497a9ee72 + languageName: node + linkType: hard + "@types/tinycolor2@npm:1.4.3": version: 1.4.3 resolution: "@types/tinycolor2@npm:1.4.3" @@ -17675,6 +17747,7 @@ __metadata: "@emotion/react": 11.11.1 "@fingerprintjs/fingerprintjs": ^3.4.2 "@glideapps/glide-data-grid": ^5.2.1 + "@grafana-plugins/grafana-testdata-datasource": "workspace:*" "@grafana/aws-sdk": 0.1.3 "@grafana/data": "workspace:*" "@grafana/e2e-selectors": "workspace:*" @@ -26253,6 +26326,13 @@ __metadata: languageName: node linkType: hard +"replace-in-file-webpack-plugin@npm:1.0.6": + version: 1.0.6 + resolution: "replace-in-file-webpack-plugin@npm:1.0.6" + checksum: 0c00a074e544ebe1aef0615e594f6daad47427950a2454e88f94dcb185839d68ce07854b83bbcb5f9b2336f8e8ae24017db4eca085135a9be84e43585163301a + languageName: node + linkType: hard + "request-progress@npm:^3.0.0": version: 3.0.0 resolution: "request-progress@npm:3.0.0" @@ -28260,7 +28340,7 @@ __metadata: languageName: node linkType: hard -"swc-loader@npm:^0.2.3": +"swc-loader@npm:0.2.3, swc-loader@npm:^0.2.3": version: 0.2.3 resolution: "swc-loader@npm:0.2.3" peerDependencies: