@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 +1 -1
- package/package.json +6 -6
- package/src/generators/cypress-project/cypress-project.d.ts +4 -0
- package/src/generators/cypress-project/cypress-project.js +47 -40
- package/src/generators/cypress-project/schema.d.ts +3 -1
- package/src/generators/cypress-project/schema.json +5 -0
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#
|
|
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-
|
|
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-
|
|
38
|
-
"@nx/devkit": "16.7.0-
|
|
39
|
-
"@nx/js": "16.7.0-
|
|
40
|
-
"@nx/linter": "16.7.0-
|
|
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": "
|
|
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
|
|
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
|
-
|
|
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.
|
|
146
|
+
exports.cypressProjectGeneratorInternal = cypressProjectGeneratorInternal;
|
|
138
147
|
function normalizeOptions(host, options) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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 {
|
|
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",
|