@nx/playwright 23.0.0-beta.11 → 23.0.0-beta.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/playwright",
3
- "version": "23.0.0-beta.11",
3
+ "version": "23.0.0-beta.13",
4
4
  "type": "commonjs",
5
5
  "homepage": "https://nx.dev",
6
6
  "private": false,
@@ -34,15 +34,15 @@
34
34
  "directory": "packages/playwright"
35
35
  },
36
36
  "dependencies": {
37
- "@nx/devkit": "23.0.0-beta.11",
38
- "@nx/eslint": "23.0.0-beta.11",
39
- "@nx/js": "23.0.0-beta.11",
37
+ "@nx/devkit": "23.0.0-beta.13",
38
+ "@nx/eslint": "23.0.0-beta.13",
39
+ "@nx/js": "23.0.0-beta.13",
40
40
  "tslib": "^2.3.0",
41
41
  "minimatch": "10.2.5",
42
42
  "semver": "^7.6.3"
43
43
  },
44
44
  "devDependencies": {
45
- "nx": "23.0.0-beta.11"
45
+ "nx": "23.0.0-beta.13"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@playwright/test": "^1.36.0"
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/playwright/src/generators/configuration/configuration.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,iBAAiB,EAUjB,IAAI,EAML,MAAM,YAAY,CAAC;AAiBpB,OAAO,KAAK,EACV,4BAA4B,EAE7B,MAAM,UAAU,CAAC;AAGlB,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,8BAGtC;AAED,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,4BAA4B,8BAkNzC;AA2JD,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/playwright/src/generators/configuration/configuration.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,iBAAiB,EAWjB,IAAI,EAML,MAAM,YAAY,CAAC;AAiBpB,OAAO,KAAK,EACV,4BAA4B,EAE7B,MAAM,UAAU,CAAC;AAGlB,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,8BAGtC;AAED,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,4BAA4B,8BAkNzC;AAyKD,eAAe,sBAAsB,CAAC"}
@@ -6,10 +6,7 @@ const tslib_1 = require("tslib");
6
6
  const internal_1 = require("@nx/devkit/internal");
7
7
  const devkit_1 = require("@nx/devkit");
8
8
  const js_1 = require("@nx/js");
9
- const generator_prompts_1 = require("@nx/js/src/utils/generator-prompts");
10
- const package_manager_workspaces_1 = require("@nx/js/src/utils/package-manager-workspaces");
11
- const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
12
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
9
+ const internal_2 = require("@nx/js/internal");
13
10
  const deprecation_1 = require("../../utils/deprecation");
14
11
  const child_process_1 = require("child_process");
15
12
  const path = tslib_1.__importStar(require("path"));
@@ -39,7 +36,7 @@ async function configurationGeneratorInternal(tree, rawOptions) {
39
36
  webServerAddress: options.webServerAddress ?? null,
40
37
  ...options,
41
38
  });
