@nx/cypress 21.2.2 → 21.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/cypress",
3
- "version": "21.2.2",
3
+ "version": "21.2.3",
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": "21.2.2",
40
- "@nx/eslint": "21.2.2",
41
- "@nx/js": "21.2.2",
39
+ "@nx/devkit": "21.2.3",
40
+ "@nx/eslint": "21.2.3",
41
+ "@nx/js": "21.2.3",
42
42
  "@phenomnomnominal/tsquery": "~5.0.1",
43
43
  "detect-port": "^1.5.1",
44
44
  "semver": "^7.6.3",
@@ -9,8 +9,9 @@ exports.writeNewConfig = writeNewConfig;
9
9
  exports.addConfigToTsConfig = addConfigToTsConfig;
10
10
  exports.updatePluginFile = updatePluginFile;
11
11
  const devkit_1 = require("@nx/devkit");
12
- const path_1 = require("path");
13
12
  const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
13
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
14
+ const path_1 = require("path");
14
15
  let tsModule;
15
16
  let tsquery;
16
17
  const validFilesEndingsToUpdate = [
@@ -50,7 +51,8 @@ function createNewCypressConfig(tree, projectConfig, cypressConfigPathJson) {
50
51
  const { modifyObstructiveCode = null, // no longer needed in configs
51
52
  integrationFolder = 'src/e2e', // provide the new defaults if the value isn't present
52
53
  supportFile = 'src/support/e2e.ts', ...restOfConfig } = cypressConfigJson;
53
- const newIntegrationFolder = tree.exists((0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'integration'))
54
+ const sourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(projectConfig, tree);
55
+ const newIntegrationFolder = tree.exists((0, devkit_1.joinPathFragments)(sourceRoot, 'integration'))
54
56
  ? 'src/e2e'
55
57
  : integrationFolder;
56
58
  const cypressConfigTs = {
@@ -61,8 +63,8 @@ function createNewCypressConfig(tree, projectConfig, cypressConfigPathJson) {
61
63
  // then use the new default location.
62
64
  // otherwise we will use the existing folder location/falsey value
63
65
  supportFile: (supportFile &&
64
- tree.exists((0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'support', 'index.ts'))) ||
65
- tree.exists((0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'support', 'e2e.ts'))
66
+ tree.exists((0, devkit_1.joinPathFragments)(sourceRoot, 'support', 'index.ts'))) ||
67
+ tree.exists((0, devkit_1.joinPathFragments)(sourceRoot, 'support', 'e2e.ts'))
66
68
  ? 'src/support/e2e.ts'
67
69
  : supportFile,
68
70
  // if the default location is used then will update to the new location otherwise keep the custom location
@@ -97,6 +99,7 @@ function createSupportFileImport(oldSupportFilePath, newSupportFilePath, project
97
99
  }
98
100
  function updateProjectPaths(tree, projectConfig, { cypressConfigTs, cypressConfigJson, }) {
99
101
  const { integrationFolder, supportFile } = cypressConfigTs['e2e'];
102
+ const sourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(projectConfig, tree);
100
103
  const oldIntegrationFolder = (0, devkit_1.joinPathFragments)(projectConfig.root, cypressConfigJson.integrationFolder);
101
104
  const newIntegrationFolder = (0, devkit_1.joinPathFragments)(projectConfig.root, integrationFolder);
102
105
  let newSupportFile;
@@ -121,9 +124,9 @@ function updateProjectPaths(tree, projectConfig, { cypressConfigTs, cypressConfi
121
124
  shouldUpdateSupportFileImports = false;
122
125
  newSupportFile = supportFile;
123
126
  // rename the default support file even if not in use to keep the system in sync with cypress v10
124
- const defaultSupportFile = (0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'support', 'index.ts');
127
+ const defaultSupportFile = (0, devkit_1.joinPathFragments)(sourceRoot, 'support', 'index.ts');
125
128
  if (tree.exists(defaultSupportFile)) {
126
- const newSupportDefaultPath = (0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'support', 'e2e.ts');
129
+ const newSupportDefaultPath = (0, devkit_1.joinPathFragments)(sourceRoot, 'support', 'e2e.ts');
127
130
  if (defaultSupportFile !== newSupportDefaultPath &&
128
131
  tree.exists(defaultSupportFile)) {
129
132
  tree.rename(defaultSupportFile, newSupportDefaultPath);
@@ -131,13 +134,13 @@ function updateProjectPaths(tree, projectConfig, { cypressConfigTs, cypressConfi
131
134
  }
132
135
  }
133
136
  if (shouldUpdateSupportFileImports) {
134
- const newImportPaths = createSupportFileImport(oldSupportFile, newSupportFile, projectConfig.sourceRoot);
137
+ const newImportPaths = createSupportFileImport(oldSupportFile, newSupportFile, sourceRoot);
135
138
  oldImportLeafPath = newImportPaths.oldImportPathLeaf;
136
139
  newImportLeafPath = newImportPaths.newImportPathLeaf;
137
140
  }
138
141
  // tree.rename doesn't work on directories must update each file within
139
142
  // the directory to the new directory
140
- (0, devkit_1.visitNotIgnoredFiles)(tree, projectConfig.sourceRoot, (path) => {
143
+ (0, devkit_1.visitNotIgnoredFiles)(tree, sourceRoot, (path) => {
141
144
  const normalizedPath = (0, devkit_1.normalizePath)(path);
142
145
  if (!normalizedPath.includes(oldIntegrationFolder)) {
143
146
  return;