@nx/playwright 18.1.0-beta.1 → 18.1.0-beta.10

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/migrations.json CHANGED
@@ -5,6 +5,12 @@
5
5
  "version": "17.3.1-beta.0",
6
6
  "description": "Add project property to playwright config",
7
7
  "implementation": "./src/migrations/update-17-3-1/add-project-to-config"
8
+ },
9
+ "18-1-0-remove-baseUrl-from-project-json": {
10
+ "cli": "nx",
11
+ "version": "18.1.0-beta.3",
12
+ "description": "Remove invalid baseUrl option from @nx/playwright:playwright targets in project.json.",
13
+ "implementation": "./src/migrations/update-18-1-0/remove-baseUrl-from-project-json"
8
14
  }
9
15
  }
10
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/playwright",
3
- "version": "18.1.0-beta.1",
3
+ "version": "18.1.0-beta.10",
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": "18.1.0-beta.1",
37
- "@nx/eslint": "18.1.0-beta.1",
38
- "@nx/js": "18.1.0-beta.1",
36
+ "@nx/devkit": "18.1.0-beta.10",
37
+ "@nx/eslint": "18.1.0-beta.10",
38
+ "@nx/js": "18.1.0-beta.10",
39
39
  "tslib": "^2.3.0",
40
40
  "minimatch": "9.0.3"
41
41
  },
@@ -14,7 +14,10 @@ function configurationGenerator(tree, options) {
14
14
  }
15
15
  exports.configurationGenerator = configurationGenerator;
16
16
  async function configurationGeneratorInternal(tree, options) {
17
- options.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
17
+ const nxJson = (0, devkit_1.readNxJson)(tree);
18
+ options.addPlugin ??=
19
+ process.env.NX_ADD_PLUGINS !== 'false' &&
20
+ nxJson.useInferencePlugins !== false;
18
21
  const tasks = [];
19
22
  tasks.push(await (0, init_1.initGenerator)(tree, {
20
23
  skipFormat: true,
@@ -29,7 +29,8 @@ export default defineConfig({
29
29
  url: '<%= webServerAddress %>',
30
30
  reuseExistingServer: !process.env.CI,
31
31
  cwd: workspaceRoot
32
- },<% } else {%>// webServer: {
32
+ },<% } else {%>
33
+ // webServer: {
33
34
  // command: 'npm run start',
34
35
  // url: 'http://127.0.0.1:3000',
35
36
  // reuseExistingServer: !process.env.CI,
@@ -11,7 +11,10 @@ function initGenerator(tree, options) {
11
11
  exports.initGenerator = initGenerator;
12
12
  async function initGeneratorInternal(tree, options) {
13
13
  const tasks = [];
14
- options.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
14
+ const nxJson = (0, devkit_1.readNxJson)(tree);
15
+ const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
16
+ nxJson.useInferencePlugins !== false;
17
+ options.addPlugin ??= addPluginDefault;
15
18
  if (!options.skipPackageJson) {
16
19
  tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
17
20
  '@nx/playwright': versions_1.nxVersion,
@@ -0,0 +1,2 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export default function (tree: Tree): Promise<void>;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
5
+ async function default_1(tree) {
6
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/playwright:playwright', (options, projectName, targetName, configurationName) => {
7
+ if (options?.['baseUrl']) {
8
+ const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
9
+ if (configurationName) {
10
+ delete project.targets[targetName].configurations[configurationName]['baseUrl'];
11
+ }
12
+ else {
13
+ delete project.targets[targetName].options['baseUrl'];
14
+ }
15
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
16
+ }
17
+ });
18
+ const nxJson = (0, devkit_1.readNxJson)(tree);
19
+ for (const [targetNameOrExecutor, target] of Object.entries(nxJson.targetDefaults)) {
20
+ if (targetNameOrExecutor === '@nx/playwright:playwright' ||
21
+ (target.executor && target.executor === '@nx/playwright:playwright')) {
22
+ let updated = false;
23
+ if (target.options?.['baseUrl']) {
24
+ delete nxJson.targetDefaults[targetNameOrExecutor].options['baseUrl'];
25
+ updated = true;
26
+ }
27
+ if (target.configurations) {
28
+ for (const [configurationName, configuration] of Object.entries(target.configurations)) {
29
+ if (configuration['baseUrl']) {
30
+ delete nxJson.targetDefaults[targetNameOrExecutor].configurations[configurationName]['baseUrl'];
31
+ updated = true;
32
+ }
33
+ }
34
+ }
35
+ if (updated) {
36
+ (0, devkit_1.updateNxJson)(tree, nxJson);
37
+ }
38
+ }
39
+ }
40
+ await (0, devkit_1.formatFiles)(tree);
41
+ }
42
+ exports.default = default_1;
@@ -30,7 +30,7 @@ exports.createNodes = [
30
30
  async (configFilePath, options, context) => {
31
31
  const projectRoot = (0, path_1.dirname)(configFilePath);
32
32
  // Do not create a project if package.json and project.json isn't there.
33
- const siblingFiles = (0, fs_1.readdirSync)(projectRoot);
33
+ const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
34
34
  if (!siblingFiles.includes('package.json') &&
35
35
  !siblingFiles.includes('project.json')) {
36
36
  return {};