@grafana/create-plugin 4.10.4 → 4.10.5-canary.920.29fa67c.0
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { lt as semverLt } from 'semver';
|
|
1
2
|
import { glob } from 'glob';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import fs from 'node:fs';
|
|
@@ -57,15 +58,14 @@ export function renderTemplateFromFile(templateFile, data) {
|
|
|
57
58
|
export function getTemplateData(cliArgs) {
|
|
58
59
|
const { features } = getConfig();
|
|
59
60
|
const currentVersion = getVersion();
|
|
61
|
+
const grafanaVersion = EXTRA_TEMPLATE_VARIABLES.grafanaVersion;
|
|
60
62
|
const usePlaywright = features.usePlaywright === true || isFile(path.join(process.cwd(), 'playwright.config.ts'));
|
|
63
|
+
const useCypress = !usePlaywright && semverLt(grafanaVersion, '11.0.0') && fs.existsSync(path.join(process.cwd(), 'cypress'));
|
|
61
64
|
const bundleGrafanaUI = features.bundleGrafanaUI ?? DEFAULT_FEATURE_FLAGS.bundleGrafanaUI;
|
|
62
65
|
const shouldUseReactRouterV6 = (pluginType) => features.useReactRouterV6 === true && pluginType === PLUGIN_TYPES.app;
|
|
63
66
|
const getReactRouterVersion = (pluginType) => (shouldUseReactRouterV6(pluginType) ? '6.22.0' : '5.2.0');
|
|
64
67
|
const isAppType = (pluginType) => pluginType === PLUGIN_TYPES.app || pluginType === PLUGIN_TYPES.scenes;
|
|
65
68
|
const isNPM = (packageManagerName) => packageManagerName === 'npm';
|
|
66
|
-
const getE2eTestCmd = (packageManagerName) => usePlaywright
|
|
67
|
-
? 'playwright test'
|
|
68
|
-
: `${packageManagerName} exec cypress install && ${packageManagerName} exec grafana-e2e run`;
|
|
69
69
|
let templateData;
|
|
70
70
|
if (cliArgs) {
|
|
71
71
|
const { packageManagerName, packageManagerVersion } = getPackageManagerFromUserAgent();
|
|
@@ -87,7 +87,7 @@ export function getTemplateData(cliArgs) {
|
|
|
87
87
|
useReactRouterV6: shouldUseReactRouterV6(cliArgs.pluginType),
|
|
88
88
|
reactRouterVersion: getReactRouterVersion(cliArgs.pluginType),
|
|
89
89
|
usePlaywright,
|
|
90
|
-
|
|
90
|
+
useCypress,
|
|
91
91
|
hasGithubWorkflows: cliArgs.hasGithubWorkflows,
|
|
92
92
|
hasGithubLevitateWorkflow: cliArgs.hasGithubLevitateWorkflow,
|
|
93
93
|
};
|
|
@@ -114,7 +114,7 @@ export function getTemplateData(cliArgs) {
|
|
|
114
114
|
useReactRouterV6: shouldUseReactRouterV6(pluginJson.type),
|
|
115
115
|
reactRouterVersion: getReactRouterVersion(pluginJson.type),
|
|
116
116
|
usePlaywright,
|
|
117
|
-
|
|
117
|
+
useCypress,
|
|
118
118
|
hasGithubWorkflows: isFile(path.join(githubFolder, 'ci.yml')),
|
|
119
119
|
hasGithubLevitateWorkflow: isFile(path.join(githubFolder, 'is-compatible.yml')),
|
|
120
120
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "4.10.
|
|
3
|
+
"version": "4.10.5-canary.920.29fa67c.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"directory": "packages/create-plugin",
|
|
6
6
|
"url": "https://github.com/grafana/plugin-tools"
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"engines": {
|
|
88
88
|
"node": ">=20"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "29fa67c812082a97233d84d225b740c493584fb4"
|
|
91
91
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { lt as semverLt } from 'semver';
|
|
1
2
|
import { glob } from 'glob';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import fs from 'node:fs';
|
|
@@ -95,17 +96,17 @@ export function renderTemplateFromFile(templateFile: string, data?: any) {
|
|
|
95
96
|
export function getTemplateData(cliArgs?: GenerateCliArgs): TemplateData {
|
|
96
97
|
const { features } = getConfig();
|
|
97
98
|
const currentVersion = getVersion();
|
|
99
|
+
const grafanaVersion = EXTRA_TEMPLATE_VARIABLES.grafanaVersion;
|
|
98
100
|
const usePlaywright = features.usePlaywright === true || isFile(path.join(process.cwd(), 'playwright.config.ts'));
|
|
101
|
+
//@grafana/e2e was deprecated in Grafana 11
|
|
102
|
+
const useCypress =
|
|
103
|
+
!usePlaywright && semverLt(grafanaVersion, '11.0.0') && fs.existsSync(path.join(process.cwd(), 'cypress'));
|
|
99
104
|
const bundleGrafanaUI = features.bundleGrafanaUI ?? DEFAULT_FEATURE_FLAGS.bundleGrafanaUI;
|
|
100
105
|
const shouldUseReactRouterV6 = (pluginType: string) =>
|
|
101
106
|
features.useReactRouterV6 === true && pluginType === PLUGIN_TYPES.app;
|
|
102
107
|
const getReactRouterVersion = (pluginType: string) => (shouldUseReactRouterV6(pluginType) ? '6.22.0' : '5.2.0');
|
|
103
108
|
const isAppType = (pluginType: string) => pluginType === PLUGIN_TYPES.app || pluginType === PLUGIN_TYPES.scenes;
|
|
104
109
|
const isNPM = (packageManagerName: string) => packageManagerName === 'npm';
|
|
105
|
-
const getE2eTestCmd = (packageManagerName: string) =>
|
|
106
|
-
usePlaywright
|
|
107
|
-
? 'playwright test'
|
|
108
|
-
: `${packageManagerName} exec cypress install && ${packageManagerName} exec grafana-e2e run`;
|
|
109
110
|
|
|
110
111
|
let templateData: TemplateData;
|
|
111
112
|
|
|
@@ -131,7 +132,7 @@ export function getTemplateData(cliArgs?: GenerateCliArgs): TemplateData {
|
|
|
131
132
|
useReactRouterV6: shouldUseReactRouterV6(cliArgs.pluginType),
|
|
132
133
|
reactRouterVersion: getReactRouterVersion(cliArgs.pluginType),
|
|
133
134
|
usePlaywright,
|
|
134
|
-
|
|
135
|
+
useCypress,
|
|
135
136
|
hasGithubWorkflows: cliArgs.hasGithubWorkflows,
|
|
136
137
|
hasGithubLevitateWorkflow: cliArgs.hasGithubLevitateWorkflow,
|
|
137
138
|
};
|
|
@@ -160,7 +161,7 @@ export function getTemplateData(cliArgs?: GenerateCliArgs): TemplateData {
|
|
|
160
161
|
useReactRouterV6: shouldUseReactRouterV6(pluginJson.type),
|
|
161
162
|
reactRouterVersion: getReactRouterVersion(pluginJson.type),
|
|
162
163
|
usePlaywright,
|
|
163
|
-
|
|
164
|
+
useCypress,
|
|
164
165
|
hasGithubWorkflows: isFile(path.join(githubFolder, 'ci.yml')),
|
|
165
166
|
hasGithubLevitateWorkflow: isFile(path.join(githubFolder, 'is-compatible.yml')),
|
|
166
167
|
};
|
|
@@ -9,20 +9,21 @@
|
|
|
9
9
|
"test:ci": "jest --passWithNoTests --maxWorkers 4",
|
|
10
10
|
"typecheck": "tsc --noEmit",
|
|
11
11
|
"lint": "eslint --cache --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx .",
|
|
12
|
-
"lint:fix": "{{ packageManagerName }} run lint{{#if isNPM}} --{{/if}} --fix",
|
|
13
|
-
"e2e": "{{
|
|
14
|
-
"e2e
|
|
12
|
+
"lint:fix": "{{ packageManagerName }} run lint{{#if isNPM}} --{{/if}} --fix",{{#if usePlaywright}}
|
|
13
|
+
"e2e": "playwright test",{{/if}}{{#if useCypress}}
|
|
14
|
+
"e2e": "{{ packageManagerName }} exec cypress install && {{ packageManagerName }} exec grafana-e2e run",
|
|
15
|
+
"e2e:update": "{{ packageManagerName }} exec cypress install && {{ packageManagerName }} exec grafana-e2e run --update-screenshots",{{/if}}
|
|
15
16
|
"server": "docker-compose up --build",
|
|
16
17
|
"sign": "npx --yes @grafana/sign-plugin@latest"
|
|
17
18
|
},
|
|
18
19
|
"author": "{{ sentenceCase orgName }}",
|
|
19
20
|
"license": "Apache-2.0",
|
|
20
21
|
"devDependencies": {
|
|
21
|
-
"@babel/core": "^7.21.4",{{#
|
|
22
|
+
"@babel/core": "^7.21.4",{{#if useCypress}}
|
|
22
23
|
"@grafana/e2e": "{{ grafanaVersion }}",
|
|
23
|
-
"@grafana/e2e-selectors": "{{ grafanaVersion }}",{{/
|
|
24
|
+
"@grafana/e2e-selectors": "{{ grafanaVersion }}",{{/if}}
|
|
24
25
|
"@grafana/eslint-config": "^7.0.0",{{#if usePlaywright}}
|
|
25
|
-
"@grafana/plugin-e2e": "^1.0
|
|
26
|
+
"@grafana/plugin-e2e": "^1.2.0",{{/if}}
|
|
26
27
|
"@grafana/tsconfig": "^1.2.0-rc1",
|
|
27
28
|
"@grafana/plugin-meta-extractor": "^0.0.2",{{#if usePlaywright}}
|
|
28
29
|
"@playwright/test": "^1.41.2",{{/if}}
|