Skip to content

Commit 4cede43

Browse files
authored
Create Plugin: Remove cypress support (#2232)
1 parent 944d355 commit 4cede43

File tree

6 files changed

+28
-54
lines changed

6 files changed

+28
-54
lines changed

packages/create-plugin/src/constants.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import path from 'node:path';
21
import { fileURLToPath } from 'node:url';
2+
import path from 'node:path';
33

44
const __dirname = fileURLToPath(new URL('.', import.meta.url));
55

@@ -51,19 +51,11 @@ export const EXTRA_TEMPLATE_VARIABLES = {
5151
export const DEFAULT_FEATURE_FLAGS = {
5252
useReactRouterV6: true,
5353
bundleGrafanaUI: false,
54-
usePlaywright: true,
5554
useExperimentalRspack: false,
5655
useExperimentalUpdates: true,
5756
};
5857

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'];
6759

6860
export const MIGRATION_CONFIG = {
6961
// Files that should be overriden during a migration.

packages/create-plugin/src/types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ export type TemplateData = {
2525
useReactRouterV6: boolean;
2626
scenesVersion: string;
2727
reactRouterVersion: string;
28-
usePlaywright: boolean;
29-
useCypress: boolean;
3028
useExperimentalRspack: boolean;
3129
pluginExecutable?: string;
3230
frontendBundler: 'webpack' | 'rspack';

packages/create-plugin/src/utils/utils.config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
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';
51
import { argv, commandName } from './utils.cli.js';
2+
3+
import { CURRENT_APP_VERSION } from './utils.version.js';
64
import { DEFAULT_FEATURE_FLAGS } from '../constants.js';
5+
import fs from 'node:fs';
76
import { output } from './utils.console.js';
87
import { partitionArr } from './utils.helpers.js';
8+
import path from 'node:path';
9+
import { writeFile } from 'node:fs/promises';
910

1011
export type FeatureFlags = {
1112
bundleGrafanaUI?: boolean;
1213

1314
// If set to true, the plugin will be scaffolded with React Router v6. Defaults to true.
1415
// (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.)
1516
useReactRouterV6?: boolean;
16-
usePlaywright?: boolean;
1717
useExperimentalRspack?: boolean;
1818
useExperimentalUpdates?: boolean;
1919
};

packages/create-plugin/src/utils/utils.templates.ts

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -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';
91
import {
10-
TEMPLATE_PATHS,
2+
DEFAULT_FEATURE_FLAGS,
113
EXPORT_PATH_PREFIX,
124
EXTRA_TEMPLATE_VARIABLES,
135
PLUGIN_TYPES,
14-
DEFAULT_FEATURE_FLAGS,
6+
TEMPLATE_PATHS,
157
} from '../constants.js';
168
import { GenerateCliArgs, TemplateData } from '../types.js';
9+
import { filterOutCommonFiles, isFile, isFileStartingWith } from './utils.files.js';
1710
import {
11+
getPackageManagerFromUserAgent,
1812
getPackageManagerInstallCmd,
1913
getPackageManagerWithFallback,
20-
getPackageManagerFromUserAgent,
2114
} from './utils.packageManager.js';
22-
import { getExportFileName } from '../utils/utils.files.js';
23-
import { getGrafanaRuntimeVersion, CURRENT_APP_VERSION } from './utils.version.js';
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';
2420
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';
2525

2626
const templatesDebugger = debug.extend('templates');
2727

@@ -95,11 +95,6 @@ export function renderTemplateFromFile(templateFile: string, data?: any) {
9595
export function getTemplateData(cliArgs?: GenerateCliArgs): TemplateData {
9696
const { features } = getConfig();
9797
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'));
10398
const bundleGrafanaUI = features.bundleGrafanaUI ?? DEFAULT_FEATURE_FLAGS.bundleGrafanaUI;
10499
const getReactRouterVersion = () => (features.useReactRouterV6 ? '6.22.0' : '5.2.0');
105100
const isAppType = (pluginType: string) => pluginType === PLUGIN_TYPES.app || pluginType === PLUGIN_TYPES.scenes;
@@ -130,8 +125,6 @@ export function getTemplateData(cliArgs?: GenerateCliArgs): TemplateData {
130125
useReactRouterV6: features.useReactRouterV6 ?? DEFAULT_FEATURE_FLAGS.useReactRouterV6,
131126
reactRouterVersion: getReactRouterVersion(),
132127
scenesVersion: features.useReactRouterV6 ? '^6.10.4' : '^5.41.3',
133-
usePlaywright,
134-
useCypress,
135128
useExperimentalRspack: Boolean(features.useExperimentalRspack),
136129
frontendBundler,
137130
};
@@ -158,8 +151,6 @@ export function getTemplateData(cliArgs?: GenerateCliArgs): TemplateData {
158151
useReactRouterV6: features.useReactRouterV6 ?? DEFAULT_FEATURE_FLAGS.useReactRouterV6,
159152
reactRouterVersion: getReactRouterVersion(),
160153
scenesVersion: features.useReactRouterV6 ? '^6.10.4' : '^5.41.3',
161-
usePlaywright,
162-
useCypress,
163154
pluginExecutable: pluginJson.executable,
164155
useExperimentalRspack: Boolean(features.useExperimentalRspack),
165156
frontendBundler,

packages/create-plugin/templates/common/_package.json

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,18 @@
88
"test:ci": "jest --passWithNoTests --maxWorkers 4",
99
"typecheck": "tsc --noEmit",
1010
"lint": "eslint --cache .",
11-
"lint:fix": "{{ packageManagerName }} run lint{{#if isNPM}} --{{/if}} --fix && prettier --write --list-different .",{{#if usePlaywright}}
12-
"e2e": "playwright test",{{/if}}{{#if useCypress}}
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",
1513
"server": "docker compose up --build",
1614
"sign": "npx --yes @grafana/sign-plugin@latest"
1715
},
1816
"author": "{{ sentenceCase orgName }}",
1917
"license": "Apache-2.0",
2018
"devDependencies": {
21-
{{#if useCypress}} "@grafana/e2e": "^11.0.7",
22-
"@grafana/e2e-selectors": "^12.2.0",{{/if}}
23-
"@grafana/eslint-config": "^8.2.0",{{#if usePlaywright}}
24-
"@grafana/plugin-e2e": "^2.2.0",{{/if}}
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}}
2723
"@rspack/core": "^1.3.0",
2824
"@rspack/cli": "^1.3.0",{{/if}}
2925
"@stylistic/eslint-plugin-ts": "^2.9.0",
@@ -56,8 +52,8 @@
5652
"replace-in-file-webpack-plugin": "^1.0.6",{{#if useExperimentalRspack}}
5753
"rspack-plugin-virtual-module": "^0.1.13",{{/if}}
5854
"sass": "1.63.2",
59-
"sass-loader": "13.3.1",{{#if usePlaywright}}
60-
"semver": "^7.6.3",{{/if}}
55+
"sass-loader": "13.3.1",
56+
"semver": "^7.6.3",
6157
"style-loader": "3.3.3",{{#unless useExperimentalRspack}}
6258
"swc-loader": "^0.2.3",{{/unless}}
6359
"terser-webpack-plugin": "^5.3.10",

packages/create-plugin/templates/common/npmrc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,3 @@ public-hoist-pattern[]="*prettier*"
1010
# Hoist all types packages to the root for better TS support
1111
public-hoist-pattern[]="@types/*"
1212
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}}

0 commit comments

Comments
 (0)