@nx/cypress 16.7.0-beta.5 → 16.7.0-rc.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/generators.json CHANGED
@@ -41,7 +41,7 @@
41
41
  "hidden": true
42
42
  },
43
43
  "cypress-project": {
44
- "factory": "./src/generators/cypress-project/cypress-project#cypressProjectGenerator",
44
+ "factory": "./src/generators/cypress-project/cypress-project#cypressProjectGeneratorInternal",
45
45
  "schema": "./src/generators/cypress-project/schema.json",
46
46
  "description": "Add a Cypress E2E Project.",
47
47
  "hidden": true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/cypress",
3
- "version": "16.7.0-beta.5",
3
+ "version": "16.7.0-rc.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": {
@@ -34,10 +34,10 @@
34
34
  "migrations": "./migrations.json"
35
35
  },
36
36
  "dependencies": {
37
- "@nrwl/cypress": "16.7.0-beta.5",
38
- "@nx/devkit": "16.7.0-beta.5",
39
- "@nx/js": "16.7.0-beta.5",
40
- "@nx/linter": "16.7.0-beta.5",
37
+ "@nrwl/cypress": "16.7.0-rc.0",
38
+ "@nx/devkit": "16.7.0-rc.0",
39
+ "@nx/js": "16.7.0-rc.0",
40
+ "@nx/linter": "16.7.0-rc.0",
41
41
  "@phenomnomnominal/tsquery": "~5.0.1",
42
42
  "detect-port": "^1.5.1",
43
43
  "dotenv": "~16.3.1",
@@ -56,5 +56,5 @@
56
56
  "access": "public"
57
57
  },
58
58
  "type": "commonjs",
59
- "gitHead": "fa513731d4e6a960f112a5af6b0d725b2e624b36"
59
+ "gitHead": "d1f76ff83fa110c3332f617e6433fcd5b2bf7201"
60
60
  }
@@ -9,5 +9,9 @@ export interface CypressProjectSchema extends Schema {
9
9
  * @deprecated use cypressE2EConfigurationGenerator instead
10
10
  **/
11
11
  export declare function cypressProjectGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
12
+ /**
13
+ * @deprecated use cypressE2EConfigurationGenerator instead
14
+ **/
15
+ export declare function cypressProjectGeneratorInternal(host: Tree, schema: Schema): Promise<GeneratorCallback>;
12
16
  export default cypressProjectGenerator;
13
17
  export declare const cypressProjectSchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cypressProjectSchematic = exports.cypressProjectGenerator = void 0;
3
+ exports.cypressProjectSchematic = exports.cypressProjectGeneratorInternal = exports.cypressProjectGenerator = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const devkit_1 = require("@nx/devkit");
6
- const linter_1 = require("@nx/linter");
6
+ const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
7
+ const semver_1 = require("@nx/devkit/src/utils/semver");
7
8
  const js_1 = require("@nx/js");
9
+ const linter_1 = require("@nx/linter");
8
10
  const path_1 = require("path");
11
+ const semver_2 = require("semver");
12
+ const add_linter_1 = require("../../utils/add-linter");
9
13
  const cypress_version_1 = require("../../utils/cypress-version");
10
- const project_name_1 = require("../../utils/project-name");
11
14
  const versions_1 = require("../../utils/versions");
12
15
  const init_1 = require("../init/init");
13
- const add_linter_1 = require("../../utils/add-linter");
14
- const semver_1 = require("@nx/devkit/src/utils/semver");
15
- const semver_2 = require("semver");
16
16
  function createFiles(tree, options) {
17
17
  // if not installed or >v10 use v10 folder
18
18
  // else use v9 folder
@@ -111,7 +111,16 @@ function addProject(tree, options) {
111
111
  **/
112
112
  function cypressProjectGenerator(host, schema) {
113
113
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
114
- const options = normalizeOptions(host, schema);
114
+ return yield cypressProjectGeneratorInternal(host, Object.assign({ projectNameAndRootFormat: 'derived' }, schema));
115
+ });
116
+ }
117
+ exports.cypressProjectGenerator = cypressProjectGenerator;
118
+ /**
119
+ * @deprecated use cypressE2EConfigurationGenerator instead
120
+ **/
121
+ function cypressProjectGeneratorInternal(host, schema) {
122
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
123
+ const options = yield normalizeOptions(host, schema);
115
124
  const tasks = [];
116
125
  const cypressVersion = (0, cypress_version_1.installedCypressVersion)();
117
126
  // if there is an installed cypress version, then we don't call
@@ -134,40 +143,38 @@ function cypressProjectGenerator(host, schema) {
134
143
  return (0, devkit_1.runTasksInSerial)(...tasks);
135
144
  });
136
145
  }