42
- const isTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
39
+ const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)(tree);
43
40
  const tsconfigPath = (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.json');
44
41
  if (tree.exists(tsconfigPath)) {
45
42
  if (isTsSolutionSetup) {
@@ -146,7 +143,7 @@ async function configurationGeneratorInternal(tree, rawOptions) {
146
143
  addPlugin: options.addPlugin,
147
144
  }));
148
145
  if (options.js) {
149
- const { ModuleKind } = (0, ensure_typescript_1.ensureTypescript)();
146
+ const { ModuleKind } = (0, internal_2.ensureTypescript)();
150
147
  (0, devkit_1.toJS)(tree, { extension: '.cjs', module: ModuleKind.CommonJS });
151
148
  }
152
149
  recommendVsCodeExtensions(tree);
@@ -163,9 +160,9 @@ async function configurationGeneratorInternal(tree, rawOptions) {
163
160
  await (0, devkit_1.formatFiles)(tree);
164
161
  }
165
162
  if (isTsSolutionSetup) {
166
- const projectPackageManagerWorkspaceState = (0, package_manager_workspaces_1.getProjectPackageManagerWorkspaceState)(tree, projectConfig.root);
163
+ const projectPackageManagerWorkspaceState = (0, internal_2.getProjectPackageManagerWorkspaceState)(tree, projectConfig.root);
167
164
  if (projectPackageManagerWorkspaceState !== 'included') {
168
- tasks.push((0, package_manager_workspaces_1.getProjectPackageManagerWorkspaceStateWarningTask)(projectPackageManagerWorkspaceState, tree.root));
165
+ tasks.push((0, internal_2.getProjectPackageManagerWorkspaceStateWarningTask)(projectPackageManagerWorkspaceState, tree.root));
169
166
  }
170
167
  }
171
168
  return (0, devkit_1.runTasksInSerial)(...tasks);
@@ -175,7 +172,7 @@ async function normalizeOptions(tree, options) {
175
172
  const addPlugin = options.addPlugin ??
176
173
  (process.env.NX_ADD_PLUGINS !== 'false' &&
177
174
  nxJson.useInferencePlugins !== false);
178
- const linter = await (0, generator_prompts_1.normalizeLinterOption)(tree, options.linter);
175
+ const linter = await (0, internal_2.normalizeLinterOption)(tree, options.linter);
179
176
  if (!options.webServerCommand || !options.webServerAddress) {
180
177
  const { webServerCommand, webServerAddress } = await promptForMissingServeData(options.project);
181
178
  options.webServerCommand = webServerCommand;
@@ -246,15 +243,30 @@ function setupE2ETargetDefaults(tree) {
246
243
  return;
247
244
  }
248
245
  // E2e targets depend on all their project's sources + production sources of dependencies
249
- nxJson.targetDefaults ??= {};
250
246
  const productionFileSet = !!nxJson.namedInputs?.production;
251
- nxJson.targetDefaults.e2e ??= {};
252
- nxJson.targetDefaults.e2e.cache ??= true;
253
- nxJson.targetDefaults.e2e.inputs ??= [
254
- 'default',
255
- productionFileSet ? '^production' : '^default',
256
- ];
257
- (0, devkit_1.updateNxJson)(tree, nxJson);
247
+ // Either a `target: 'e2e'` default or a default keyed on the executor
248
+ // we're about to scaffold will apply to the new target — consider both
249
+ // before deciding to add cache/inputs. Target-keyed wins when both are
250
+ // present.
251
+ const existingForTarget = (0, internal_1.findTargetDefault)(nxJson.targetDefaults, {
252
+ target: 'e2e',
253
+ });
254
+ const existingForExecutor = (0, internal_1.findTargetDefault)(nxJson.targetDefaults, {
255
+ executor: '@nx/playwright:playwright',
256
+ });
257
+ const existingCache = existingForTarget?.cache ?? existingForExecutor?.cache;
258
+ const existingInputs = existingForTarget?.inputs ?? existingForExecutor?.inputs;
259
+ const patch = {};
260
+ if (existingCache === undefined) {
261
+ patch.cache = true;
262
+ }
263
+ if (existingInputs === undefined) {
264
+ patch.inputs = ['default', productionFileSet ? '^production' : '^default'];
265
+ }
266
+ if (Object.keys(patch).length > 0) {
267
+ (0, internal_1.upsertTargetDefault)(tree, nxJson, { target: 'e2e', ...patch });
268
+ (0, devkit_1.updateNxJson)(tree, nxJson);
269
+ }
258
270
  }
259
271
  function addE2eTarget(tree, options) {
260
272
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
@@ -4,7 +4,7 @@ exports.createNodesV2 = exports.createNodes = void 0;
4
4
  const internal_1 = require("@nx/devkit/internal");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const js_1 = require("@nx/js");
7
- const internal_2 = require("@nx/js/src/internal");
7
+ const internal_2 = require("@nx/js/internal");
8
8
  const minimatch_1 = require("minimatch");
9
9
  const node_fs_1 = require("node:fs");
10
10
  const node_path_1 = require("node:path");
@@ -184,7 +184,6 @@ async function buildPlaywrightTargets(configFilePath, projectRoot, options, cont
184
184
  };
185
185
  dependsOn.push({
186
186
  target: targetName,
187
- projects: 'self',
188
187
  params: 'forward',
189
188
  options: 'forward',
190
189
  });
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nxE2EPreset = nxE2EPreset;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const internal_1 = require("@nx/devkit/internal");
6
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
6
+ const internal_2 = require("@nx/js/internal");
7
7
  const test_1 = require("@playwright/test");
8
8
  const node_fs_1 = require("node:fs");
9
9
  const node_path_1 = require("node:path");
@@ -37,7 +37,7 @@ function nxE2EPreset(pathToConfig, options) {
37
37
  : (0, node_path_1.dirname)(pathToConfig);
38
38
  const projectPath = (0, node_path_1.relative)(devkit_1.workspaceRoot, normalizedPath);
39
39
  const offset = (0, node_path_1.relative)(normalizedPath, devkit_1.workspaceRoot);
40
- const isTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)();
40
+ const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)();
41
41
  const testResultOuputDir = isTsSolutionSetup
42
42
  ? 'test-output/playwright/output'
43
43
  : (0, node_path_1.join)(offset, 'dist', '.playwright', projectPath, 'test-output');