@nx/cypress 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/cypress",
|
|
3
|
-
"version": "17.3.0-beta.
|
|
3
|
+
"version": "17.3.0-beta.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for Cypress contains executors and generators allowing your workspace to use the powerful Cypress integration testing capabilities.",
|
|
6
6
|
"repository": {
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"migrations": "./migrations.json"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@nx/devkit": "17.3.0-beta.
|
|
38
|
-
"@nx/eslint": "17.3.0-beta.
|
|
39
|
-
"@nx/js": "17.3.0-beta.
|
|
37
|
+
"@nx/devkit": "17.3.0-beta.5",
|
|
38
|
+
"@nx/eslint": "17.3.0-beta.5",
|
|
39
|
+
"@nx/js": "17.3.0-beta.5",
|
|
40
40
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
41
41
|
"detect-port": "^1.5.1",
|
|
42
42
|
"semver": "7.5.3",
|
|
43
43
|
"tslib": "^2.3.0",
|
|
44
|
-
"@nrwl/cypress": "17.3.0-beta.
|
|
44
|
+
"@nrwl/cypress": "17.3.0-beta.5"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"cypress": ">= 3 < 14"
|
|
@@ -15,16 +15,14 @@ async function configurationGenerator(tree, options) {
|
|
|
15
15
|
const opts = normalizeOptions(tree, options);
|
|
16
16
|
const tasks = [];
|
|
17
17
|
if (!(0, cypress_version_1.installedCypressVersion)()) {
|
|
18
|
-
tasks.push(await (0,
|
|
18
|
+
tasks.push(await (0, js_1.initGenerator)(tree, { ...options, skipFormat: true }));
|
|
19
|
+
tasks.push(await (0, init_1.default)(tree, { ...opts, skipFormat: true }));
|
|
19
20
|
}
|
|
20
21
|
const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
|
|
21
22
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
22
23
|
const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
|
|
23
24
|
? p === '@nx/cypress/plugin'
|
|
24
25
|
: p.plugin === '@nx/cypress/plugin');
|
|
25
|
-
if (opts.bundler === 'vite') {
|
|
26
|
-
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, { vite: versions_1.viteVersion }));
|
|
27
|
-
}
|
|
28
26
|
await addFiles(tree, opts, projectGraph, hasPlugin);
|
|
29
27
|
if (!hasPlugin) {
|
|
30
28
|
addTarget(tree, opts);
|
|
@@ -34,12 +32,24 @@ async function configurationGenerator(tree, options) {
|
|
|
34
32
|
cypressDir: opts.directory,
|
|
35
33
|
});
|
|
36
34
|
tasks.push(linterTask);
|
|
35
|
+
if (!opts.skipPackageJson) {
|
|
36
|
+
tasks.push(ensureDependencies(tree, opts));
|
|
37
|
+
}
|
|
37
38
|
if (!opts.skipFormat) {
|
|
38
39
|
await (0, devkit_1.formatFiles)(tree);
|
|
39
40
|
}
|
|
40
41
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
41
42
|
}
|
|
42
43
|
exports.configurationGenerator = configurationGenerator;
|
|
44
|
+
function ensureDependencies(tree, options) {
|
|
45
|
+
const devDependencies = {
|
|
46
|
+
'@types/node': versions_1.typesNodeVersion,
|
|
47
|
+
};
|
|
48
|
+
if (options.bundler === 'vite') {
|
|
49
|
+
devDependencies['vite'] = versions_1.viteVersion;
|
|
50
|
+
}
|
|
51
|
+
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies);
|
|
52
|
+
}
|
|
43
53
|
function normalizeOptions(tree, options) {
|
|
44
54
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
45
55
|
if (projectConfig?.targets?.e2e) {
|
|
@@ -133,12 +133,8 @@ async function cypressProjectGeneratorInternal(host, schema) {
|
|
|
133
133
|
// if there is an installed cypress version, then we don't call
|
|
134
134
|
// init since we want to keep the existing version that is installed
|
|
135
135
|
if (!cypressVersion) {
|
|
136
|
-
tasks.push(await (0,
|
|
137
|
-
|
|
138
|
-
if (schema.bundler === 'vite') {
|
|
139
|
-
tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, {}, {
|
|
140
|
-
vite: versions_1.viteVersion,
|
|
141
|
-
}));
|
|
136
|
+
tasks.push(await (0, js_1.initGenerator)(host, { ...options, skipFormat: true }));
|
|
137
|
+
tasks.push(await (0, init_1.cypressInitGenerator)(host, { ...options, skipFormat: true }));
|
|
142
138
|
}
|
|
143
139
|
createFiles(host, options);
|
|
144
140
|
addProject(host, options);
|
|
@@ -150,12 +146,24 @@ async function cypressProjectGeneratorInternal(host, schema) {
|
|
|
150
146
|
overwriteExisting: true,
|
|
151
147
|
});
|
|
152
148
|
tasks.push(installTask);
|
|
149
|
+
if (!options.skipPackageJson) {
|
|
150
|
+
tasks.push(ensureDependencies(host, options));
|
|
151
|
+
}
|
|
153
152
|
if (!options.skipFormat) {
|
|
154
153
|
await (0, devkit_1.formatFiles)(host);
|
|
155
154
|
}
|
|
156
155
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
157
156
|
}
|
|
158
157
|
exports.cypressProjectGeneratorInternal = cypressProjectGeneratorInternal;
|
|
158
|
+
function ensureDependencies(tree, options) {
|
|
159
|
+
const devDependencies = {
|
|
160
|
+
'@types/node': versions_1.typesNodeVersion,
|
|
161
|
+
};
|
|
162
|
+
if (options.bundler === 'vite') {
|
|
163
|
+
devDependencies['vite'] = versions_1.viteVersion;
|
|
164
|
+
}
|
|
165
|
+
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies);
|
|
166
|
+
}
|
|
159
167
|
async function normalizeOptions(host, options) {
|
|
160
168
|
let maybeRootProject;
|
|
161
169
|
let isRootProject = false;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.cypressInitGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const versions_1 = require("../../utils/versions");
|
|
6
|
-
const js_1 = require("@nx/js");
|
|
7
6
|
function setupE2ETargetDefaults(tree) {
|
|
8
7
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
9
8
|
if (!nxJson.namedInputs) {
|
|
@@ -21,12 +20,13 @@ function setupE2ETargetDefaults(tree) {
|
|
|
21
20
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
22
21
|
}
|
|
23
22
|
function updateDependencies(tree) {
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const tasks = [];
|
|
24
|
+
tasks.push((0, devkit_1.removeDependenciesFromPackageJson)(tree, ['@nx/cypress'], []));
|
|
25
|
+
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
26
26
|
['@nx/cypress']: versions_1.nxVersion,
|
|
27
27
|
cypress: versions_1.cypressVersion,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
}));
|
|
29
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
30
30
|
}
|
|
31
31
|
function addPlugin(tree) {
|
|
32
32
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
@@ -61,23 +61,21 @@ function updateProductionFileset(tree) {
|
|
|
61
61
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
62
62
|
}
|
|
63
63
|
async function cypressInitGenerator(tree, options) {
|
|
64
|
-
const addPlugins = process.env.NX_PCV3 === 'true';
|
|
65
64
|
updateProductionFileset(tree);
|
|
66
|
-
if (
|
|
67
|
-
setupE2ETargetDefaults(tree);
|
|
68
|
-
}
|
|
69
|
-
const tasks = [];
|
|
70
|
-
tasks.push(await (0, js_1.initGenerator)(tree, {
|
|
71
|
-
...options,
|
|
72
|
-
skipFormat: true,
|
|
73
|
-
}));
|
|
74
|
-
if (addPlugins) {
|
|
65
|
+
if (process.env.NX_PCV3 === 'true') {
|
|
75
66
|
addPlugin(tree);
|
|
76
67
|
}
|
|
68
|
+
else {
|
|
69
|
+
setupE2ETargetDefaults(tree);
|
|
70
|
+
}
|
|
71
|
+
let installTask = () => { };
|
|
77
72
|
if (!options.skipPackageJson) {
|
|
78
|
-
|
|
73
|
+
installTask = updateDependencies(tree);
|
|
79
74
|
}
|
|
80
|
-
|
|
75
|
+
if (!options.skipFormat) {
|
|
76
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
77
|
+
}
|
|
78
|
+
return installTask;
|
|
81
79
|
}
|
|
82
80
|
exports.cypressInitGenerator = cypressInitGenerator;
|
|
83
81
|
exports.default = cypressInitGenerator;
|
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
"description": "Add Cypress Configuration to the workspace.",
|
|
7
7
|
"type": "object",
|
|
8
8
|
"properties": {
|
|
9
|
+
"skipFormat": {
|
|
10
|
+
"description": "Skip formatting files.",
|
|
11
|
+
"type": "boolean",
|
|
12
|
+
"default": false,
|
|
13
|
+
"x-priority": "internal"
|
|
14
|
+
},
|
|
9
15
|
"skipPackageJson": {
|
|
10
16
|
"type": "boolean",
|
|
11
17
|
"default": false,
|