@grafana/create-plugin 6.1.1 → 6.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -1
- package/dist/constants.js +2 -10
- package/dist/utils/utils.config.js +4 -4
- package/dist/utils/utils.templates.js +7 -15
- package/dist/utils/utils.version.js +4 -10
- package/package.json +2 -2
- package/src/constants.ts +2 -10
- package/src/types.ts +0 -2
- package/src/utils/utils.config.ts +5 -5
- package/src/utils/utils.templates.ts +13 -22
- package/templates/common/_package.json +8 -12
- package/templates/common/npmrc +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
+
# v6.1.2 (Tue Oct 21 2025)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- Create Plugin: Remove cypress support [#2232](https://github.com/grafana/plugin-tools/pull/2232) ([@sunker](https://github.com/sunker))
|
|
6
|
+
- Update dependency @grafana/e2e-selectors to v12.2.0 [#2205](https://github.com/grafana/plugin-tools/pull/2205) ([@renovate[bot]](https://github.com/renovate[bot]) [@leventebalogh](https://github.com/leventebalogh) [@mckn](https://github.com/mckn))
|
|
7
|
+
|
|
8
|
+
#### Authors: 4
|
|
9
|
+
|
|
10
|
+
- [@renovate[bot]](https://github.com/renovate[bot])
|
|
11
|
+
- Erik Sundell ([@sunker](https://github.com/sunker))
|
|
12
|
+
- Levente Balogh ([@leventebalogh](https://github.com/leventebalogh))
|
|
13
|
+
- Marcus Andersson ([@mckn](https://github.com/mckn))
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
1
17
|
# v6.1.1 (Wed Oct 15 2025)
|
|
2
18
|
|
|
3
19
|
#### 🐛 Bug Fix
|
|
4
20
|
|
|
5
|
-
- Fix: Use proper install command for legacy plugin migrations [#2221](https://github.com/grafana/plugin-tools/pull/2221) ([@sunker]
|
|
21
|
+
- Fix: Use proper install command for legacy plugin migrations [#2221](https://github.com/grafana/plugin-tools/pull/2221) ([@sunker]https://github.com/sunker))
|
|
6
22
|
|
|
7
23
|
#### Authors: 1
|
|
8
24
|
|
package/dist/constants.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
1
|
import { fileURLToPath } from 'node:url';
|
|
2
|
+
import path from 'node:path';
|
|
3
3
|
|
|
4
4
|
const __dirname = fileURLToPath(new URL(".", import.meta.url));
|
|
5
5
|
const IS_DEV = process.env.CREATE_PLUGIN_DEV !== void 0;
|
|
@@ -32,18 +32,10 @@ const EXTRA_TEMPLATE_VARIABLES = {
|
|
|
32
32
|
const DEFAULT_FEATURE_FLAGS = {
|
|
33
33
|
useReactRouterV6: true,
|
|
34
34
|
bundleGrafanaUI: false,
|
|
35
|
-
usePlaywright: true,
|
|
36
35
|
useExperimentalRspack: false,
|
|
37
36
|
useExperimentalUpdates: true
|
|
38
37
|
};
|
|
39
|
-
const GRAFANA_FE_PACKAGES = [
|
|
40
|
-
"@grafana/data",
|
|
41
|
-
"@grafana/e2e-selectors",
|
|
42
|
-
"@grafana/e2e",
|
|
43
|
-
"@grafana/runtime",
|
|
44
|
-
"@grafana/schema",
|
|
45
|
-
"@grafana/ui"
|
|
46
|
-
];
|
|
38
|
+
const GRAFANA_FE_PACKAGES = ["@grafana/data", "@grafana/runtime", "@grafana/schema", "@grafana/ui"];
|
|
47
39
|
const MIGRATION_CONFIG = {
|
|
48
40
|
// Files that should be overriden during a migration.
|
|
49
41
|
// (paths are relative to the scaffolded projects root)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import { writeFile } from 'node:fs/promises';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { CURRENT_APP_VERSION } from './utils.version.js';
|
|
5
1
|
import { argv, commandName } from './utils.cli.js';
|
|
2
|
+
import { CURRENT_APP_VERSION } from './utils.version.js';
|
|
6
3
|
import { DEFAULT_FEATURE_FLAGS } from '../constants.js';
|
|
4
|
+
import fs from 'node:fs';
|
|
7
5
|
import { output } from './utils.console.js';
|
|
8
6
|
import { partitionArr } from './utils.helpers.js';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { writeFile } from 'node:fs/promises';
|
|
9
9
|
|
|
10
10
|
let hasShownConfigWarnings = false;
|
|
11
11
|
function getConfig(workDir = process.cwd()) {
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { glob } from 'glob';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import fs from 'node:fs';
|
|
1
|
+
import { DEFAULT_FEATURE_FLAGS, EXTRA_TEMPLATE_VARIABLES, PLUGIN_TYPES, TEMPLATE_PATHS, EXPORT_PATH_PREFIX } from '../constants.js';
|
|
5
2
|
import { isFile, getExportFileName, filterOutCommonFiles, isFileStartingWith } from './utils.files.js';
|
|
3
|
+
import { getPackageManagerFromUserAgent, getPackageManagerInstallCmd, getPackageManagerWithFallback } from './utils.packageManager.js';
|
|
6
4
|
import { normalizeId, renderHandlebarsTemplate } from './utils.handlebars.js';
|
|
7
|
-
import {
|
|
5
|
+
import { CURRENT_APP_VERSION } from './utils.version.js';
|
|
8
6
|
import { debug } from './utils.cli.js';
|
|
9
|
-
import
|
|
10
|
-
import { getPackageManagerFromUserAgent, getPackageManagerInstallCmd, getPackageManagerWithFallback } from './utils.packageManager.js';
|
|
11
|
-
import { getGrafanaRuntimeVersion, CURRENT_APP_VERSION } from './utils.version.js';
|
|
7
|
+
import fs from 'node:fs';
|
|
12
8
|
import { getConfig } from './utils.config.js';
|
|
9
|
+
import { getPluginJson } from './utils.plugin.js';
|
|
10
|
+
import { glob } from 'glob';
|
|
11
|
+
import path from 'node:path';
|
|
13
12
|
|
|
14
13
|
const templatesDebugger = debug.extend("templates");
|
|
15
14
|
function getTemplateFiles(pluginType, filter) {
|
|
@@ -57,9 +56,6 @@ function renderTemplateFromFile(templateFile, data) {
|
|
|
57
56
|
function getTemplateData(cliArgs) {
|
|
58
57
|
const { features } = getConfig();
|
|
59
58
|
const currentVersion = CURRENT_APP_VERSION;
|
|
60
|
-
const grafanaVersion = getGrafanaRuntimeVersion();
|
|
61
|
-
const usePlaywright = features.usePlaywright === true || isFile(path.join(process.cwd(), "playwright.config.ts"));
|
|
62
|
-
const useCypress = !usePlaywright && lt(grafanaVersion, "11.0.0") && fs.existsSync(path.join(process.cwd(), "cypress"));
|
|
63
59
|
const bundleGrafanaUI = features.bundleGrafanaUI ?? DEFAULT_FEATURE_FLAGS.bundleGrafanaUI;
|
|
64
60
|
const getReactRouterVersion = () => features.useReactRouterV6 ? "6.22.0" : "5.2.0";
|
|
65
61
|
const isAppType = (pluginType) => pluginType === PLUGIN_TYPES.app || pluginType === PLUGIN_TYPES.scenes;
|
|
@@ -86,8 +82,6 @@ function getTemplateData(cliArgs) {
|
|
|
86
82
|
useReactRouterV6: features.useReactRouterV6 ?? DEFAULT_FEATURE_FLAGS.useReactRouterV6,
|
|
87
83
|
reactRouterVersion: getReactRouterVersion(),
|
|
88
84
|
scenesVersion: features.useReactRouterV6 ? "^6.10.4" : "^5.41.3",
|
|
89
|
-
usePlaywright,
|
|
90
|
-
useCypress,
|
|
91
85
|
useExperimentalRspack: Boolean(features.useExperimentalRspack),
|
|
92
86
|
frontendBundler
|
|
93
87
|
};
|
|
@@ -111,8 +105,6 @@ function getTemplateData(cliArgs) {
|
|
|
111
105
|
useReactRouterV6: features.useReactRouterV6 ?? DEFAULT_FEATURE_FLAGS.useReactRouterV6,
|
|
112
106
|
reactRouterVersion: getReactRouterVersion(),
|
|
113
107
|
scenesVersion: features.useReactRouterV6 ? "^6.10.4" : "^5.41.3",
|
|
114
|
-
usePlaywright,
|
|
115
|
-
useCypress,
|
|
116
108
|
pluginExecutable: pluginJson.executable,
|
|
117
109
|
useExperimentalRspack: Boolean(features.useExperimentalRspack),
|
|
118
110
|
frontendBundler
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import 'node:fs';
|
|
2
|
+
import 'node:path';
|
|
3
3
|
import { getVersion } from '../libs/version/src/index.js';
|
|
4
|
-
import
|
|
4
|
+
import '../constants.js';
|
|
5
5
|
|
|
6
6
|
const CURRENT_APP_VERSION = getVersion();
|
|
7
|
-
function getGrafanaRuntimeVersion() {
|
|
8
|
-
const packageJsonPath = path.join(TEMPLATE_PATHS.common, "_package.json");
|
|
9
|
-
const pkg = readFileSync(packageJsonPath, "utf8");
|
|
10
|
-
const { version } = /\"(@grafana\/runtime)\":\s\"\^(?<version>.*)\"/.exec(pkg)?.groups ?? {};
|
|
11
|
-
return version;
|
|
12
|
-
}
|
|
13
7
|
|
|
14
|
-
export { CURRENT_APP_VERSION
|
|
8
|
+
export { CURRENT_APP_VERSION };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"directory": "packages/create-plugin",
|
|
6
6
|
"url": "https://github.com/grafana/plugin-tools"
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=20"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "2922302c07d4bee23f4b4f13abafeef3274f4c30"
|
|
65
65
|
}
|
package/src/constants.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
1
|
import { fileURLToPath } from 'node:url';
|
|
2
|
+
import path from 'node:path';
|
|
3
3
|
|
|
4
4
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
5
5
|
|
|
@@ -51,19 +51,11 @@ export const EXTRA_TEMPLATE_VARIABLES = {
|
|
|
51
51
|
export const DEFAULT_FEATURE_FLAGS = {
|
|
52
52
|
useReactRouterV6: true,
|
|
53
53
|
bundleGrafanaUI: false,
|
|
54
|
-
usePlaywright: true,
|
|
55
54
|
useExperimentalRspack: false,
|
|
56
55
|
useExperimentalUpdates: true,
|
|
57
56
|
};
|
|
58
57
|
|
|
59
|
-
export const GRAFANA_FE_PACKAGES = [
|
|
60
|
-
'@grafana/data',
|
|
61
|
-
'@grafana/e2e-selectors',
|
|
62
|
-
'@grafana/e2e',
|
|
63
|
-
'@grafana/runtime',
|
|
64
|
-
'@grafana/schema',
|
|
65
|
-
'@grafana/ui',
|
|
66
|
-
];
|
|
58
|
+
export const GRAFANA_FE_PACKAGES = ['@grafana/data', '@grafana/runtime', '@grafana/schema', '@grafana/ui'];
|
|
67
59
|
|
|
68
60
|
export const MIGRATION_CONFIG = {
|
|
69
61
|
// Files that should be overriden during a migration.
|
package/src/types.ts
CHANGED
|
@@ -25,8 +25,6 @@ export type TemplateData = {
|
|
|
25
25
|
useReactRouterV6: boolean;
|
|
26
26
|
scenesVersion: string;
|
|
27
27
|
reactRouterVersion: string;
|
|
28
|
-
usePlaywright: boolean;
|
|
29
|
-
useCypress: boolean;
|
|
30
28
|
useExperimentalRspack: boolean;
|
|
31
29
|
pluginExecutable?: string;
|
|
32
30
|
frontendBundler: 'webpack' | 'rspack';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import { writeFile } from 'node:fs/promises';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { CURRENT_APP_VERSION } from './utils.version.js';
|
|
5
1
|
import { argv, commandName } from './utils.cli.js';
|
|
2
|
+
|
|
3
|
+
import { CURRENT_APP_VERSION } from './utils.version.js';
|
|
6
4
|
import { DEFAULT_FEATURE_FLAGS } from '../constants.js';
|
|
5
|
+
import fs from 'node:fs';
|
|
7
6
|
import { output } from './utils.console.js';
|
|
8
7
|
import { partitionArr } from './utils.helpers.js';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
import { writeFile } from 'node:fs/promises';
|
|
9
10
|
|
|
10
11
|
export type FeatureFlags = {
|
|
11
12
|
bundleGrafanaUI?: boolean;
|
|
@@ -13,7 +14,6 @@ export type FeatureFlags = {
|
|
|
13
14
|
// If set to true, the plugin will be scaffolded with React Router v6. Defaults to true.
|
|
14
15
|
// (Attention! We always scaffold new projects with React Router v6, so if you are changing this to `false` manually you will need to make changes to the React code as well.)
|
|
15
16
|
useReactRouterV6?: boolean;
|
|
16
|
-
usePlaywright?: boolean;
|
|
17
17
|
useExperimentalRspack?: boolean;
|
|
18
18
|
useExperimentalUpdates?: boolean;
|
|
19
19
|
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { lt as semverLt } from 'semver';
|
|
2
|
-
import { glob } from 'glob';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import fs from 'node:fs';
|
|
5
|
-
import { filterOutCommonFiles, isFile, isFileStartingWith } from './utils.files.js';
|
|
6
|
-
import { normalizeId, renderHandlebarsTemplate } from './utils.handlebars.js';
|
|
7
|
-
import { getPluginJson } from './utils.plugin.js';
|
|
8
|
-
import { debug } from './utils.cli.js';
|
|
9
1
|
import {
|
|
10
|
-
|
|
2
|
+
DEFAULT_FEATURE_FLAGS,
|
|
11
3
|
EXPORT_PATH_PREFIX,
|
|
12
4
|
EXTRA_TEMPLATE_VARIABLES,
|
|
13
5
|
PLUGIN_TYPES,
|
|
14
|
-
|
|
6
|
+
TEMPLATE_PATHS,
|
|
15
7
|
} from '../constants.js';
|
|
16
8
|
import { GenerateCliArgs, TemplateData } from '../types.js';
|
|
9
|
+
import { filterOutCommonFiles, isFile, isFileStartingWith } from './utils.files.js';
|
|
17
10
|
import {
|
|
11
|
+
getPackageManagerFromUserAgent,
|
|
18
12
|
getPackageManagerInstallCmd,
|
|
19
13
|
getPackageManagerWithFallback,
|
|
20
|
-
getPackageManagerFromUserAgent,
|
|
21
14
|
} from './utils.packageManager.js';
|
|
22
|
-
import {
|
|
23
|
-
|
|
15
|
+
import { normalizeId, renderHandlebarsTemplate } from './utils.handlebars.js';
|
|
16
|
+
|
|
17
|
+
import { CURRENT_APP_VERSION } from './utils.version.js';
|
|
18
|
+
import { debug } from './utils.cli.js';
|
|
19
|
+
import fs from 'node:fs';
|
|
24
20
|
import { getConfig } from './utils.config.js';
|
|
21
|
+
import { getExportFileName } from '../utils/utils.files.js';
|
|
22
|
+
import { getPluginJson } from './utils.plugin.js';
|
|
23
|
+
import { glob } from 'glob';
|
|
24
|
+
import path from 'node:path';
|
|
25
25
|
|
|
26
26
|
const templatesDebugger = debug.extend('templates');
|
|
27
27
|
|
|
@@ -95,11 +95,6 @@ export function renderTemplateFromFile(templateFile: string, data?: any) {
|
|
|
95
95
|
export function getTemplateData(cliArgs?: GenerateCliArgs): TemplateData {
|
|
96
96
|
const { features } = getConfig();
|
|
97
97
|
const currentVersion = CURRENT_APP_VERSION;
|
|
98
|
-
const grafanaVersion = getGrafanaRuntimeVersion();
|
|
99
|
-
const usePlaywright = features.usePlaywright === true || isFile(path.join(process.cwd(), 'playwright.config.ts'));
|
|
100
|
-
//@grafana/e2e was deprecated in Grafana 11
|
|
101
|
-
const useCypress =
|
|
102
|
-
!usePlaywright && semverLt(grafanaVersion, '11.0.0') && fs.existsSync(path.join(process.cwd(), 'cypress'));
|
|
103
98
|
const bundleGrafanaUI = features.bundleGrafanaUI ?? DEFAULT_FEATURE_FLAGS.bundleGrafanaUI;
|
|
104
99
|
const getReactRouterVersion = () => (features.useReactRouterV6 ? '6.22.0' : '5.2.0');
|
|
105
100
|
const isAppType = (pluginType: string) => pluginType === PLUGIN_TYPES.app || pluginType === PLUGIN_TYPES.scenes;
|
|
@@ -130,8 +125,6 @@ export function getTemplateData(cliArgs?: GenerateCliArgs): TemplateData {
|
|
|
130
125
|
useReactRouterV6: features.useReactRouterV6 ?? DEFAULT_FEATURE_FLAGS.useReactRouterV6,
|
|
131
126
|
reactRouterVersion: getReactRouterVersion(),
|
|
132
127
|
scenesVersion: features.useReactRouterV6 ? '^6.10.4' : '^5.41.3',
|
|
133
|
-
usePlaywright,
|
|
134
|
-
useCypress,
|
|
135
128
|
useExperimentalRspack: Boolean(features.useExperimentalRspack),
|
|
136
129
|
frontendBundler,
|
|
137
130
|
};
|
|
@@ -158,8 +151,6 @@ export function getTemplateData(cliArgs?: GenerateCliArgs): TemplateData {
|
|
|
158
151
|
useReactRouterV6: features.useReactRouterV6 ?? DEFAULT_FEATURE_FLAGS.useReactRouterV6,
|
|
159
152
|
reactRouterVersion: getReactRouterVersion(),
|
|
160
153
|
scenesVersion: features.useReactRouterV6 ? '^6.10.4' : '^5.41.3',
|
|
161
|
-
usePlaywright,
|
|
162
|
-
useCypress,
|
|
163
154
|
pluginExecutable: pluginJson.executable,
|
|
164
155
|
useExperimentalRspack: Boolean(features.useExperimentalRspack),
|
|
165
156
|
frontendBundler,
|
|
@@ -8,22 +8,18 @@
|
|
|
8
8
|
"test:ci": "jest --passWithNoTests --maxWorkers 4",
|
|
9
9
|
"typecheck": "tsc --noEmit",
|
|
10
10
|
"lint": "eslint --cache .",
|
|
11
|
-
"lint:fix": "{{ packageManagerName }} run lint{{#if isNPM}} --{{/if}} --fix && prettier --write --list-different .",
|
|
12
|
-
"e2e": "playwright test",
|
|
13
|
-
"e2e": "{{ packageManagerName }} exec cypress install && {{ packageManagerName }} exec grafana-e2e run",
|
|
14
|
-
"e2e:update": "{{ packageManagerName }} exec cypress install && {{ packageManagerName }} exec grafana-e2e run --update-screenshots",{{/if}}
|
|
11
|
+
"lint:fix": "{{ packageManagerName }} run lint{{#if isNPM}} --{{/if}} --fix && prettier --write --list-different .",
|
|
12
|
+
"e2e": "playwright test",
|
|
15
13
|
"server": "docker compose up --build",
|
|
16
14
|
"sign": "npx --yes @grafana/sign-plugin@latest"
|
|
17
15
|
},
|
|
18
16
|
"author": "{{ sentenceCase orgName }}",
|
|
19
17
|
"license": "Apache-2.0",
|
|
20
18
|
"devDependencies": {
|
|
21
|
-
|
|
22
|
-
"@grafana/e2e
|
|
23
|
-
"@grafana/
|
|
24
|
-
"@
|
|
25
|
-
"@grafana/tsconfig": "^2.0.0",{{#if usePlaywright}}
|
|
26
|
-
"@playwright/test": "^1.52.0",{{/if}}{{#if useExperimentalRspack}}
|
|
19
|
+
"@grafana/eslint-config": "^8.2.0",
|
|
20
|
+
"@grafana/plugin-e2e": "^2.2.0",
|
|
21
|
+
"@grafana/tsconfig": "^2.0.0",
|
|
22
|
+
"@playwright/test": "^1.52.0",{{#if useExperimentalRspack}}
|
|
27
23
|
"@rspack/core": "^1.3.0",
|
|
28
24
|
"@rspack/cli": "^1.3.0",{{/if}}
|
|
29
25
|
"@stylistic/eslint-plugin-ts": "^2.9.0",
|
|
@@ -56,8 +52,8 @@
|
|
|
56
52
|
"replace-in-file-webpack-plugin": "^1.0.6",{{#if useExperimentalRspack}}
|
|
57
53
|
"rspack-plugin-virtual-module": "^0.1.13",{{/if}}
|
|
58
54
|
"sass": "1.63.2",
|
|
59
|
-
"sass-loader": "13.3.1",
|
|
60
|
-
"semver": "^7.6.3",
|
|
55
|
+
"sass-loader": "13.3.1",
|
|
56
|
+
"semver": "^7.6.3",
|
|
61
57
|
"style-loader": "3.3.3",{{#unless useExperimentalRspack}}
|
|
62
58
|
"swc-loader": "^0.2.3",{{/unless}}
|
|
63
59
|
"terser-webpack-plugin": "^5.3.10",
|
package/templates/common/npmrc
CHANGED
|
@@ -10,6 +10,3 @@ public-hoist-pattern[]="*prettier*"
|
|
|
10
10
|
# Hoist all types packages to the root for better TS support
|
|
11
11
|
public-hoist-pattern[]="@types/*"
|
|
12
12
|
public-hoist-pattern[]="*terser-webpack-plugin*"
|
|
13
|
-
{{#unless usePlaywright}}
|
|
14
|
-
# @grafana/e2e expects cypress to exist in the root of the node_modules directory
|
|
15
|
-
public-hoist-pattern[]="*cypress*"{{/unless}}
|