@nx/cypress 16.8.0-beta.3 → 16.8.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 +6 -6
- package/plugins/cypress-preset.js +15 -6
- package/src/executors/cypress/cypress.impl.js +179 -210
- package/src/generators/base-setup/base-setup.js +15 -5
- package/src/generators/component-configuration/component-configuration.js +42 -30
- package/src/generators/configuration/configuration.js +87 -70
- package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.js +75 -78
- package/src/generators/cypress-project/cypress-project.js +76 -63
- package/src/generators/init/init.js +16 -18
- package/src/generators/migrate-to-cypress-11/conversion.util.js +22 -16
- package/src/generators/migrate-to-cypress-11/migrate-to-cypress-11.js +38 -35
- package/src/migrations/update-12-8-0/remove-typescript-plugin.js +23 -26
- package/src/migrations/update-14-6-1/update-cypress-configs-presets.js +79 -68
- package/src/migrations/update-14-7-0/update-cypress-version-if-10.js +1 -2
- package/src/migrations/update-15-0-0/add-cypress-inputs.js +24 -29
- package/src/migrations/update-15-0-0/update-cy-mount-usage.js +25 -29
- package/src/migrations/update-15-1-0/cypress-11.js +34 -37
- package/src/migrations/update-15-5-0/update-to-cypress-12.js +3 -5
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +3 -6
- package/src/migrations/update-16-2-0/update-cy-tsconfig.js +25 -24
- package/src/migrations/update-16-4-0/tsconfig-sourcemaps.js +52 -49
- package/src/plugins/preprocessor-vite.js +7 -5
- package/src/utils/add-linter.js +78 -81
- package/src/utils/config.js +54 -62
- package/src/utils/ct-helpers.js +6 -8
- package/src/utils/cypress-version.js +1 -1
- package/src/utils/find-target-options.js +37 -43
|
@@ -1,46 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findBuildConfig = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const configuration_1 = require("nx/src/config/configuration");
|
|
7
6
|
const project_graph_1 = require("nx/src/project-graph/project-graph");
|
|
8
|
-
function findBuildConfig(tree, options) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return selfProject;
|
|
23
|
-
}
|
|
24
|
-
// attempt to find any projects with the valid config in the graph that consumes this project
|
|
25
|
-
return yield findInGraph(tree, graph, options);
|
|
7
|
+
async function findBuildConfig(tree, options) {
|
|
8
|
+
try {
|
|
9
|
+
// attempt to use the provided target
|
|
10
|
+
const graph = await (0, devkit_1.createProjectGraphAsync)();
|
|
11
|
+
if (options.buildTarget) {
|
|
12
|
+
return {
|
|
13
|
+
target: options.buildTarget,
|
|
14
|
+
config: findInTarget(tree, graph, options),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
// check to see if there is a valid config in the given project
|
|
18
|
+
const selfProject = findTargetOptionsInProject(tree, graph, options.project, options);
|
|
19
|
+
if (selfProject) {
|
|
20
|
+
return selfProject;
|
|
26
21
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
// attempt to find any projects with the valid config in the graph that consumes this project
|
|
23
|
+
return await findInGraph(tree, graph, options);
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
devkit_1.logger.error(e);
|
|
27
|
+
throw new Error((0, devkit_1.stripIndents) `Error trying to find build configuration. ${options.buildTarget
|
|
28
|
+
? 'Try using an app of the same framework for the --build-target.'
|
|
29
|
+
: 'Try manually specifying the build target with the --build-target flag.'}
|
|
32
30
|
Provided project? ${options.project}
|
|
33
31
|
Provided build target? ${options.buildTarget}
|
|
34
32
|
Provided Executors? ${[...options.validExecutorNames].join(', ')}`);
|
|
35
|
-
|
|
36
|
-
});
|
|
33
|
+
}
|
|
37
34
|
}
|
|
38
35
|
exports.findBuildConfig = findBuildConfig;
|
|
39
36
|
function findInTarget(tree, graph, options) {
|
|
40
|
-
var _a, _b, _c, _d;
|
|
41
37
|
const { project, target, configuration } = (0, devkit_1.parseTargetString)(options.buildTarget);
|
|
42
38
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
43
|
-
const executorName =
|
|
39
|
+
const executorName = projectConfig?.targets?.[target]?.executor;
|
|
44
40
|
if (!options.validExecutorNames.has(executorName)) {
|
|
45
41
|
devkit_1.logger.error((0, devkit_1.stripIndents) `NX The provided build target, ${options.buildTarget}, uses the '${executorName}' executor.
|
|
46
42
|
But only the follow executors are allowed
|
|
@@ -58,7 +54,7 @@ If you do not have an app in the workspace to you can make a new app with 'nx g
|
|
|
58
54
|
`);
|
|
59
55
|
throw new Error('The provided --build-target does not use an executor in the allow list of executors defined.');
|
|
60
56
|
}
|
|
61
|
-
const foundConfig = configuration ||
|
|
57
|
+
const foundConfig = configuration || projectConfig?.targets?.[target]?.defaultConfiguration;
|
|
62
58
|
return (0, devkit_1.readTargetOptions)({ project, target, configuration: foundConfig }, createExecutorContext(graph, projectConfig.targets, project, target, foundConfig));
|
|
63
59
|
}
|
|
64
60
|
function frameworkHelperMessage(validExecutorNames, executorName) {
|
|
@@ -84,24 +80,22 @@ Try using @nx/${buildTargetFramework} instead.`;
|
|
|
84
80
|
}
|
|
85
81
|
return '';
|
|
86
82
|
}
|
|
87
|
-
function findInGraph(tree, graph, options) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
potentialTargets.push(parentProject);
|
|
95
|
-
}
|
|
83
|
+
async function findInGraph(tree, graph, options) {
|
|
84
|
+
const parents = findParentsOfProject(graph, options.project);
|
|
85
|
+
const potentialTargets = [];
|
|
86
|
+
for (const parent of parents) {
|
|
87
|
+
const parentProject = findTargetOptionsInProject(tree, graph, parent.target, options);
|
|
88
|
+
if (parentProject) {
|
|
89
|
+
potentialTargets.push(parentProject);
|
|
96
90
|
}
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
}
|
|
92
|
+
if (potentialTargets.length > 1) {
|
|
93
|
+
devkit_1.logger.warn((0, devkit_1.stripIndents) `Multiple potential targets found for ${options.project}. Found ${potentialTargets.length}.
|
|
99
94
|
Using ${potentialTargets[0].target}.
|
|
100
95
|
To specify a different target use the --build-target flag.
|
|
101
96
|
`);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
});
|
|
97
|
+
}
|
|
98
|
+
return potentialTargets[0];
|
|
105
99
|
}
|
|
106
100
|
function findParentsOfProject(graph, projectName) {
|
|
107
101
|
const reversedGraph = (0, devkit_1.reverse)(graph);
|