@nx/playwright 17.3.0-beta.3 → 17.3.0-beta.4
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 +4 -4
- package/src/generators/configuration/configuration.js +42 -4
- package/src/generators/configuration/schema.d.ts +1 -0
- package/src/generators/configuration/schema.json +5 -0
- package/src/generators/init/init.js +2 -29
- package/src/generators/init/schema.d.ts +0 -1
- package/src/generators/init/schema.json +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/playwright",
|
|
3
|
-
"version": "17.3.0-beta.
|
|
3
|
+
"version": "17.3.0-beta.4",
|
|
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.
|
|
36
|
-
"@nx/eslint": "17.3.0-beta.
|
|
37
|
-
"@nx/js": "17.3.0-beta.
|
|
35
|
+
"@nx/devkit": "17.3.0-beta.4",
|
|
36
|
+
"@nx/eslint": "17.3.0-beta.4",
|
|
37
|
+
"@nx/js": "17.3.0-beta.4",
|
|
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
|
|
9
|
-
const
|
|
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.
|
|
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) {
|
|
@@ -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.
|
|
38
|
-
|
|
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
|
}
|
|
@@ -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": []
|