@nx/react 21.3.0-canary.20250613-18155f4 → 21.3.0-canary.20250614-db86a35
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 +6 -6
- package/src/generators/application/files/base-rspack/rspack.config.js__tmpl__ +1 -1
- package/src/generators/application/files/base-webpack/webpack.config.js__tmpl__ +1 -1
- package/src/generators/application/lib/add-e2e.js +7 -3
- package/src/generators/application/lib/bundlers/add-vite.js +3 -0
- package/src/generators/application/lib/create-application-files.d.ts +1 -0
- package/src/generators/application/lib/create-application-files.js +1 -0
- package/src/generators/application/lib/normalize-options.js +1 -1
- package/src/generators/application/schema.d.ts +1 -0
- package/src/generators/application/schema.json +10 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/react",
|
3
|
-
"version": "21.3.0-canary.
|
3
|
+
"version": "21.3.0-canary.20250614-db86a35",
|
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": {
|
@@ -38,11 +38,11 @@
|
|
38
38
|
"minimatch": "9.0.3",
|
39
39
|
"picocolors": "^1.1.0",
|
40
40
|
"tslib": "^2.3.0",
|
41
|
-
"@nx/devkit": "21.3.0-canary.
|
42
|
-
"@nx/js": "21.3.0-canary.
|
43
|
-
"@nx/eslint": "21.3.0-canary.
|
44
|
-
"@nx/web": "21.3.0-canary.
|
45
|
-
"@nx/module-federation": "21.3.0-canary.
|
41
|
+
"@nx/devkit": "21.3.0-canary.20250614-db86a35",
|
42
|
+
"@nx/js": "21.3.0-canary.20250614-db86a35",
|
43
|
+
"@nx/eslint": "21.3.0-canary.20250614-db86a35",
|
44
|
+
"@nx/web": "21.3.0-canary.20250614-db86a35",
|
45
|
+
"@nx/module-federation": "21.3.0-canary.20250614-db86a35",
|
46
46
|
"express": "^4.21.2",
|
47
47
|
"http-proxy-middleware": "^3.0.3",
|
48
48
|
"semver": "^7.6.3"
|
@@ -18,7 +18,7 @@ async function addE2e(tree, options) {
|
|
18
18
|
e2eWebServerAddress: `http://localhost:${options.devServerPort ?? 4200}`,
|
19
19
|
e2eWebServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx run ${options.projectName}:serve`,
|
20
20
|
e2eCiWebServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx run ${options.projectName}:serve-static`,
|
21
|
-
e2eCiBaseUrl: `http://localhost
|
21
|
+
e2eCiBaseUrl: `http://localhost:${options.port ?? 4300}`,
|
22
22
|
e2eDevServerTarget: `${options.projectName}:serve`,
|
23
23
|
};
|
24
24
|
if (options.bundler === 'webpack') {
|
@@ -32,8 +32,12 @@ async function addE2e(tree, options) {
|
|
32
32
|
else if (options.bundler === 'vite') {
|
33
33
|
const { getViteE2EWebServerInfo, getReactRouterE2EWebServerInfo } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
|
34
34
|
e2eWebServerInfo = options.useReactRouter
|
35
|
-
? await getReactRouterE2EWebServerInfo(tree, options.projectName, (0, devkit_1.joinPathFragments)(options.appProjectRoot, `vite.config.${options.js ? 'js' : 'ts'}`), options.addPlugin, options.devServerPort ?? 4200
|
36
|
-
|
35
|
+
? await getReactRouterE2EWebServerInfo(tree, options.projectName, (0, devkit_1.joinPathFragments)(options.appProjectRoot, `vite.config.${options.js ? 'js' : 'ts'}`), options.addPlugin, options.devServerPort ?? 4200,
|
36
|
+
// If the user manually sets the port, then use it for dev and preview
|
37
|
+
options.port)
|
38
|
+
: await getViteE2EWebServerInfo(tree, options.projectName, (0, devkit_1.joinPathFragments)(options.appProjectRoot, `vite.config.${options.js ? 'js' : 'ts'}`), options.addPlugin, options.devServerPort ?? 4200,
|
39
|
+
// If the user manually sets the port, then use it for dev and preview
|
40
|
+
options.port);
|
37
41
|
}
|
38
42
|
else if (options.bundler === 'rsbuild') {
|
39
43
|
(0, devkit_1.ensurePackage)('@nx/rsbuild', versions_1.nxVersion);
|
@@ -33,6 +33,7 @@ async function setupViteConfiguration(tree, options, tasks) {
|
|
33
33
|
skipFormat: true,
|
34
34
|
addPlugin: options.addPlugin,
|
35
35
|
projectType: 'application',
|
36
|
+
port: options.port,
|
36
37
|
});
|
37
38
|
tasks.push(viteTask);
|
38
39
|
createOrEditViteConfig(tree, {
|
@@ -41,6 +42,8 @@ async function setupViteConfiguration(tree, options, tasks) {
|
|
41
42
|
includeVitest: options.unitTestRunner === 'vitest',
|
42
43
|
inSourceTests: options.inSourceTests,
|
43
44
|
rollupOptionsExternal: ["'react'", "'react-dom'", "'react/jsx-runtime'"],
|
45
|
+
port: options.port,
|
46
|
+
previewPort: options.port,
|
44
47
|
...(options.useReactRouter
|
45
48
|
? reactRouterFrameworkConfig
|
46
49
|
: baseReactConfig),
|
@@ -18,6 +18,7 @@ export declare function getDefaultTemplateVariables(host: Tree, options: Normali
|
|
18
18
|
style: "none" | "styled-components" | "@emotion/styled" | "styled-jsx" | "css" | "scss" | "less";
|
19
19
|
hasStyleFile: boolean;
|
20
20
|
isUsingTsSolutionSetup: boolean;
|
21
|
+
port: number;
|
21
22
|
projectName: string;
|
22
23
|
appProjectRoot: string;
|
23
24
|
e2eProjectName: string;
|
@@ -36,6 +36,7 @@ function getDefaultTemplateVariables(host, options) {
|
|
36
36
|
style: options.style === 'tailwind' ? 'css' : options.style,
|
37
37
|
hasStyleFile,
|
38
38
|
isUsingTsSolutionSetup: (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host),
|
39
|
+
port: options.port ?? 4200,
|
39
40
|
};
|
40
41
|
}
|
41
42
|
function createNxRspackPluginOptions(options, rootOffset, tsx = true) {
|
@@ -60,7 +60,7 @@ async function normalizeOptions(host, options) {
|
|
60
60
|
normalized.unitTestRunner = normalized.unitTestRunner ?? 'jest';
|
61
61
|
normalized.e2eTestRunner = normalized.e2eTestRunner ?? 'playwright';
|
62
62
|
normalized.inSourceTests = normalized.minimal || normalized.inSourceTests;
|
63
|
-
normalized.devServerPort ??= (0, find_free_port_1.findFreePort)(host);
|
63
|
+
normalized.devServerPort ??= options.port ?? (0, find_free_port_1.findFreePort)(host);
|
64
64
|
normalized.minimal = normalized.minimal ?? false;
|
65
65
|
return normalized;
|
66
66
|
}
|
@@ -16,6 +16,10 @@
|
|
16
16
|
{
|
17
17
|
"command": "nx g app apps/myapp --routing",
|
18
18
|
"description": "Set up React Router"
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"command": "nx g app apps/myapp --port=3000",
|
22
|
+
"description": "Set up the dev server to use port 3000"
|
19
23
|
}
|
20
24
|
],
|
21
25
|
"type": "object",
|
@@ -196,6 +200,12 @@
|
|
196
200
|
"useProjectJson": {
|
197
201
|
"type": "boolean",
|
198
202
|
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
203
|
+
},
|
204
|
+
"port": {
|
205
|
+
"type": "number",
|
206
|
+
"description": "The port to use for the development server",
|
207
|
+
"x-prompt": "Which port would you like to use for the dev server?",
|
208
|
+
"default": 4200
|
199
209
|
}
|
200
210
|
},
|
201
211
|
"required": ["directory"],
|