@nx/cypress 17.0.1 → 17.1.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/index.d.ts +4 -2
- package/index.js +6 -3
- package/package.json +5 -5
- package/src/generators/base-setup/base-setup.d.ts +1 -0
- package/src/generators/base-setup/base-setup.js +1 -0
- package/src/generators/base-setup/files/__directory__/{tsconfig.json → tsconfig.json__ext__} +2 -2
- package/src/generators/component-configuration/component-configuration.js +1 -0
- package/src/generators/component-configuration/schema.d.ts +1 -0
- package/src/generators/component-configuration/schema.json +5 -0
- package/src/generators/configuration/configuration.d.ts +2 -0
- package/src/generators/configuration/configuration.js +15 -7
- package/src/generators/configuration/schema.json +5 -0
- package/src/generators/cypress-project/schema.d.ts +0 -1
- package/src/generators/cypress-project/schema.json +0 -6
package/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { configurationGenerator } from './src/generators/configuration/configuration';
|
|
2
2
|
import { componentConfigurationGenerator } from './src/generators/component-configuration/component-configuration';
|
|
3
|
+
import { cypressProjectGenerator as _cypressProjectGenerator } from './src/generators/cypress-project/cypress-project';
|
|
3
4
|
export { configurationGenerator, componentConfigurationGenerator };
|
|
4
|
-
/** @deprecated Use `configurationGenerator` instead. */
|
|
5
|
+
/** @deprecated Use `configurationGenerator` instead. It will be removed in Nx 18. */
|
|
5
6
|
export declare const cypressComponentConfiguration: typeof componentConfigurationGenerator;
|
|
6
7
|
export { configurationGenerator as cypressE2EConfigurationGenerator };
|
|
7
|
-
|
|
8
|
+
/** @deprecated Add a new project and call `configurationGenerator` instead. It will be removed in Nx 18. */
|
|
9
|
+
export declare const cypressProjectGenerator: typeof _cypressProjectGenerator;
|
|
8
10
|
export { cypressInitGenerator } from './src/generators/init/init';
|
|
9
11
|
export { migrateCypressProject } from './src/generators/migrate-to-cypress-11/migrate-to-cypress-11';
|
package/index.js
CHANGED
|
@@ -6,11 +6,14 @@ Object.defineProperty(exports, "configurationGenerator", { enumerable: true, get
|
|
|
6
6
|
Object.defineProperty(exports, "cypressE2EConfigurationGenerator", { enumerable: true, get: function () { return configuration_1.configurationGenerator; } });
|
|
7
7
|
const component_configuration_1 = require("./src/generators/component-configuration/component-configuration");
|
|
8
8
|
Object.defineProperty(exports, "componentConfigurationGenerator", { enumerable: true, get: function () { return component_configuration_1.componentConfigurationGenerator; } });
|
|
9
|
+
const cypress_project_1 = require("./src/generators/cypress-project/cypress-project");
|
|
9
10
|
// Maintain backwards compatibility with the old names in case community plugins used them.
|
|
10
|
-
|
|
11
|
+
// TODO(v18): Remove old name
|
|
12
|
+
/** @deprecated Use `configurationGenerator` instead. It will be removed in Nx 18. */
|
|
11
13
|
exports.cypressComponentConfiguration = component_configuration_1.componentConfigurationGenerator;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
// TODO(v18): Remove project generator
|
|
15
|
+
/** @deprecated Add a new project and call `configurationGenerator` instead. It will be removed in Nx 18. */
|
|
16
|
+
exports.cypressProjectGenerator = cypress_project_1.cypressProjectGenerator;
|
|
14
17
|
var init_1 = require("./src/generators/init/init");
|
|
15
18
|
Object.defineProperty(exports, "cypressInitGenerator", { enumerable: true, get: function () { return init_1.cypressInitGenerator; } });
|
|
16
19
|
var migrate_to_cypress_11_1 = require("./src/generators/migrate-to-cypress-11/migrate-to-cypress-11");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/cypress",
|
|
3
|
-
"version": "17.0.
|
|
3
|
+
"version": "17.1.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": {
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"detect-port": "^1.5.1",
|
|
39
39
|
"semver": "7.5.3",
|
|
40
40
|
"tslib": "^2.3.0",
|
|
41
|
-
"@nx/devkit": "17.0.
|
|
42
|
-
"@nx/js": "17.0.
|
|
43
|
-
"@nx/eslint": "17.0.
|
|
44
|
-
"@nrwl/cypress": "17.0.
|
|
41
|
+
"@nx/devkit": "17.1.0-beta.0",
|
|
42
|
+
"@nx/js": "17.1.0-beta.0",
|
|
43
|
+
"@nx/eslint": "17.1.0-beta.0",
|
|
44
|
+
"@nrwl/cypress": "17.1.0-beta.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"cypress": ">= 3 < 14"
|
|
@@ -12,6 +12,7 @@ function addBaseCypressSetup(tree, options) {
|
|
|
12
12
|
const opts = normalizeOptions(tree, projectConfig, options);
|
|
13
13
|
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files'), projectConfig.root, {
|
|
14
14
|
...opts,
|
|
15
|
+
jsx: !!opts.jsx,
|
|
15
16
|
offsetFromRoot: (0, devkit_1.offsetFromRoot)(projectConfig.root),
|
|
16
17
|
offsetFromProjectRoot: opts.hasTsConfig ? opts.offsetFromProjectRoot : '',
|
|
17
18
|
tsConfigPath: opts.hasTsConfig
|
package/src/generators/base-setup/files/__directory__/{tsconfig.json → tsconfig.json__ext__}
RENAMED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"**/*.js",
|
|
13
13
|
"<%= offsetFromProjectRoot %>cypress.config.ts",
|
|
14
14
|
"<%= offsetFromProjectRoot %>**/*.cy.ts",
|
|
15
|
-
"<%= offsetFromProjectRoot %>**/*.cy.tsx"
|
|
15
|
+
<% if (jsx) { %> "<%= offsetFromProjectRoot %>**/*.cy.tsx",<% } %>
|
|
16
16
|
"<%= offsetFromProjectRoot %>**/*.cy.js",
|
|
17
|
-
"<%= offsetFromProjectRoot %>**/*.cy.jsx"
|
|
17
|
+
<% if (jsx) { %>"<%= offsetFromProjectRoot %>**/*.cy.jsx",<% } %>
|
|
18
18
|
"<%= offsetFromProjectRoot %>**/*.d.ts"
|
|
19
19
|
]
|
|
20
20
|
}
|
|
@@ -48,6 +48,7 @@ function addProjectFiles(tree, projectConfig, opts) {
|
|
|
48
48
|
(0, base_setup_1.addBaseCypressSetup)(tree, {
|
|
49
49
|
project: opts.project,
|
|
50
50
|
directory: opts.directory,
|
|
51
|
+
jsx: opts.jsx,
|
|
51
52
|
});
|
|
52
53
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), projectConfig.root, {
|
|
53
54
|
...opts,
|
|
@@ -31,6 +31,11 @@
|
|
|
31
31
|
"type": "string",
|
|
32
32
|
"description": "A directory where the project is placed relative from the project root",
|
|
33
33
|
"default": "cypress"
|
|
34
|
+
},
|
|
35
|
+
"jsx": {
|
|
36
|
+
"description": "Whether or not this project uses JSX.",
|
|
37
|
+
"type": "boolean",
|
|
38
|
+
"default": true
|
|
34
39
|
}
|
|
35
40
|
},
|
|
36
41
|
"required": ["project"],
|
|
@@ -12,6 +12,8 @@ export interface CypressE2EConfigSchema {
|
|
|
12
12
|
devServerTarget?: string;
|
|
13
13
|
linter?: Linter;
|
|
14
14
|
port?: number | 'cypress-auto';
|
|
15
|
+
jsx?: boolean;
|
|
16
|
+
rootProject?: boolean;
|
|
15
17
|
}
|
|
16
18
|
export declare function configurationGenerator(tree: Tree, options: CypressE2EConfigSchema): Promise<GeneratorCallback>;
|
|
17
19
|
export default configurationGenerator;
|
|
@@ -22,10 +22,11 @@ async function configurationGenerator(tree, options) {
|
|
|
22
22
|
}
|
|
23
23
|
await addFiles(tree, opts);
|
|
24
24
|
addTarget(tree, opts);
|
|
25
|
-
(0, add_linter_1.addLinterToCyProject)(tree, {
|
|
25
|
+
const linterTask = await (0, add_linter_1.addLinterToCyProject)(tree, {
|
|
26
26
|
...opts,
|
|
27
27
|
cypressDir: opts.directory,
|
|
28
28
|
});
|
|
29
|
+
tasks.push(linterTask);
|
|
29
30
|
if (!opts.skipFormat) {
|
|
30
31
|
await (0, devkit_1.formatFiles)(tree);
|
|
31
32
|
}
|
|
@@ -48,7 +49,7 @@ In this case you need to provide a devServerTarget,'<projectName>:<targetName>[:
|
|
|
48
49
|
return {
|
|
49
50
|
...options,
|
|
50
51
|
bundler: options.bundler ?? 'webpack',
|
|
51
|
-
rootProject: projectConfig.root === '.',
|
|
52
|
+
rootProject: options.rootProject ?? projectConfig.root === '.',
|
|
52
53
|
linter: options.linter ?? eslint_1.Linter.EsLint,
|
|
53
54
|
devServerTarget: options.devServerTarget ??
|
|
54
55
|
(projectConfig.targets.serve ? `${options.project}:serve` : undefined),
|
|
@@ -69,6 +70,7 @@ async function addFiles(tree, options) {
|
|
|
69
70
|
ext: options.js ? 'js' : 'ts',
|
|
70
71
|
offsetFromRoot: (0, devkit_1.offsetFromRoot)(projectConfig.root),
|
|
71
72
|
offsetFromProjectRoot,
|
|
73
|
+
projectRoot: projectConfig.root,
|
|
72
74
|
tsConfigPath: hasTsConfig
|
|
73
75
|
? `${offsetFromProjectRoot}/tsconfig.json`
|
|
74
76
|
: (0, js_1.getRelativePathToRootTsConfig)(tree, projectConfig.root),
|
|
@@ -79,6 +81,7 @@ async function addFiles(tree, options) {
|
|
|
79
81
|
(0, base_setup_1.addBaseCypressSetup)(tree, {
|
|
80
82
|
project: options.project,
|
|
81
83
|
directory: options.directory,
|
|
84
|
+
jsx: options.jsx,
|
|
82
85
|
});
|
|
83
86
|
const cyFile = (0, devkit_1.joinPathFragments)(projectConfig.root, 'cypress.config.ts');
|
|
84
87
|
const updatedCyConfig = await (0, config_1.addDefaultE2EConfig)(tree.read(cyFile, 'utf-8'), {
|
|
@@ -128,13 +131,18 @@ function addTarget(tree, opts) {
|
|
|
128
131
|
devServerTarget: opts.devServerTarget,
|
|
129
132
|
port: opts.port,
|
|
130
133
|
};
|
|
131
|
-
projectConfig.targets.e2e.configurations = {
|
|
132
|
-
[parsedTarget.configuration || 'production']: {
|
|
133
|
-
devServerTarget: `${opts.devServerTarget}${parsedTarget.configuration ? '' : ':production'}`,
|
|
134
|
-
},
|
|
135
|
-
};
|
|
136
134
|
const devServerProjectConfig = (0, devkit_1.readProjectConfiguration)(tree, parsedTarget.project);
|
|
135
|
+
// Add production e2e target if serve target is found
|
|
136
|
+
if (parsedTarget.configuration !== 'production' &&
|
|
137
|
+
devServerProjectConfig.targets?.[parsedTarget.target]?.configurations?.['production']) {
|
|
138
|
+
projectConfig.targets.e2e.configurations ??= {};
|
|
139
|
+
projectConfig.targets.e2e.configurations['production'] = {
|
|
140
|
+
devServerTarget: `${parsedTarget.project}:${parsedTarget.target}:production`,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
// Add ci/static e2e target if serve target is found
|
|
137
144
|
if (devServerProjectConfig.targets?.['serve-static']) {
|
|
145
|
+
projectConfig.targets.e2e.configurations ??= {};
|
|
138
146
|
projectConfig.targets.e2e.configurations.ci = {
|
|
139
147
|
devServerTarget: `${parsedTarget.project}:serve-static`,
|
|
140
148
|
};
|
|
@@ -84,6 +84,11 @@
|
|
|
84
84
|
"enum": ["vite", "webpack", "none"],
|
|
85
85
|
"x-prompt": "Which Cypress bundler do you want to use?",
|
|
86
86
|
"default": "webpack"
|
|
87
|
+
},
|
|
88
|
+
"jsx": {
|
|
89
|
+
"description": "Whether or not this project uses JSX.",
|
|
90
|
+
"type": "boolean",
|
|
91
|
+
"default": true
|
|
87
92
|
}
|
|
88
93
|
},
|
|
89
94
|
"required": ["project"],
|
|
@@ -59,12 +59,6 @@
|
|
|
59
59
|
"description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
|
|
60
60
|
"default": false
|
|
61
61
|
},
|
|
62
|
-
"standaloneConfig": {
|
|
63
|
-
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside workspace.json.",
|
|
64
|
-
"type": "boolean",
|
|
65
|
-
"default": true,
|
|
66
|
-
"x-deprecated": "Nx only supports standaloneConfig"
|
|
67
|
-
},
|
|
68
62
|
"skipPackageJson": {
|
|
69
63
|
"type": "boolean",
|
|
70
64
|
"default": false,
|