@nx/cypress 21.2.3 → 21.3.0-beta.0

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