Build testdata frontend standalone (#75833)
This commit is contained in:
@@ -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.", "2"],
|
||||||
[0, 0, 0, "Styles should be written using objects.", "3"]
|
[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": [
|
"packages/grafana-runtime/src/analytics/types.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
"@locker/near-membrane-shared", // critical library. we need to bump this only intentionally
|
"@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
|
"@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/**"],
|
"ignorePaths": ["emails/**", "plugins-bundled/**", "**/mocks/**"],
|
||||||
"labels": ["area/frontend", "dependencies", "no-backport", "no-changelog"],
|
"labels": ["area/frontend", "dependencies", "no-backport", "no-changelog"],
|
||||||
"postUpdateOptions": ["yarnDedupeHighest"],
|
"postUpdateOptions": ["yarnDedupeHighest"],
|
||||||
|
|||||||
+4
-1
@@ -20,7 +20,7 @@ tsconfig.tsbuildinfo
|
|||||||
__debug_bin*
|
__debug_bin*
|
||||||
|
|
||||||
# Yarn
|
# Yarn
|
||||||
.yarn/*
|
.yarn/
|
||||||
!.yarn/patches
|
!.yarn/patches
|
||||||
!.yarn/releases
|
!.yarn/releases
|
||||||
!.yarn/plugins
|
!.yarn/plugins
|
||||||
@@ -200,3 +200,6 @@ deployment_tools_config.json
|
|||||||
|
|
||||||
# Temporary file for backporting PRs
|
# Temporary file for backporting PRs
|
||||||
.pr-body.txt
|
.pr-body.txt
|
||||||
|
|
||||||
|
# Core plugin builds
|
||||||
|
public/app/plugins/**/dist/
|
||||||
@@ -18,6 +18,7 @@ COPY package.json yarn.lock .yarnrc.yml ./
|
|||||||
COPY .yarn .yarn
|
COPY .yarn .yarn
|
||||||
COPY packages packages
|
COPY packages packages
|
||||||
COPY plugins-bundled plugins-bundled
|
COPY plugins-bundled plugins-bundled
|
||||||
|
COPY public public
|
||||||
|
|
||||||
RUN yarn install --immutable
|
RUN yarn install --immutable
|
||||||
|
|
||||||
|
|||||||
+8
-3
@@ -25,7 +25,7 @@
|
|||||||
"lint:sass": "yarn stylelint '{public/sass,packages}/**/*.scss' --cache",
|
"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%}",
|
"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",
|
"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:clean": "rimraf ./npm-artifacts && lerna run clean --parallel",
|
||||||
"packages:prepare": "lerna version --no-push --no-git-tag-version --force-publish --exact",
|
"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\"",
|
"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:merge": "betterer merge",
|
||||||
"betterer:stats": "ts-node --transpile-only --project ./scripts/cli/tsconfig.json ./scripts/cli/reportBettererStats.ts",
|
"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",
|
"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": {
|
"grafana": {
|
||||||
"whatsNewUrl": "https://grafana.com/docs/grafana/next/whatsnew/whats-new-in-v10-1/",
|
"whatsNewUrl": "https://grafana.com/docs/grafana/next/whatsnew/whats-new-in-v10-1/",
|
||||||
@@ -241,6 +244,7 @@
|
|||||||
"@emotion/react": "11.11.1",
|
"@emotion/react": "11.11.1",
|
||||||
"@fingerprintjs/fingerprintjs": "^3.4.2",
|
"@fingerprintjs/fingerprintjs": "^3.4.2",
|
||||||
"@glideapps/glide-data-grid": "^5.2.1",
|
"@glideapps/glide-data-grid": "^5.2.1",
|
||||||
|
"@grafana-plugins/grafana-testdata-datasource": "workspace:*",
|
||||||
"@grafana/aws-sdk": "0.1.3",
|
"@grafana/aws-sdk": "0.1.3",
|
||||||
"@grafana/data": "workspace:*",
|
"@grafana/data": "workspace:*",
|
||||||
"@grafana/e2e-selectors": "workspace:*",
|
"@grafana/e2e-selectors": "workspace:*",
|
||||||
@@ -434,7 +438,8 @@
|
|||||||
"workspaces": {
|
"workspaces": {
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*",
|
"packages/*",
|
||||||
"plugins-bundled/internal/*"
|
"plugins-bundled/internal/*",
|
||||||
|
"public/app/plugins/*/*"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export const DIST_DIR = 'dist';
|
||||||
@@ -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"
|
||||||
|
}
|
||||||
@@ -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", "."]
|
||||||
|
}
|
||||||
@@ -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';
|
||||||
@@ -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<Record<string, string>> {
|
||||||
|
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'));
|
||||||
|
}
|
||||||
@@ -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<Configuration> => {
|
||||||
|
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<Add an error for checking the basic structure of the repo>
|
||||||
|
{ 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;
|
||||||
Vendored
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
import * as common from '@grafana/schema';
|
import * as common from '@grafana/schema';
|
||||||
|
|
||||||
export const pluginVersion = "10.2.0-pre";
|
export const pluginVersion = "%VERSION%";
|
||||||
|
|
||||||
export enum TestDataQueryType {
|
export enum TestDataQueryType {
|
||||||
Annotations = 'annotations',
|
Annotations = 'annotations',
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ func DefaultService(cfg *config.Cfg) *Service {
|
|||||||
// Base returns the base path for the specified plugin.
|
// Base returns the base path for the specified plugin.
|
||||||
func (s *Service) Base(n PluginInfo) (string, error) {
|
func (s *Service) Base(n PluginInfo) (string, error) {
|
||||||
if n.class == plugins.ClassCore {
|
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) {
|
if s.cdn.PluginSupported(n.pluginJSON.ID) {
|
||||||
return s.cdn.AssetURL(n.pluginJSON.ID, n.pluginJSON.Info.Version, "")
|
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.
|
// Module returns the module.js path for the specified plugin.
|
||||||
func (s *Service) Module(n PluginInfo) (string, error) {
|
func (s *Service) Module(n PluginInfo) (string, error) {
|
||||||
if n.class == plugins.ClassCore {
|
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) {
|
if s.cdn.PluginSupported(n.pluginJSON.ID) {
|
||||||
return s.cdn.AssetURL(n.pluginJSON.ID, n.pluginJSON.Info.Version, "module.js")
|
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 {
|
func (s *Service) DefaultLogoPath(pluginType plugins.Type) string {
|
||||||
return path.Join("/", s.cfg.GrafanaAppSubURL, fmt.Sprintf("/public/img/icn-%s.svg", string(pluginType)))
|
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
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ const prometheusPlugin = async () =>
|
|||||||
const mssqlPlugin = async () =>
|
const mssqlPlugin = async () =>
|
||||||
await import(/* webpackChunkName: "mssqlPlugin" */ 'app/plugins/datasource/mssql/module');
|
await import(/* webpackChunkName: "mssqlPlugin" */ 'app/plugins/datasource/mssql/module');
|
||||||
const testDataDSPlugin = async () =>
|
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 () =>
|
const cloudMonitoringPlugin = async () =>
|
||||||
await import(/* webpackChunkName: "cloudMonitoringPlugin" */ 'app/plugins/datasource/cloud-monitoring/module');
|
await import(/* webpackChunkName: "cloudMonitoringPlugin" */ 'app/plugins/datasource/cloud-monitoring/module');
|
||||||
const azureMonitorPlugin = async () =>
|
const azureMonitorPlugin = async () =>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
SceneGridItem,
|
SceneGridItem,
|
||||||
PanelBuilders,
|
PanelBuilders,
|
||||||
} from '@grafana/scenes';
|
} 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';
|
import { DashboardScene } from '../../dashboard-scene/scene/DashboardScene';
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
SceneGridItem,
|
SceneGridItem,
|
||||||
PanelBuilders,
|
PanelBuilders,
|
||||||
} from '@grafana/scenes';
|
} 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';
|
import { DashboardScene } from '../../dashboard-scene/scene/DashboardScene';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { QueryRunnerState, SceneQueryRunner } from '@grafana/scenes';
|
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(
|
export function getQueryRunnerWithRandomWalkQuery(
|
||||||
overrides?: Partial<TestData>,
|
overrides?: Partial<TestData>,
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# TS generate from cue by cuetsy
|
||||||
|
**/*.gen.ts
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Changelog
|
||||||
@@ -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.
|
||||||
@@ -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"
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
"name": "TestData",
|
"name": "TestData",
|
||||||
"id": "grafana-testdata-datasource",
|
"id": "grafana-testdata-datasource",
|
||||||
"aliasIDs": ["testdata"],
|
"aliasIDs": ["testdata"],
|
||||||
|
"executable": "gpx_testdata",
|
||||||
|
|
||||||
"metrics": true,
|
"metrics": true,
|
||||||
"logs": true,
|
"logs": true,
|
||||||
@@ -24,7 +25,8 @@
|
|||||||
"logos": {
|
"logos": {
|
||||||
"small": "img/testdata.svg",
|
"small": "img/testdata.svg",
|
||||||
"large": "img/testdata.svg"
|
"large": "img/testdata.svg"
|
||||||
}
|
},
|
||||||
|
"version": "%VERSION%"
|
||||||
},
|
},
|
||||||
|
|
||||||
"includes": [
|
"includes": [
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"extends": "@grafana/plugin-configs/tsconfig.json",
|
||||||
|
"include": ["."]
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import config from '@grafana/plugin-configs/webpack.config';
|
||||||
|
|
||||||
|
export default config;
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
PACKAGES=$(ls -d ./packages/*/)
|
PACKAGES=$(ls -d ./packages/*/)
|
||||||
EXIT_CODE=0
|
EXIT_CODE=0
|
||||||
GITHUB_MESSAGE=""
|
GITHUB_MESSAGE=""
|
||||||
|
SKIP_PACKAGES=("grafana-eslint-rules" "grafana-plugin-configs")
|
||||||
|
|
||||||
# Loop through the packages
|
# Loop through the packages
|
||||||
while IFS=" " read -r -a package; do
|
while IFS=" " read -r -a package; do
|
||||||
@@ -16,7 +17,7 @@ while IFS=" " read -r -a package; do
|
|||||||
CURRENT="./pr/$PACKAGE_PATH"
|
CURRENT="./pr/$PACKAGE_PATH"
|
||||||
|
|
||||||
# Temporarily skipping these packages as they don't have any exposed static typing
|
# 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
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -23,5 +23,6 @@
|
|||||||
"public/vendor/**/*.ts",
|
"public/vendor/**/*.ts",
|
||||||
"packages/grafana-data/typings",
|
"packages/grafana-data/typings",
|
||||||
"packages/grafana-ui/src/types"
|
"packages/grafana-ui/src/types"
|
||||||
]
|
],
|
||||||
|
"exclude": ["public/app/**/webpack.config.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2834,6 +2834,38 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
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":
|
"@grafana-plugins/input-datasource@workspace:plugins-bundled/internal/input-datasource":
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@grafana-plugins/input-datasource@workspace:plugins-bundled/internal/input-datasource"
|
resolution: "@grafana-plugins/input-datasource@workspace:plugins-bundled/internal/input-datasource"
|
||||||
@@ -3193,7 +3225,22 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
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
|
version: 0.0.0-use.local
|
||||||
resolution: "@grafana/runtime@workspace:packages/grafana-runtime"
|
resolution: "@grafana/runtime@workspace:packages/grafana-runtime"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -8368,6 +8415,15 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
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":
|
"@testing-library/user-event@npm:14.5.1":
|
||||||
version: 14.5.1
|
version: 14.5.1
|
||||||
resolution: "@testing-library/user-event@npm:14.5.1"
|
resolution: "@testing-library/user-event@npm:14.5.1"
|
||||||
@@ -9350,6 +9406,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
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":
|
"@types/node@npm:^14.14.31":
|
||||||
version: 14.18.36
|
version: 14.18.36
|
||||||
resolution: "@types/node@npm:14.18.36"
|
resolution: "@types/node@npm:14.18.36"
|
||||||
@@ -9774,7 +9837,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
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
|
version: 5.14.8
|
||||||
resolution: "@types/testing-library__jest-dom@npm:5.14.8"
|
resolution: "@types/testing-library__jest-dom@npm:5.14.8"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -9783,6 +9846,15 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
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":
|
"@types/tinycolor2@npm:1.4.3":
|
||||||
version: 1.4.3
|
version: 1.4.3
|
||||||
resolution: "@types/tinycolor2@npm:1.4.3"
|
resolution: "@types/tinycolor2@npm:1.4.3"
|
||||||
@@ -17675,6 +17747,7 @@ __metadata:
|
|||||||
"@emotion/react": 11.11.1
|
"@emotion/react": 11.11.1
|
||||||
"@fingerprintjs/fingerprintjs": ^3.4.2
|
"@fingerprintjs/fingerprintjs": ^3.4.2
|
||||||
"@glideapps/glide-data-grid": ^5.2.1
|
"@glideapps/glide-data-grid": ^5.2.1
|
||||||
|
"@grafana-plugins/grafana-testdata-datasource": "workspace:*"
|
||||||
"@grafana/aws-sdk": 0.1.3
|
"@grafana/aws-sdk": 0.1.3
|
||||||
"@grafana/data": "workspace:*"
|
"@grafana/data": "workspace:*"
|
||||||
"@grafana/e2e-selectors": "workspace:*"
|
"@grafana/e2e-selectors": "workspace:*"
|
||||||
@@ -26253,6 +26326,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
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":
|
"request-progress@npm:^3.0.0":
|
||||||
version: 3.0.0
|
version: 3.0.0
|
||||||
resolution: "request-progress@npm:3.0.0"
|
resolution: "request-progress@npm:3.0.0"
|
||||||
@@ -28260,7 +28340,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"swc-loader@npm:^0.2.3":
|
"swc-loader@npm:0.2.3, swc-loader@npm:^0.2.3":
|
||||||
version: 0.2.3
|
version: 0.2.3
|
||||||
resolution: "swc-loader@npm:0.2.3"
|
resolution: "swc-loader@npm:0.2.3"
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
|
|||||||
Reference in New Issue
Block a user