@nrwl/cypress 14.6.0 → 14.6.3
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/CHANGELOG.md +1 -9
- package/migrations.json +6 -0
- package/package.json +5 -5
- package/plugins/cypress-preset.js +8 -2
- package/plugins/cypress-preset.js.map +1 -1
- package/src/executors/cypress/cypress.impl.js +2 -0
- package/src/executors/cypress/cypress.impl.js.map +1 -1
- package/src/generators/cypress-component-project/cypress-component-project.d.ts +1 -0
- package/src/generators/cypress-component-project/cypress-component-project.js +12 -1
- package/src/generators/cypress-component-project/cypress-component-project.js.map +1 -1
- package/src/migrations/update-14-6-1/update-cypress-configs-presets.d.ts +3 -0
- package/src/migrations/update-14-6-1/update-cypress-configs-presets.js +111 -0
- package/src/migrations/update-14-6-1/update-cypress-configs-presets.js.map +1 -0
- package/src/utils/find-target-options.d.ts +16 -0
- package/src/utils/find-target-options.js +85 -0
- package/src/utils/find-target-options.js.map +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,14 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @nrwl/cypress
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# [14.6.0-rc.2](https://github.com/nrwl/nx/compare/14.5.7...14.6.0-rc.2) (2022-08-30)
|
|
6
|
+
## [14.6.3](https://github.com/nrwl/nx/compare/14.6.2...14.6.3) (2022-09-01)
|
|
15
7
|
|
|
16
8
|
**Note:** Version bump only for package @nrwl/cypress
|
package/migrations.json
CHANGED
|
@@ -30,6 +30,12 @@
|
|
|
30
30
|
"version": "12.8.0-beta.0",
|
|
31
31
|
"description": "Remove Typescript Preprocessor Plugin",
|
|
32
32
|
"factory": "./src/migrations/update-12-8-0/remove-typescript-plugin"
|
|
33
|
+
},
|
|
34
|
+
"update-cypress-configs-preset": {
|
|
35
|
+
"cli": "nx",
|
|
36
|
+
"version": "14.6.1-beta.0",
|
|
37
|
+
"description": "Change Cypress e2e and component testing presets to use __filename instead of __dirname and include a devServerTarget for component testing.",
|
|
38
|
+
"factory": "./src/migrations/update-14-6-1/update-cypress-configs-presets"
|
|
33
39
|
}
|
|
34
40
|
},
|
|
35
41
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nrwl/cypress",
|
|
3
|
-
"version": "14.6.
|
|
3
|
+
"version": "14.6.3",
|
|
4
4
|
"description": "The Nx Plugin for Cypress contains executors and generators allowing your workspace to use the powerful Cypress integration testing capabilities.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"@babel/core": "^7.0.1",
|
|
37
37
|
"@babel/preset-env": "^7.0.0",
|
|
38
38
|
"@cypress/webpack-preprocessor": "^5.12.0",
|
|
39
|
-
"@nrwl/devkit": "14.6.
|
|
40
|
-
"@nrwl/linter": "14.6.
|
|
41
|
-
"@nrwl/workspace": "14.6.
|
|
39
|
+
"@nrwl/devkit": "14.6.3",
|
|
40
|
+
"@nrwl/linter": "14.6.3",
|
|
41
|
+
"@nrwl/workspace": "14.6.3",
|
|
42
42
|
"@phenomnomnominal/tsquery": "4.1.1",
|
|
43
43
|
"babel-loader": "^8.0.2",
|
|
44
44
|
"chalk": "4.1.0",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"optional": true
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "45f9bb54696c776dd2a3cce0581605ed3ff5107c"
|
|
65
65
|
}
|
|
@@ -3,9 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.nxE2EPreset = exports.nxBaseCypressPreset = void 0;
|
|
4
4
|
const devkit_1 = require("@nrwl/devkit");
|
|
5
5
|
const path_1 = require("path");
|
|
6
|
+
const fs_1 = require("fs");
|
|
6
7
|
function nxBaseCypressPreset(pathToConfig) {
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
// prevent from placing path outside the root of the workspace
|
|
9
|
+
// if they pass in a file or directory
|
|
10
|
+
const normalizedPath = (0, fs_1.lstatSync)(pathToConfig).isDirectory()
|
|
11
|
+
? pathToConfig
|
|
12
|
+
: (0, path_1.dirname)(pathToConfig);
|
|
13
|
+
const projectPath = (0, path_1.relative)(devkit_1.workspaceRoot, normalizedPath);
|
|
14
|
+
const offset = (0, path_1.relative)(normalizedPath, devkit_1.workspaceRoot);
|
|
9
15
|
const videosFolder = (0, path_1.join)(offset, 'dist', 'cypress', projectPath, 'videos');
|
|
10
16
|
const screenshotsFolder = (0, path_1.join)(offset, 'dist', 'cypress', projectPath, 'screenshots');
|
|
11
17
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cypress-preset.js","sourceRoot":"","sources":["../../../../packages/cypress/plugins/cypress-preset.ts"],"names":[],"mappings":";;;AAAA,yCAA6C;AAC7C,+
|
|
1
|
+
{"version":3,"file":"cypress-preset.js","sourceRoot":"","sources":["../../../../packages/cypress/plugins/cypress-preset.ts"],"names":[],"mappings":";;;AAAA,yCAA6C;AAC7C,+BAA+C;AAC/C,2BAA+B;AAS/B,SAAgB,mBAAmB,CAAC,YAAoB;IACtD,8DAA8D;IAC9D,sCAAsC;IACtC,MAAM,cAAc,GAAG,IAAA,cAAS,EAAC,YAAY,CAAC,CAAC,WAAW,EAAE;QAC1D,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,IAAA,cAAO,EAAC,YAAY,CAAC,CAAC;IAC1B,MAAM,WAAW,GAAG,IAAA,eAAQ,EAAC,sBAAa,EAAE,cAAc,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAG,IAAA,eAAQ,EAAC,cAAc,EAAE,sBAAa,CAAC,CAAC;IACvD,MAAM,YAAY,GAAG,IAAA,WAAI,EAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;IAC5E,MAAM,iBAAiB,GAAG,IAAA,WAAI,EAC5B,MAAM,EACN,MAAM,EACN,SAAS,EACT,WAAW,EACX,aAAa,CACd,CAAC;IAEF,OAAO;QACL,YAAY;QACZ,iBAAiB;QACjB,KAAK,EAAE,IAAI;QACX,iBAAiB,EAAE,KAAK;KACzB,CAAC;AACJ,CAAC;AAvBD,kDAuBC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,WAAW,CAAC,YAAoB;IAC9C,uCACK,mBAAmB,CAAC,YAAY,CAAC,KACpC,gBAAgB,EAAE,GAAG,EACrB,WAAW,EAAE,oBAAoB,EACjC,WAAW,EAAE,6BAA6B,EAC1C,cAAc,EAAE,cAAc,IAC9B;AACJ,CAAC;AARD,kCAQC"}
|
|
@@ -10,6 +10,8 @@ function cypressExecutor(options, context) {
|
|
|
10
10
|
var e_1, _a;
|
|
11
11
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
12
|
options = normalizeOptions(options, context);
|
|
13
|
+
// this is used by cypress component testing presets to build the executor contexts with the correct configuration options.
|
|
14
|
+
process.env.NX_CYPRESS_TARGET_CONFIGURATION = context.configurationName;
|
|
13
15
|
let success;
|
|
14
16
|
try {
|
|
15
17
|
for (var _b = tslib_1.__asyncValues(startDevServer(options, context)), _c; _c = yield _b.next(), !_c.done;) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cypress.impl.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/executors/cypress/cypress.impl.ts"],"names":[],"mappings":";;;AAAA,yCAOsB;AACtB,yBAAuB;AACvB,+BAA+C;AAC/C,iEAAsE;AAEtE,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,+DAA+D;AA8BnG,SAA8B,eAAe,CAC3C,OAA+B,EAC/B,OAAwB;;;QAExB,OAAO,GAAG,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"cypress.impl.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/executors/cypress/cypress.impl.ts"],"names":[],"mappings":";;;AAAA,yCAOsB;AACtB,yBAAuB;AACvB,+BAA+C;AAC/C,iEAAsE;AAEtE,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,+DAA+D;AA8BnG,SAA8B,eAAe,CAC3C,OAA+B,EAC/B,OAAwB;;;QAExB,OAAO,GAAG,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC7C,2HAA2H;QAC3H,OAAO,CAAC,GAAG,CAAC,+BAA+B,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACxE,IAAI,OAAO,CAAC;;YAEZ,KAA4B,IAAA,KAAA,sBAAA,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA,IAAA;gBAAjD,MAAM,OAAO,WAAA,CAAA;gBACtB,IAAI;oBACF,OAAO,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;oBAC7C,IAAI,CAAC,OAAO,CAAC,KAAK;wBAAE,MAAM;iBAC3B;gBAAC,OAAO,CAAC,EAAE;oBACV,eAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;oBACxB,OAAO,GAAG,KAAK,CAAC;oBAChB,IAAI,CAAC,OAAO,CAAC,KAAK;wBAAE,MAAM;iBAC3B;aACF;;;;;;;;;QAED,OAAO,EAAE,OAAO,EAAE,CAAC;;CACpB;AArBD,kCAqBC;AAED,SAAS,gBAAgB,CACvB,OAA+B,EAC/B,OAAwB;IAExB,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC;IAChC,IAAI,OAAO,CAAC,QAAQ,EAAE;QACpB,MAAM,YAAY,G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QAAQ,EAAE;YACjB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;SAClC;QAED,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;SAChD;QAED,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QAEvC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK;YAC9B,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;YACvB,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QAE1B;;;;WAIG;QACH,OAAO,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;;CAChD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Tree } from '@nrwl/devkit';
|
|
2
2
|
import { CypressComponentProjectSchema } from './schema';
|
|
3
3
|
export declare function cypressComponentProject(tree: Tree, options: CypressComponentProjectSchema): Promise<() => void>;
|
|
4
|
+
export declare function addToCacheableOperations(tree: Tree): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cypressComponentProject = void 0;
|
|
3
|
+
exports.addToCacheableOperations = exports.cypressComponentProject = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nrwl/devkit");
|
|
6
6
|
const cypress_version_1 = require("../../utils/cypress-version");
|
|
@@ -15,6 +15,7 @@ function cypressComponentProject(tree, options) {
|
|
|
15
15
|
const installDepsTask = updateDeps(tree);
|
|
16
16
|
addProjectFiles(tree, projectConfig, options);
|
|
17
17
|
addTargetToProject(tree, projectConfig, options);
|
|
18
|
+
addToCacheableOperations(tree);
|
|
18
19
|
if (!options.skipFormat) {
|
|
19
20
|
yield (0, devkit_1.formatFiles)(tree);
|
|
20
21
|
}
|
|
@@ -45,4 +46,14 @@ function addTargetToProject(tree, projectConfig, options) {
|
|
|
45
46
|
};
|
|
46
47
|
(0, devkit_1.updateProjectConfiguration)(tree, options.project, projectConfig);
|
|
47
48
|
}
|
|
49
|
+
function addToCacheableOperations(tree) {
|
|
50
|
+
(0, devkit_1.updateJson)(tree, 'nx.json', (json) => {
|
|
51
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
52
|
+
return (Object.assign(Object.assign({}, json), { tasksRunnerOptions: Object.assign(Object.assign({}, json.tasksRunnerOptions), { default: Object.assign(Object.assign({}, (_a = json.tasksRunnerOptions) === null || _a === void 0 ? void 0 : _a.default), { options: Object.assign(Object.assign({}, (_c = (_b = json.tasksRunnerOptions) === null || _b === void 0 ? void 0 : _b.default) === null || _c === void 0 ? void 0 : _c.options), { cacheableOperations: Array.from(new Set([
|
|
53
|
+
...((_g = (_f = (_e = (_d = json.tasksRunnerOptions) === null || _d === void 0 ? void 0 : _d.default) === null || _e === void 0 ? void 0 : _e.options) === null || _f === void 0 ? void 0 : _f.cacheableOperations) !== null && _g !== void 0 ? _g : []),
|
|
54
|
+
'component-test',
|
|
55
|
+
])) }) }) }) }));
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
exports.addToCacheableOperations = addToCacheableOperations;
|
|
48
59
|
//# sourceMappingURL=cypress-component-project.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cypress-component-project.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/generators/cypress-component-project/cypress-component-project.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"cypress-component-project.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/generators/cypress-component-project/cypress-component-project.ts"],"names":[],"mappings":";;;;AAAA,yCAYsB;AACtB,iEAAsE;AAEtE,mDAI8B;AAG9B,SAAsB,uBAAuB,CAC3C,IAAU,EACV,OAAsC;;QAEtC,MAAM,SAAS,GAAG,IAAA,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OAAsC;IAEtC,aAAa,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG;QACxC,QAAQ,EAAE,uBAAuB;QACjC,OAAO,EAAE;YACP,aAAa,EAAE,IAAA,0BAAiB,EAAC,aAAa,CAAC,IAAI,EAAE,mBAAmB,CAAC;YACzE,WAAW,EAAE,WAAW;SACzB;KACF,CAAC;IAEF,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AACnE,CAAC;AAED,SAAgB,wBAAwB,CAAC,IAAU;IACjD,IAAA,mBAAU,EAAC,IAAI,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE;;QAAC,OAAA,iCACjC,IAAI,KACP,kBAAkB,kCACb,IAAI,CAAC,kBAAkB,KAC1B,OAAO,kCACF,MAAA,IAAI,CAAC,kBAAkB,0CAAE,OAAO,KACnC,OAAO,kCACF,MAAA,MAAA,IAAI,CAAC,kBAAkB,0CAAE,OAAO,0CAAE,OAAO,KAC5C,mBAAmB,EAAE,KAAK,CAAC,IAAI,CAC7B,IAAI,GAAG,CAAC;4BACN,GAAG,CAAC,MAAA,MAAA,MAAA,MAAA,IAAI,CAAC,kBAAkB,0CAAE,OAAO,0CAAE,OAAO,0CACzC,mBAAmB,mCAAI,EAAE,CAAC;4BAC9B,gBAAgB;yBACjB,CAAC,CACH,aAIP,CAAA;KAAA,CAAC,CAAC;AACN,CAAC;AApBD,4DAoBC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateCypressConfigsPresets = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
+
const executor_options_utils_1 = require("@nrwl/workspace/src/utilities/executor-options-utils");
|
|
7
|
+
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
8
|
+
const cypress_version_1 = require("../../utils/cypress-version");
|
|
9
|
+
const find_target_options_1 = require("../../utils/find-target-options");
|
|
10
|
+
function updateCypressConfigsPresets(tree) {
|
|
11
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
|
+
if ((0, cypress_version_1.installedCypressVersion)() < 10) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const projectsWithoutDevServerTarget = new Set();
|
|
16
|
+
const updateTasks = [];
|
|
17
|
+
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/cypress:cypress', (options, projectName, targetName, configName) => {
|
|
18
|
+
var _a, _b, _c, _d;
|
|
19
|
+
if (options.cypressConfig && tree.exists(options.cypressConfig)) {
|
|
20
|
+
updatePreset(tree, options, targetName);
|
|
21
|
+
}
|
|
22
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
23
|
+
const testingType = options.testingType ||
|
|
24
|
+
((_b = (_a = projectConfig.targets[targetName]) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.testingType);
|
|
25
|
+
const devServerTarget = options.devServerTarget ||
|
|
26
|
+
((_d = (_c = projectConfig.targets[targetName]) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.devServerTarget);
|
|
27
|
+
if (!devServerTarget && testingType === 'component') {
|
|
28
|
+
updateTasks.push(addBuildTargetToConfig(tree, projectName, targetName, configName).then((didUpdate) => {
|
|
29
|
+
if (!didUpdate) {
|
|
30
|
+
projectsWithoutDevServerTarget.add(projectName);
|
|
31
|
+
}
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
if (updateTasks.length > 0) {
|
|
36
|
+
cacheComponentTestTarget(tree);
|
|
37
|
+
}
|
|
38
|
+
yield Promise.all(updateTasks);
|
|
39
|
+
if (projectsWithoutDevServerTarget.size > 0) {
|
|
40
|
+
devkit_1.logger.warn(`Unable to find a build target to add to the component testing target in the following projects:`);
|
|
41
|
+
devkit_1.logger.warn(`- ${Array.from(projectsWithoutDevServerTarget).join('\n- ')}`);
|
|
42
|
+
devkit_1.logger.warn((0, devkit_1.stripIndents) `
|
|
43
|
+
You can manually add the 'devServerTarget' option to the
|
|
44
|
+
component testing target to specify the build target to use.
|
|
45
|
+
The build configuration should be using @nrwl/web:webpack as the executor.
|
|
46
|
+
Usually this is a React app in your workspace.
|
|
47
|
+
Component testing will fallback to a default configuration if one isn't provided,
|
|
48
|
+
but might require modifications if your projects are more complex.
|
|
49
|
+
`);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
exports.updateCypressConfigsPresets = updateCypressConfigsPresets;
|
|
54
|
+
function updatePreset(tree, options, targetName) {
|
|
55
|
+
let contents = tsquery_1.tsquery.replace(tree.read(options.cypressConfig, 'utf-8'), 'CallExpression', (node) => {
|
|
56
|
+
// technically someone could have both component and e2e in the same project.
|
|
57
|
+
const expression = node.expression.getText();
|
|
58
|
+
if (expression === 'nxE2EPreset') {
|
|
59
|
+
return 'nxE2EPreset(__filename)';
|
|
60
|
+
}
|
|
61
|
+
else if (expression === 'nxE2EStorybookPreset') {
|
|
62
|
+
return 'nxE2EStorybookPreset(__filename)';
|
|
63
|
+
}
|
|
64
|
+
else if (node.expression.getText() === 'nxComponentTestingPreset') {
|
|
65
|
+
return targetName && targetName !== 'component-test' // the default
|
|
66
|
+
? `nxComponentTestingPreset(__filename, { ctTargetName: '${targetName}' })`
|
|
67
|
+
: 'nxComponentTestingPreset(__filename)';
|
|
68
|
+
}
|
|
69
|
+
return;
|
|
70
|
+
});
|
|
71
|
+
tree.write(options.cypressConfig, contents);
|
|
72
|
+
}
|
|
73
|
+
function addBuildTargetToConfig(tree, projectName, targetName, configName) {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const projectWithBuild = yield (0, find_target_options_1.findBuildConfig)(tree, {
|
|
77
|
+
project: projectName,
|
|
78
|
+
validExecutorNames: new Set(['@nrwl/web:webpack']),
|
|
79
|
+
});
|
|
80
|
+
// didn't find the config so can't update. consumer should collect list of them and display a warning at the end
|
|
81
|
+
// no reason to fail since the preset will fallback to a default config so should still keep working.
|
|
82
|
+
if (!(projectWithBuild === null || projectWithBuild === void 0 ? void 0 : projectWithBuild.target) || !(projectWithBuild === null || projectWithBuild === void 0 ? void 0 : projectWithBuild.config)) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
86
|
+
// if using a custom config and the devServerTarget default args
|
|
87
|
+
// has a different target, then add it to the custom target config
|
|
88
|
+
// otherwise add it to the default options
|
|
89
|
+
if (configName &&
|
|
90
|
+
projectWithBuild.target !==
|
|
91
|
+
((_b = (_a = projectConfig.targets[targetName]) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.devServerTarget)) {
|
|
92
|
+
projectConfig.targets[targetName].configurations[configName] = Object.assign(Object.assign({}, projectConfig.targets[targetName].configurations[configName]), { devServerTarget: projectWithBuild.target, skipServe: true });
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
projectConfig.targets[targetName].options = Object.assign(Object.assign({}, projectConfig.targets[targetName].options), { devServerTarget: projectWithBuild.target, skipServe: true });
|
|
96
|
+
}
|
|
97
|
+
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
|
98
|
+
return true;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function cacheComponentTestTarget(tree) {
|
|
102
|
+
(0, devkit_1.updateJson)(tree, 'nx.json', (json) => {
|
|
103
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
104
|
+
return (Object.assign(Object.assign({}, json), { tasksRunnerOptions: Object.assign(Object.assign({}, json.tasksRunnerOptions), { default: Object.assign(Object.assign({}, (_a = json.tasksRunnerOptions) === null || _a === void 0 ? void 0 : _a.default), { options: Object.assign(Object.assign({}, (_c = (_b = json.tasksRunnerOptions) === null || _b === void 0 ? void 0 : _b.default) === null || _c === void 0 ? void 0 : _c.options), { cacheableOperations: Array.from(new Set([
|
|
105
|
+
...((_g = (_f = (_e = (_d = json.tasksRunnerOptions) === null || _d === void 0 ? void 0 : _d.default) === null || _e === void 0 ? void 0 : _e.options) === null || _f === void 0 ? void 0 : _f.cacheableOperations) !== null && _g !== void 0 ? _g : []),
|
|
106
|
+
'component-test',
|
|
107
|
+
])) }) }) }) }));
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
exports.default = updateCypressConfigsPresets;
|
|
111
|
+
//# sourceMappingURL=update-cypress-configs-presets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-cypress-configs-presets.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/migrations/update-14-6-1/update-cypress-configs-presets.ts"],"names":[],"mappings":";;;;AAAA,yCAOsB;AACtB,iGAA8F;AAC9F,uDAAoD;AAGpD,iEAAsE;AACtE,yEAAkE;AAElE,SAAsB,2BAA2B,CAAC,IAAU;;QAC1D,IAAI,IAAA,yCAAuB,GAAE,GAAG,EAAE,EAAE;YAClC,OAAO;SACR;QAED,MAAM,8BAA8B,GAAG,IAAI,GAAG,EAAU,CAAC;QACzD,MAAM,WAAW,GAAG,EAAE,CAAC;QACvB,IAAA,+CAAsB,EACpB,IAAI,EACJ,uBAAuB,EACvB,CAAC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE;;YAC/C,IAAI,OAAO,CAAC,aAAa,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;gBAC/D,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;aACzC;YAED,MAAM,aAAa,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;YAClE,MAAM,WAAW,GACf,OAAO,CAAC,WAAW;iBACnB,MAAA,MAAA,aAAa,CAAC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';
|
|
2
|
+
interface FindTargetOptions {
|
|
3
|
+
project: string;
|
|
4
|
+
/**
|
|
5
|
+
* contains buildable target such as react app or angular app
|
|
6
|
+
* <project>:<target>[:<configuration>]
|
|
7
|
+
*/
|
|
8
|
+
buildTarget?: string;
|
|
9
|
+
validExecutorNames: Set<string>;
|
|
10
|
+
}
|
|
11
|
+
interface FoundTarget {
|
|
12
|
+
config: TargetConfiguration;
|
|
13
|
+
target: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function findBuildConfig(tree: Tree, options: FindTargetOptions): Promise<FoundTarget>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findBuildConfig = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
+
const project_graph_1 = require("nx/src/project-graph/project-graph");
|
|
7
|
+
function findBuildConfig(tree, options) {
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
// attempt to use the provided target
|
|
10
|
+
const graph = yield (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.validExecutorNames);
|
|
19
|
+
if (selfProject) {
|
|
20
|
+
return selfProject;
|
|
21
|
+
}
|
|
22
|
+
// attempt to find any projects with the valid config in the graph that consumes this project
|
|
23
|
+
return yield findInGraph(tree, graph, options);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
exports.findBuildConfig = findBuildConfig;
|
|
27
|
+
function findInTarget(tree, graph, options) {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
const { project, target, configuration } = (0, devkit_1.parseTargetString)(options.buildTarget);
|
|
30
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
31
|
+
const foundConfig = configuration || ((_b = (_a = projectConfig === null || projectConfig === void 0 ? void 0 : projectConfig.targets) === null || _a === void 0 ? void 0 : _a[target]) === null || _b === void 0 ? void 0 : _b.defaultConfiguration);
|
|
32
|
+
return (0, devkit_1.readTargetOptions)({ project, target, configuration: foundConfig }, createExecutorContext(graph, projectConfig.targets, project, target, foundConfig));
|
|
33
|
+
}
|
|
34
|
+
function findInGraph(tree, graph, options) {
|
|
35
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const parents = findParentsOfProject(graph, options.project);
|
|
37
|
+
const potentialTargets = [];
|
|
38
|
+
for (const parent of parents) {
|
|
39
|
+
const parentProject = findTargetOptionsInProject(tree, graph, parent.target, options.validExecutorNames);
|
|
40
|
+
if (parentProject) {
|
|
41
|
+
potentialTargets.push(parentProject);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (potentialTargets.length > 1) {
|
|
45
|
+
devkit_1.logger.warn((0, devkit_1.stripIndents) `Multiple potential targets found for ${options.project}. Found ${potentialTargets.length}.
|
|
46
|
+
Using ${potentialTargets[0].target}.
|
|
47
|
+
To specify a different target use the --build-target flag.
|
|
48
|
+
`);
|
|
49
|
+
}
|
|
50
|
+
return potentialTargets[0];
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function findParentsOfProject(graph, projectName) {
|
|
54
|
+
const reversedGraph = (0, devkit_1.reverse)(graph);
|
|
55
|
+
return reversedGraph.dependencies[projectName]
|
|
56
|
+
? Object.values(reversedGraph.dependencies[projectName])
|
|
57
|
+
: [];
|
|
58
|
+
}
|
|
59
|
+
function findTargetOptionsInProject(tree, graph, projectName, includes) {
|
|
60
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
61
|
+
for (const targetName in projectConfig.targets) {
|
|
62
|
+
const targetConfig = projectConfig.targets[targetName];
|
|
63
|
+
if (includes.has(targetConfig.executor)) {
|
|
64
|
+
return {
|
|
65
|
+
target: `${projectName}:${targetName}`,
|
|
66
|
+
config: (0, devkit_1.readTargetOptions)({ project: projectName, target: targetName }, createExecutorContext(graph, projectConfig.targets, projectName, targetName, null)),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function createExecutorContext(graph, targets, projectName, targetName, configurationName) {
|
|
72
|
+
const projectConfigs = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(graph);
|
|
73
|
+
return {
|
|
74
|
+
cwd: process.cwd(),
|
|
75
|
+
projectGraph: graph,
|
|
76
|
+
target: targets[targetName],
|
|
77
|
+
targetName,
|
|
78
|
+
configurationName,
|
|
79
|
+
root: devkit_1.workspaceRoot,
|
|
80
|
+
isVerbose: false,
|
|
81
|
+
projectName,
|
|
82
|
+
workspace: Object.assign(Object.assign({}, (0, devkit_1.readNxJson)()), projectConfigs),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=find-target-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-target-options.js","sourceRoot":"","sources":["../../../../../packages/cypress/src/utils/find-target-options.ts"],"names":[],"mappings":";;;;AAAA,yCAesB;AACtB,sEAA+F;AAiB/F,SAAsB,eAAe,CACnC,IAAU,EACV,OAA0B;;QAE1B,qCAAqC;QACrC,MAAM,KAAK,GAAG,MAAM,IAAA,gCAAuB,GAAE,CAAC;QAC9C,IAAI,OAAO,CAAC,WAAW,EAAE;YACvB,OAAO;gBACL,MAAM,EAAE,OAAO,CAAC,WAAW;gBAC3B,MAAM,EAAE,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC;aAC3C,CAAC;SACH;QACD,+DAA+D;QAC/D,MAAM,WAAW,GAAG,0BAA0B,CAC5C,IAAI,EACJ,KAAK,EACL,O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