137
- exports.cypressProjectGenerator = cypressProjectGenerator;
146
+ exports.cypressProjectGeneratorInternal = cypressProjectGeneratorInternal;
138
147
  function normalizeOptions(host, options) {
139
- const { layoutDirectory, projectDirectory } = (0, devkit_1.extractLayoutDirectory)(options.directory);
140
- const appsDir = layoutDirectory !== null && layoutDirectory !== void 0 ? layoutDirectory : (0, devkit_1.getWorkspaceLayout)(host).appsDir;
141
- let projectName;
142
- let projectRoot;
143
- let maybeRootProject;
144
- let isRootProject = false;
145
- const projects = (0, devkit_1.getProjects)(host);
146
- // nx will set the project option for generators when ran within a project.
147
- // since the root project will always be set for standlone projects we can just check it here.
148
- if (options.project) {
149
- maybeRootProject = projects.get(options.project);
150
- }
151
- if ((maybeRootProject === null || maybeRootProject === void 0 ? void 0 : maybeRootProject.root) === '.' ||
152
- // should still check to see if we are in a standalone based workspace
153
- (!maybeRootProject &&
154
- Array.from(projects.values()).some((config) => config.root === '.'))) {
155
- projectName = options.name;
156
- projectRoot = options.name;
157
- isRootProject = true;
158
- }
159
- else {
160
- projectName = (0, project_name_1.filePathPrefix)(projectDirectory ? `${projectDirectory}-${options.name}` : options.name);
161
- projectRoot = projectDirectory
162
- ? (0, devkit_1.joinPathFragments)(appsDir, (0, devkit_1.names)(projectDirectory).fileName, options.name)
163
- : (0, devkit_1.joinPathFragments)(appsDir, options.name);
164
- }
165
- options.linter = options.linter || linter_1.Linter.EsLint;
166
- options.bundler = options.bundler || 'webpack';
167
- return Object.assign(Object.assign({}, options), {
168
- // other generators depend on the rootProject flag down stream
169
- rootProject: isRootProject, projectName,
170
- projectRoot });
148
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
149
+ let maybeRootProject;
150
+ let isRootProject = false;
151
+ const projects = (0, devkit_1.getProjects)(host);
152
+ // nx will set the project option for generators when ran within a project.
153
+ // since the root project will always be set for standalone projects we can just check it here.
154
+ if (options.project) {
155
+ maybeRootProject = projects.get(options.project);
156
+ }
157
+ if ((maybeRootProject === null || maybeRootProject === void 0 ? void 0 : maybeRootProject.root) === '.' ||
158
+ // should still check to see if we are in a standalone based workspace
159
+ (!maybeRootProject &&
160
+ Array.from(projects.values()).some((config) => config.root === '.'))) {
161
+ isRootProject = true;
162
+ }
163
+ let { projectName, projectRoot } = yield (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
164
+ name: options.name,
165
+ projectType: 'application',
166
+ directory: isRootProject ? options.name : options.directory,
167
+ projectNameAndRootFormat: isRootProject
168
+ ? 'as-provided'
169
+ : options.projectNameAndRootFormat,
170
+ });
171
+ options.linter = options.linter || linter_1.Linter.EsLint;
172
+ options.bundler = options.bundler || 'webpack';
173
+ return Object.assign(Object.assign({}, options), {
174
+ // other generators depend on the rootProject flag down stream
175
+ rootProject: isRootProject, projectName,
176
+ projectRoot });
177
+ });
171
178
  }
172
179
  exports.default = cypressProjectGenerator;
173
180
  exports.cypressProjectSchematic = (0, devkit_1.convertNxGenerator)(cypressProjectGenerator);
@@ -1,10 +1,12 @@
1
- import { Linter } from '@nx/linter';
1
+ import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
2
+ import type { Linter } from '@nx/linter';
2
3
 
3
4
  export interface Schema {
4
5
  project?: string;
5
6
  baseUrl?: string;
6
7
  name: string;
7
8
  directory?: string;
9
+ projectNameAndRootFormat?: ProjectNameAndRootFormat;
8
10
  linter?: Linter;
9
11
  js?: boolean;
10
12
  skipFormat?: boolean;
@@ -32,6 +32,11 @@
32
32
  "description": "A directory where the project is placed.",
33
33
  "x-priority": "important"
34
34
  },
35
+ "projectNameAndRootFormat": {
36
+ "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
37
+ "type": "string",
38
+ "enum": ["as-provided", "derived"]
39
+ },
35
40
  "linter": {
36
41
  "description": "The tool to use for running lint checks.",
37
42
  "type": "string",