@nx/react 19.6.0-canary.20240731-341f295 → 19.6.0-canary.20240803-bd7a2c9
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/react",
|
3
|
-
"version": "19.6.0-canary.
|
3
|
+
"version": "19.6.0-canary.20240803-bd7a2c9",
|
4
4
|
"private": false,
|
5
5
|
"description": "The React plugin for Nx contains executors and generators for managing React applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Vitest, Playwright, Cypress, and Storybook.\n\n- Generators for applications, libraries, components, hooks, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
|
6
6
|
"repository": {
|
@@ -39,11 +39,11 @@
|
|
39
39
|
"minimatch": "9.0.3",
|
40
40
|
"tslib": "^2.3.0",
|
41
41
|
"@module-federation/enhanced": "~0.2.3",
|
42
|
-
"@nx/devkit": "19.6.0-canary.
|
43
|
-
"@nx/js": "19.6.0-canary.
|
44
|
-
"@nx/eslint": "19.6.0-canary.
|
45
|
-
"@nx/web": "19.6.0-canary.
|
46
|
-
"@nrwl/react": "19.6.0-canary.
|
42
|
+
"@nx/devkit": "19.6.0-canary.20240803-bd7a2c9",
|
43
|
+
"@nx/js": "19.6.0-canary.20240803-bd7a2c9",
|
44
|
+
"@nx/eslint": "19.6.0-canary.20240803-bd7a2c9",
|
45
|
+
"@nx/web": "19.6.0-canary.20240803-bd7a2c9",
|
46
|
+
"@nrwl/react": "19.6.0-canary.20240803-bd7a2c9"
|
47
47
|
},
|
48
48
|
"publishConfig": {
|
49
49
|
"access": "public"
|
@@ -7,17 +7,17 @@ const versions_1 = require("../../../utils/versions");
|
|
7
7
|
const has_webpack_plugin_1 = require("../../../utils/has-webpack-plugin");
|
8
8
|
const has_vite_plugin_1 = require("../../../utils/has-vite-plugin");
|
9
9
|
async function addE2e(tree, options) {
|
10
|
+
const hasNxBuildPlugin = (options.bundler === 'webpack' && (0, has_webpack_plugin_1.hasWebpackPlugin)(tree)) ||
|
11
|
+
(options.bundler === 'vite' && (0, has_vite_plugin_1.hasVitePlugin)(tree));
|
12
|
+
if (!hasNxBuildPlugin) {
|
13
|
+
await (0, web_1.webStaticServeGenerator)(tree, {
|
14
|
+
buildTarget: `${options.projectName}:build`,
|
15
|
+
targetName: 'serve-static',
|
16
|
+
spa: true,
|
17
|
+
});
|
18
|
+
}
|
10
19
|
switch (options.e2eTestRunner) {
|
11
20
|
case 'cypress': {
|
12
|
-
const hasNxBuildPlugin = (options.bundler === 'webpack' && (0, has_webpack_plugin_1.hasWebpackPlugin)(tree)) ||
|
13
|
-
(options.bundler === 'vite' && (0, has_vite_plugin_1.hasVitePlugin)(tree));
|
14
|
-
if (!hasNxBuildPlugin) {
|
15
|
-
await (0, web_1.webStaticServeGenerator)(tree, {
|
16
|
-
buildTarget: `${options.projectName}:build`,
|
17
|
-
targetName: 'serve-static',
|
18
|
-
spa: true,
|
19
|
-
});
|
20
|
-
}
|
21
21
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
22
22
|
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
23
23
|
projectType: 'application',
|
@@ -45,8 +45,9 @@ async function addE2e(tree, options) {
|
|
45
45
|
}
|
46
46
|
: undefined,
|
47
47
|
ciWebServerCommand: hasNxBuildPlugin
|
48
|
-
? `nx run ${options.projectName}
|
48
|
+
? `nx run ${options.projectName}:${options.e2eCiWebServerTarget}`
|
49
49
|
: undefined,
|
50
|
+
ciBaseUrl: options.bundler === 'vite' ? options.e2eCiBaseUrl : undefined,
|
50
51
|
});
|
51
52
|
}
|
52
53
|
case 'playwright': {
|
@@ -66,8 +67,8 @@ async function addE2e(tree, options) {
|
|
66
67
|
js: false,
|
67
68
|
linter: options.linter,
|
68
69
|
setParserOptionsProject: options.setParserOptionsProject,
|
69
|
-
webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx ${options.
|
70
|
-
webServerAddress: options.
|
70
|
+
webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx run ${options.projectName}:${options.e2eCiWebServerTarget}`,
|
71
|
+
webServerAddress: options.e2eCiBaseUrl,
|
71
72
|
rootProject: options.rootProject,
|
72
73
|
addPlugin: options.addPlugin,
|
73
74
|
});
|
@@ -32,28 +32,35 @@ async function normalizeOptions(host, options, callingGenerator = '@nx/react:app
|
|
32
32
|
options.addPlugin ??= addPlugin;
|
33
33
|
options.rootProject = appProjectRoot === '.';
|
34
34
|
options.projectNameAndRootFormat = projectNameAndRootFormat;
|
35
|
+
let e2ePort = options.devServerPort ?? 4200;
|
35
36
|
let e2eWebServerTarget = 'serve';
|
37
|
+
let e2eCiWebServerTarget = options.bundler === 'vite' ? 'preview' : 'serve-static';
|
36
38
|
if (options.addPlugin) {
|
37
39
|
if (nxJson.plugins) {
|
38
40
|
for (const plugin of nxJson.plugins) {
|
39
41
|
if (options.bundler === 'vite' &&
|
40
42
|
typeof plugin === 'object' &&
|
41
|
-
plugin.plugin === '@nx/vite/plugin'
|
42
|
-
|
43
|
-
|
44
|
-
|
43
|
+
plugin.plugin === '@nx/vite/plugin') {
|
44
|
+
e2eCiWebServerTarget =
|
45
|
+
plugin.options?.previewTargetName ??
|
46
|
+
e2eCiWebServerTarget;
|
47
|
+
e2eWebServerTarget =
|
48
|
+
plugin.options?.serveTargetName ??
|
49
|
+
e2eWebServerTarget;
|
45
50
|
}
|
46
51
|
else if (options.bundler === 'webpack' &&
|
47
52
|
typeof plugin === 'object' &&
|
48
|
-
plugin.plugin === '@nx/webpack/plugin'
|
49
|
-
|
50
|
-
|
51
|
-
|
53
|
+
plugin.plugin === '@nx/webpack/plugin') {
|
54
|
+
e2eCiWebServerTarget =
|
55
|
+
plugin.options?.serveStaticTargetName ??
|
56
|
+
e2eCiWebServerTarget;
|
57
|
+
e2eWebServerTarget =
|
58
|
+
plugin.options?.serveTargetName ??
|
59
|
+
e2eWebServerTarget;
|
52
60
|
}
|
53
61
|
}
|
54
62
|
}
|
55
63
|
}
|
56
|
-
let e2ePort = options.devServerPort ?? 4200;
|
57
64
|
if (nxJson.targetDefaults?.[e2eWebServerTarget] &&
|
58
65
|
nxJson.targetDefaults?.[e2eWebServerTarget].options?.port) {
|
59
66
|
e2ePort = nxJson.targetDefaults?.[e2eWebServerTarget].options?.port;
|
@@ -61,6 +68,9 @@ async function normalizeOptions(host, options, callingGenerator = '@nx/react:app
|
|
61
68
|
const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
|
62
69
|
const e2eProjectRoot = options.rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
|
63
70
|
const e2eWebServerAddress = `http://localhost:${e2ePort}`;
|
71
|
+
const e2eCiBaseUrl = options.bundler === 'vite'
|
72
|
+
? 'http://localhost:4300'
|
73
|
+
: `http://localhost:${e2ePort}`;
|
64
74
|
const parsedTags = options.tags
|
65
75
|
? options.tags.split(',').map((s) => s.trim())
|
66
76
|
: [];
|
@@ -78,6 +88,8 @@ async function normalizeOptions(host, options, callingGenerator = '@nx/react:app
|
|
78
88
|
e2eProjectRoot,
|
79
89
|
e2eWebServerAddress,
|
80
90
|
e2eWebServerTarget,
|
91
|
+
e2eCiWebServerTarget,
|
92
|
+
e2eCiBaseUrl,
|
81
93
|
e2ePort,
|
82
94
|
parsedTags,
|
83
95
|
fileName,
|
@@ -38,6 +38,8 @@ export interface NormalizedSchema<T extends Schema = Schema> extends T {
|
|
38
38
|
e2eProjectRoot: string;
|
39
39
|
e2eWebServerAddress: string;
|
40
40
|
e2eWebServerTarget: string;
|
41
|
+
e2eCiWebServerTarget: string;
|
42
|
+
e2eCiBaseUrl: string;
|
41
43
|
e2ePort: number;
|
42
44
|
parsedTags: string[];
|
43
45
|
fileName: string;
|