@nx/playwright 23.2.0-beta.6 → 23.2.0-beta.8

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.
@@ -197,23 +197,23 @@ async function normalizeOptions(tree, options) {
197
197
  };
198
198
  }
199
199
  async function promptForMissingServeData(projectName) {
200
- const { command, port } = await (0, internal_1.promptWhenInteractive)([
201
- {
202
- type: 'input',
203
- name: 'command',
204
- message: 'What command should be run to serve the application locally?',
205
- initial: `npx nx serve ${projectName}`,
206
- },
207
- {
208
- type: 'numeral',
209
- name: 'port',
210
- message: 'What port will the application be served on?',
211
- initial: 3000,
212
- },
213
- ], {
214
- command: `npx nx serve ${projectName}`,
215
- port: 3000,
200
+ if (!(0, internal_1.isInteractive)()) {
201
+ return {
202
+ webServerCommand: `npx nx serve ${projectName}`,
203
+ webServerAddress: 'http://localhost:3000',
204
+ };
205
+ }
206
+ const command = await (0, internal_1.textPrompt)({
207
+ message: 'What command should be run to serve the application locally?',
208
+ initialValue: `npx nx serve ${projectName}`,
216
209
  });
210
+ const port = Number(await (0, internal_1.textPrompt)({
211
+ message: 'What port will the application be served on?',
212
+ initialValue: '3000',
213
+ validate: (value) => value !== '' && !Number.isNaN(Number(value))
214
+ ? undefined
215
+ : 'Please enter a number',
216
+ }));
217
217
  return {
218
218
  webServerCommand: command,
219
219
  webServerAddress: `http://localhost:${port}`,
@@ -1,4 +1,4 @@
1
- import type { Linter, LinterType } from '@nx/eslint';
1
+ import type { LinterType } from '@nx/js';
2
2
 
3
3
  export interface ConfigurationGeneratorSchema {
4
4
  project: string;
@@ -10,7 +10,7 @@ export interface ConfigurationGeneratorSchema {
10
10
  skipFormat?: boolean;
11
11
  skipPackageJson?: boolean;
12
12
  skipInstall?: boolean;
13
- linter?: Linter | LinterType;
13
+ linter?: LinterType;
14
14
  enableTypedLinting?: boolean; // default is false
15
15
  /**
16
16
  * @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
@@ -34,5 +34,5 @@ export interface NormalizedGeneratorOptions
34
34
  extends ConfigurationGeneratorSchema {
35
35
  addPlugin: boolean;
36
36
  directory: string;
37
- linter: Linter | LinterType;
37
+ linter: LinterType;
38
38
  }
@@ -21,9 +21,9 @@
21
21
  "default": "e2e"
22
22
  },
23
23
  "linter": {
24
- "description": "The tool to use for running lint checks.",
24
+ "description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
25
25
  "type": "string",
26
- "enum": ["none", "eslint"],
26
+ "enum": ["none", "eslint", "oxlint"],
27
27
  "x-priority": "important"
28
28
  },
29
29
  "js": {
@@ -1,8 +1,8 @@
1
1
  import { GeneratorCallback, Tree } from '@nx/devkit';
2
- import { Linter, LinterType } from '@nx/eslint';
2
+ import { LinterType } from '@nx/js';
3
3
  export interface PlaywrightLinterOptions {
4
4
  project: string;
5
- linter: Linter | LinterType;
5
+ linter: LinterType;
6
6
  enableTypedLinting?: boolean;
7
7
  /**
8
8
  * @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addLinterToPlaywrightProject = addLinterToPlaywrightProject;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const eslint_1 = require("@nx/eslint");
6
5
  const internal_1 = require("@nx/eslint/internal");
7
6
  const versions_1 = require("./versions");
7
+ const internal_2 = require("@nx/js/internal");
8
8
  async function addLinterToPlaywrightProject(tree, options) {
9
9
  if (options.linter === 'none') {
10
10
  return () => { };
@@ -13,11 +13,12 @@ async function addLinterToPlaywrightProject(tree, options) {
13
13
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
14
14
  const eslintFile = (0, internal_1.findEslintFile)(tree, projectConfig.root);
15
15
  const enableTypedLinting = (0, internal_1.isTypedLintingEnabled)(options);
16
- if (!eslintFile) {
17
- tasks.push(await (0, eslint_1.lintProjectGenerator)(tree, {
16
+ // An existing ESLint config means the project is already registered, so skip
17
+ // straight to the Playwright-specific shaping below.
18
+ if (options.linter !== 'eslint' || !eslintFile) {
19
+ tasks.push(await (0, internal_2.addLintingToProject)(tree, {
18
20
  project: options.project,
19
21
  linter: options.linter,
20
- skipFormat: true,
21
22
  tsConfigPaths: [(0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.json')],
22
23
  enableTypedLinting,
23
24
  skipPackageJson: options.skipPackageJson,
@@ -25,7 +26,9 @@ async function addLinterToPlaywrightProject(tree, options) {
25
26
  addPlugin: options.addPlugin,
26
27
  }));
27
28
  }
28
- if (!options.linter || options.linter !== 'eslint') {
29
+ // Everything below configures ESLint predefined configs, `extends`, ignore
30
+ // entries — which have no equivalent in other linters.
31
+ if (options.linter !== 'eslint') {
29
32
  return (0, devkit_1.runTasksInSerial)(...tasks);
30
33
  }
31
34
  tasks.push(!options.skipPackageJson
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/playwright",
3
- "version": "23.2.0-beta.6",
3
+ "version": "23.2.0-beta.8",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "files": [
@@ -78,12 +78,12 @@
78
78
  "tslib": "^2.3.0",
79
79
  "minimatch": "10.2.5",
80
80
  "semver": "^7.6.3",
81
- "@nx/devkit": "23.2.0-beta.6",
82
- "@nx/eslint": "23.2.0-beta.6",
83
- "@nx/js": "23.2.0-beta.6"
81
+ "@nx/devkit": "23.2.0-beta.8",
82
+ "@nx/eslint": "23.2.0-beta.8",
83
+ "@nx/js": "23.2.0-beta.8"
84
84
  },
85
85
  "devDependencies": {
86
- "nx": "23.2.0-beta.6"
86
+ "nx": "23.2.0-beta.8"
87
87
  },
88
88
  "peerDependencies": {
89
89
  "@playwright/test": "^1.36.0"