@nx/cypress 22.6.0-beta.1 → 22.6.0-beta.10
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": "22.6.0-beta.
|
|
3
|
+
"version": "22.6.0-beta.10",
|
|
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": {
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"migrations": "./migrations.json"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@nx/devkit": "22.6.0-beta.
|
|
40
|
-
"@nx/eslint": "22.6.0-beta.
|
|
41
|
-
"@nx/js": "22.6.0-beta.
|
|
39
|
+
"@nx/devkit": "22.6.0-beta.10",
|
|
40
|
+
"@nx/eslint": "22.6.0-beta.10",
|
|
41
|
+
"@nx/js": "22.6.0-beta.10",
|
|
42
42
|
"@phenomnomnominal/tsquery": "~6.1.4",
|
|
43
43
|
"detect-port": "^1.5.1",
|
|
44
44
|
"semver": "^7.6.3",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"tslib": "^2.3.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"nx": "22.6.0-beta.
|
|
49
|
+
"nx": "22.6.0-beta.10"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"cypress": ">= 13 < 16"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/cypress/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/cypress/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EAQnB,MAAM,YAAY,CAAC;AAapB,MAAM,WAAW,oBAAoB;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACvC;AAgBD,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,oBAAoB,CAqB3D,CAAC;AAEF,eAAO,MAAM,aAAa,qCAAc,CAAC"}
|
package/src/plugins/plugin.js
CHANGED
|
@@ -9,22 +9,10 @@ const js_1 = require("@nx/js");
|
|
|
9
9
|
const fs_1 = require("fs");
|
|
10
10
|
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
11
11
|
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
12
|
+
const plugin_cache_utils_1 = require("nx/src/utils/plugin-cache-utils");
|
|
12
13
|
const workspace_context_1 = require("nx/src/utils/workspace-context");
|
|
13
14
|
const path_1 = require("path");
|
|
14
15
|
const constants_1 = require("../utils/constants");
|
|
15
|
-
function readTargetsCache(cachePath) {
|
|
16
|
-
try {
|
|
17
|
-
return process.env.NX_CACHE_PROJECT_GRAPH !== 'false'
|
|
18
|
-
? (0, devkit_1.readJsonFile)(cachePath)
|
|
19
|
-
: {};
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
return {};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function writeTargetsToCache(cachePath, results) {
|
|
26
|
-
(0, devkit_1.writeJsonFile)(cachePath, results);
|
|
27
|
-
}
|
|
28
16
|
const cypressConfigGlob = '**/cypress.config.{js,ts,mjs,cjs}';
|
|
29
17
|
const defaultPatterns = {
|
|
30
18
|
e2e: {
|
|
@@ -42,17 +30,17 @@ exports.createNodes = [
|
|
|
42
30
|
async (configFiles, options, context) => {
|
|
43
31
|
const optionsHash = (0, devkit_internals_1.hashObject)(options);
|
|
44
32
|
const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `cypress-${optionsHash}.hash`);
|
|
45
|
-
const
|
|
33
|
+
const pluginCache = new plugin_cache_utils_1.PluginCache(cachePath);
|
|
46
34
|
try {
|
|
47
|
-
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context,
|
|
35
|
+
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, pluginCache), configFiles, options, context);
|
|
48
36
|
}
|
|
49
37
|
finally {
|
|
50
|
-
|
|
38
|
+
pluginCache.writeToDisk(cachePath);
|
|
51
39
|
}
|
|
52
40
|
},
|
|
53
41
|
];
|
|
54
42
|
exports.createNodesV2 = exports.createNodes;
|
|
55
|
-
async function createNodesInternal(configFilePath, options, context,
|
|
43
|
+
async function createNodesInternal(configFilePath, options, context, pluginCache) {
|
|
56
44
|
options = normalizeOptions(options);
|
|
57
45
|
const projectRoot = (0, path_1.dirname)(configFilePath);
|
|
58
46
|
// Do not create a project if package.json and project.json isn't there.
|
|
@@ -62,8 +50,10 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
|
|
|
62
50
|
return {};
|
|
63
51
|
}
|
|
64
52
|
const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
if (!pluginCache.has(hash)) {
|
|
54
|
+
pluginCache.set(hash, await buildCypressTargets(configFilePath, projectRoot, options, context));
|
|
55
|
+
}
|
|
56
|
+
const { targets, metadata } = pluginCache.get(hash);
|
|
67
57
|
const project = {
|
|
68
58
|
projectType: 'application',
|
|
69
59
|
targets,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-dev-server.d.ts","sourceRoot":"","sources":["../../../../../packages/cypress/src/utils/start-dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAShB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"start-dev-server.d.ts","sourceRoot":"","sources":["../../../../../packages/cypress/src/utils/start-dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAShB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAW3E,wBAAuB,cAAc,CACnC,IAAI,EAAE,IAAI,CAAC,sBAAsB,EAAE,eAAe,CAAC,EACnD,OAAO,EAAE,eAAe;;;;;;kBAiEzB"}
|
|
@@ -6,6 +6,8 @@ const path_1 = require("path");
|
|
|
6
6
|
const detectPort = require("detect-port");
|
|
7
7
|
const executor_utils_1 = require("nx/src/command-line/run/executor-utils");
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
|
+
const os_1 = require("os");
|
|
10
|
+
const PORT_LOCK_DIR = (0, path_1.join)((0, os_1.tmpdir)(), 'nx-cypress-port-locks');
|
|
9
11
|
async function* startDevServer(opts, context) {
|
|
10
12
|
// no dev server, return the provisioned base url
|
|
11
13
|
if (!opts.devServerTarget || opts.skipServe) {
|
|
@@ -46,7 +48,7 @@ If the port is in use, try using a different port value or passing --port='cypre
|
|
|
46
48
|
}
|
|
47
49
|
yield {
|
|
48
50
|
baseUrl: opts.baseUrl || output.baseUrl || output.info?.baseUrl,
|
|
49
|
-
portLockFilePath: overrides.port && (0, path_1.join)(
|
|
51
|
+
portLockFilePath: overrides.port && (0, path_1.join)(PORT_LOCK_DIR, `${overrides.port}.lock`),
|
|
50
52
|
};
|
|
51
53
|
}
|
|
52
54
|
}
|
|
@@ -142,7 +144,13 @@ ${e.message || e}`);
|
|
|
142
144
|
return [targetHasOpt, targetOpts[property]];
|
|
143
145
|
}
|
|
144
146
|
function attemptToLockPort(port) {
|
|
145
|
-
|
|
147
|
+
try {
|
|
148
|
+
(0, fs_1.mkdirSync)(PORT_LOCK_DIR, { recursive: true });
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
// ignore if already exists
|
|
152
|
+
}
|
|
153
|
+
const portLockFilePath = (0, path_1.join)(PORT_LOCK_DIR, `${port}.lock`);
|
|
146
154
|
try {
|
|
147
155
|
if ((0, fs_1.existsSync)(portLockFilePath)) {
|
|
148
156
|
return false;
|