@nx/playwright 17.3.0-beta.3 → 17.3.0-beta.5

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": "17.3.0-beta.3",
3
+ "version": "17.3.0-beta.5",
4
4
  "type": "commonjs",
5
5
  "homepage": "https://nx.dev",
6
6
  "private": false,
@@ -32,9 +32,9 @@
32
32
  "directory": "packages/playwright"
33
33
  },
34
34
  "dependencies": {
35
- "@nx/devkit": "17.3.0-beta.3",
36
- "@nx/eslint": "17.3.0-beta.3",
37
- "@nx/js": "17.3.0-beta.3",
35
+ "@nx/devkit": "17.3.0-beta.5",
36
+ "@nx/eslint": "17.3.0-beta.5",
37
+ "@nx/js": "17.3.0-beta.5",
38
38
  "tslib": "^2.3.0",
39
39
  "minimatch": "3.0.5"
40
40
  },
@@ -2,14 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.configurationGenerator = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
+ const js_1 = require("@nx/js");
6
+ const versions_1 = require("@nx/js/src/utils/versions");
7
+ const child_process_1 = require("child_process");
5
8
  const path = require("path");
6
- const init_1 = require("../init/init");
7
9
  const add_linter_1 = require("../../utils/add-linter");
8
- const versions_1 = require("@nx/js/src/utils/versions");
9
- const js_1 = require("@nx/js");
10
+ const versions_2 = require("../../utils/versions");
11
+ const init_1 = require("../init/init");
10
12
  async function configurationGenerator(tree, options) {
11
13
  const tasks = [];
12
- tasks.push(await (0, init_1.default)(tree, {
14
+ tasks.push(await (0, init_1.initGenerator)(tree, {
13
15
  skipFormat: true,
14
16
  skipPackageJson: options.skipPackageJson,
15
17
  }));
@@ -62,12 +64,48 @@ async function configurationGenerator(tree, options) {
62
64
  const { ModuleKind } = (0, devkit_1.ensurePackage)('typescript', versions_1.typescriptVersion);
63
65
  (0, devkit_1.toJS)(tree, { extension: '.cjs', module: ModuleKind.CommonJS });
64
66
  }
67
+ recommendVsCodeExtensions(tree);
68
+ if (!options.skipPackageJson) {
69
+ tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
70
+ // required since used in playwright config
71
+ '@nx/devkit': versions_2.nxVersion,
72
+ }));
73
+ }
74
+ if (!options.skipInstall) {
75
+ tasks.push(getBrowsersInstallTask());
76
+ }
65
77
  if (!options.skipFormat) {
66
78
  await (0, devkit_1.formatFiles)(tree);
67
79
  }
68
80
  return (0, devkit_1.runTasksInSerial)(...tasks);
69
81
  }
70
82
  exports.configurationGenerator = configurationGenerator;
83
+ function getBrowsersInstallTask() {
84
+ return () => {
85
+ devkit_1.output.log({
86
+ title: 'Ensuring Playwright is installed.',
87
+ bodyLines: ['use --skipInstall to skip installation.'],
88
+ });
89
+ const pmc = (0, devkit_1.getPackageManagerCommand)();
90
+ (0, child_process_1.execSync)(`${pmc.exec} playwright install`, { cwd: devkit_1.workspaceRoot });
91
+ };
92
+ }
93
+ function recommendVsCodeExtensions(tree) {
94
+ if (tree.exists('.vscode/extensions.json')) {
95
+ (0, devkit_1.updateJson)(tree, '.vscode/extensions.json', (json) => {
96
+ json.recommendations ??= [];
97
+ const recs = new Set(json.recommendations);
98
+ recs.add('ms-playwright.playwright');
99
+ json.recommendations = Array.from(recs);
100
+ return json;
101
+ });
102
+ }
103
+ else {
104
+ (0, devkit_1.writeJson)(tree, '.vscode/extensions.json', {
105
+ recommendations: ['ms-playwright.playwright'],
106
+ });
107
+ }
108
+ }
71
109
  function setupE2ETargetDefaults(tree) {
72
110
  const nxJson = (0, devkit_1.readNxJson)(tree);
73
111
  if (!nxJson.namedInputs) {
@@ -9,6 +9,7 @@ export interface ConfigurationGeneratorSchema {
9
9
  js: boolean; // default is false
10
10
  skipFormat: boolean;
11
11
  skipPackageJson: boolean;
12
+ skipInstall?: boolean;
12
13
  linter: Linter;
13
14
  setParserOptionsProject: boolean; // default is false
14
15
  /**
@@ -62,6 +62,11 @@
62
62
  "default": false,
63
63
  "hidden": true,
64
64
  "x-priority": "internal"
65
+ },
66
+ "skipInstall": {
67
+ "type": "boolean",
68
+ "description": "Skip running `playwright install`. This is to ensure that playwright browsers are installed.",
69
+ "default": false
65
70
  }
66
71
  },
67
72
  "required": ["project"]
@@ -3,46 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initGenerator = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const versions_1 = require("../../utils/versions");
6
- const child_process_1 = require("child_process");
7
6
  async function initGenerator(tree, options) {
8
7
  const tasks = [];
9
8
  if (!options.skipPackageJson) {
10
9
  tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
11
10
  '@nx/playwright': versions_1.nxVersion,
12
- // required since used in playwright config
13
- '@nx/devkit': versions_1.nxVersion,
14
11
  '@playwright/test': versions_1.playwrightVersion,
15
12
  }));
16
13
  }
17
- if (!options.skipFormat) {
18
- await (0, devkit_1.formatFiles)(tree);
19
- }
20
- if (tree.exists('.vscode/extensions.json')) {
21
- (0, devkit_1.updateJson)(tree, '.vscode/extensions.json', (json) => {
22
- json.recommendations ??= [];
23
- const recs = new Set(json.recommendations);
24
- recs.add('ms-playwright.playwright');
25
- json.recommendations = Array.from(recs);
26
- return json;
27
- });
28
- }
29
- else {
30
- tree.write('.vscode/extensions.json', JSON.stringify({
31
- recommendations: ['ms-playwright.playwright'],
32
- }, null, 2));
33
- }
34
14
  if (process.env.NX_PCV3 === 'true') {
35
15
  addPlugin(tree);
36
16
  }
37
- if (!options.skipInstall) {
38
- tasks.push(() => {
39
- devkit_1.output.log({
40
- title: 'Ensuring Playwright is installed.',
41
- bodyLines: ['use --skipInstall to skip installation.'],
42
- });
43
- const pmc = (0, devkit_1.getPackageManagerCommand)();
44
- (0, child_process_1.execSync)(`${pmc.exec} playwright install`, { cwd: devkit_1.workspaceRoot });
45
- });
17
+ if (!options.skipFormat) {
18
+ await (0, devkit_1.formatFiles)(tree);
46
19
  }
47
20
  return (0, devkit_1.runTasksInSerial)(...tasks);
48
21
  }
@@ -1,5 +1,4 @@
1
1
  export interface InitGeneratorSchema {
2
2
  skipFormat: boolean;
3
3
  skipPackageJson: boolean;
4
- skipInstall?: boolean;
5
4
  }
@@ -16,11 +16,6 @@
16
16
  "default": false,
17
17
  "description": "Do not add dependencies to `package.json`.",
18
18
  "x-priority": "internal"
19
- },
20
- "skipInstall": {
21
- "type": "boolean",
22
- "description": "Skip running `playwright install`. This is to ensure that playwright browsers are installed.",
23
- "default": false
24
19
  }
25
20
  },
26
21
  "required": []