@nx/playwright 19.0.0-beta.1 → 19.0.0-beta.11

Sign up to get free protection for your applications and to get access to all the features.
package/generators.json CHANGED
@@ -11,6 +11,11 @@
11
11
  "factory": "./src/generators/init/init#initGeneratorInternal",
12
12
  "schema": "./src/generators/init/schema.json",
13
13
  "description": "Initializes a Playwright project in the current workspace"
14
+ },
15
+ "convert-to-inferred": {
16
+ "factory": "./src/generators/convert-to-inferred/convert-to-inferred",
17
+ "schema": "./src/generators/convert-to-inferred/schema.json",
18
+ "description": "Convert existing Playwright project(s) using `@nx/playwright:playwright` executor to use `@nx/playwright/plugin`."
14
19
  }
15
20
  }
16
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/playwright",
3
- "version": "19.0.0-beta.1",
3
+ "version": "19.0.0-beta.11",
4
4
  "type": "commonjs",
5
5
  "homepage": "https://nx.dev",
6
6
  "private": false,
@@ -33,9 +33,9 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@phenomnomnominal/tsquery": "~5.0.1",
36
- "@nx/devkit": "19.0.0-beta.1",
37
- "@nx/eslint": "19.0.0-beta.1",
38
- "@nx/js": "19.0.0-beta.1",
36
+ "@nx/devkit": "19.0.0-beta.11",
37
+ "@nx/eslint": "19.0.0-beta.11",
38
+ "@nx/js": "19.0.0-beta.11",
39
39
  "tslib": "^2.3.0",
40
40
  "minimatch": "9.0.3"
41
41
  },
@@ -0,0 +1,8 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ interface Schema {
3
+ project?: string;
4
+ all?: boolean;
5
+ skipFormat?: boolean;
6
+ }
7
+ export declare function convertToInferred(tree: Tree, options: Schema): Promise<void>;
8
+ export default convertToInferred;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertToInferred = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const plugin_1 = require("../../plugins/plugin");
6
+ const executor_to_plugin_migrator_1 = require("@nx/devkit/src/generators/plugin-migrations/executor-to-plugin-migrator");
7
+ async function convertToInferred(tree, options) {
8
+ const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
9
+ const migratedProjects = await (0, executor_to_plugin_migrator_1.migrateExecutorToPlugin)(tree, projectGraph, '@nx/playwright:playwright', '@nx/playwright/plugin', (targetName) => ({ targetName, ciTargetName: 'e2e-ci' }), postTargetTransformer, plugin_1.createNodes, options.project);
10
+ if (migratedProjects === 0) {
11
+ throw new Error('Could not find any targets to migrate.');
12
+ }
13
+ if (!options.skipFormat) {
14
+ await (0, devkit_1.formatFiles)(tree);
15
+ }
16
+ }
17
+ exports.convertToInferred = convertToInferred;
18
+ function postTargetTransformer(target) {
19
+ if (target.options) {
20
+ if (target.options?.config) {
21
+ delete target.options.config;
22
+ }
23
+ for (const [key, value] of Object.entries(target.options)) {
24
+ const newKeyName = (0, devkit_1.names)(key).fileName;
25
+ delete target.options[key];
26
+ target.options[newKeyName] = value;
27
+ }
28
+ }
29
+ return target;
30
+ }
31
+ exports.default = convertToInferred;
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "$id": "NxPlaywrightConvertToInferred",
4
+ "description": "Convert existing Playwright project(s) using `@nx/playwright:playwright` executor to use `@nx/playwright/plugin`. Defaults to migrating all projects. Pass '--project' to migrate only one target.",
5
+ "title": "Convert Playwright project from executor to plugin",
6
+ "type": "object",
7
+ "properties": {
8
+ "project": {
9
+ "type": "string",
10
+ "description": "The project to convert from using the `@nx/playwright:playwright` executor to use `@nx/playwright/plugin`.",
11
+ "x-priority": "important"
12
+ },
13
+ "skipFormat": {
14
+ "type": "boolean",
15
+ "description": "Whether to format files at the end of the migration.",
16
+ "default": false
17
+ }
18
+ }
19
+ }