@nx/react 0.0.0-pr-29176-d3c6c29 → 0.0.0-pr-29314-bfd9d0c
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 +4 -2
- package/package.json +6 -6
- package/plugins/bundle-rollup.js +2 -2
- package/plugins/nx-react-webpack-plugin/lib/apply-react-config.js +3 -1
- package/src/executors/module-federation-dev-server/schema.json +14 -10
- package/src/executors/module-federation-ssr-dev-server/schema.json +13 -9
- package/src/executors/module-federation-static-server/module-federation-static-server.impl.js +5 -5
- package/src/executors/module-federation-static-server/schema.json +1 -1
- package/src/generators/application/application.d.ts +3 -3
- package/src/generators/application/application.js +59 -194
- package/src/generators/application/files/base-rsbuild/src/app/__fileName__.spec.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-rsbuild/src/assets/.gitkeep +0 -0
- package/src/generators/application/files/base-rsbuild/src/favicon.ico +0 -0
- package/src/generators/application/files/base-rsbuild/src/index.html +14 -0
- package/src/generators/application/files/base-rsbuild/src/main.tsx__tmpl__ +32 -0
- package/src/generators/application/files/base-rsbuild/tsconfig.app.json__tmpl__ +31 -0
- package/src/generators/application/files/style-tailwind/src/app/__fileName__.tsx__tmpl__ +1 -1
- package/src/generators/application/lib/add-e2e.js +12 -1
- package/src/generators/application/lib/add-linting.d.ts +3 -0
- package/src/generators/application/lib/add-linting.js +48 -0
- package/src/generators/application/lib/bundlers/add-rsbuild.d.ts +4 -0
- package/src/generators/application/lib/bundlers/add-rsbuild.js +63 -0
- package/src/generators/application/lib/bundlers/add-rspack.d.ts +5 -0
- package/src/generators/application/lib/bundlers/add-rspack.js +55 -0
- package/src/generators/application/lib/bundlers/add-vite.d.ts +4 -0
- package/src/generators/application/lib/bundlers/add-vite.js +67 -0
- package/src/generators/application/lib/bundlers/add-webpack.d.ts +3 -0
- package/src/generators/application/lib/bundlers/add-webpack.js +18 -0
- package/src/generators/application/lib/create-application-files.js +5 -0
- package/src/generators/application/schema.d.ts +1 -1
- package/src/generators/application/schema.json +4 -4
- package/src/generators/component/component.js +19 -32
- package/src/generators/component/files/{__fileName__.tsx__tmpl__ → __fileName__.__ext__} +5 -5
- package/src/generators/component/lib/normalize-options.js +7 -4
- package/src/generators/component/schema.d.ts +9 -3
- package/src/generators/component/schema.json +6 -6
- package/src/generators/component-story/component-story.js +1 -2
- package/src/generators/federate-module/schema.json +14 -8
- package/src/generators/hook/files/{__fileName__.ts__tmpl__ → __fileName__.__ext__} +3 -1
- package/src/generators/hook/hook.js +21 -22
- package/src/generators/hook/schema.d.ts +4 -0
- package/src/generators/hook/schema.json +8 -4
- package/src/generators/host/schema.json +9 -8
- package/src/generators/library/lib/add-rollup-build-target.js +30 -27
- package/src/generators/library/library.js +6 -1
- package/src/generators/library/schema.json +4 -0
- package/src/generators/redux/files/js/__fileName__.__ext__ +114 -0
- package/src/generators/redux/files/{__fileName__.slice.spec.ts__tmpl__ → js/__fileName__.spec.__ext__} +1 -1
- package/src/generators/redux/files/ts/__fileName__.spec.__ext__ +56 -0
- package/src/generators/redux/redux.js +19 -16
- package/src/generators/redux/schema.d.ts +10 -2
- package/src/generators/redux/schema.json +8 -4
- package/src/generators/remote/lib/update-host-with-remote.js +2 -2
- package/src/generators/remote/schema.json +9 -8
- package/src/generators/stories/stories.js +5 -2
- package/src/generators/storybook-configuration/configuration.js +2 -2
- package/src/utils/has-rsbuild-plugin.d.ts +2 -0
- package/src/utils/has-rsbuild-plugin.js +10 -0
- /package/src/generators/component/files/{__fileName__.spec.tsx__tmpl__ → __fileName__.spec.__ext__} +0 -0
- /package/src/generators/hook/files/{__fileName__.spec.tsx__tmpl__ → __fileName__.spec.__specExt__} +0 -0
- /package/src/generators/redux/files/{__fileName__.slice.ts__tmpl__ → ts/__fileName__.__ext__} +0 -0
|
@@ -8,17 +8,21 @@
|
|
|
8
8
|
"examples": [
|
|
9
9
|
{
|
|
10
10
|
"description": "Generate a Redux state slice with the exported symbol matching the file name. It results in the slice `fooSlice` at `mylib/src/lib/foo.slice.ts`",
|
|
11
|
-
"command": "nx g @nx/react:redux mylib/src/lib/foo"
|
|
11
|
+
"command": "nx g @nx/react:redux mylib/src/lib/foo.slice.ts"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"description": "Generate a Redux state slice with the exported symbol different from the file name. It results in the slice `customSlice` at `mylib/src/lib/foo.slice.ts`",
|
|
15
|
-
"command": "nx g @nx/react:redux mylib/src/lib/foo --name=custom"
|
|
15
|
+
"command": "nx g @nx/react:redux mylib/src/lib/foo.slice.ts --name=custom"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"description": "Generate a Redux state slice without providing the \"slice\" suffix and the file extension. It results in the slice `fooSlice` at `mylib/src/lib/foo.slice.ts`",
|
|
19
|
+
"command": "nx g @nx/react:redux mylib/src/lib/foo"
|
|
16
20
|
}
|
|
17
21
|
],
|
|
18
22
|
"properties": {
|
|
19
23
|
"path": {
|
|
20
24
|
"type": "string",
|
|
21
|
-
"description": "The file path to the Redux state slice
|
|
25
|
+
"description": "The file path to the Redux state slice. Relative to the current working directory.",
|
|
22
26
|
"$default": {
|
|
23
27
|
"$source": "argv",
|
|
24
28
|
"index": 0
|
|
@@ -38,7 +42,7 @@
|
|
|
38
42
|
"js": {
|
|
39
43
|
"type": "boolean",
|
|
40
44
|
"description": "Generate JavaScript files rather than TypeScript files.",
|
|
41
|
-
"
|
|
45
|
+
"x-deprecated": "Provide the full file path including the file extension in the `path` option. This option will be removed in Nx v21."
|
|
42
46
|
}
|
|
43
47
|
},
|
|
44
48
|
"required": ["path"]
|
|
@@ -24,7 +24,7 @@ function updateHostWithRemote(host, hostName, remoteName) {
|
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
26
|
// TODO(jack): Point to the nx.dev guide when ready.
|
|
27
|
-
devkit_1.logger.warn(`Could not find configuration at ${moduleFederationConfigPath}. Did you generate this project with "@nx/react:host"?`);
|
|
27
|
+
devkit_1.logger.warn(`Could not find configuration at ${moduleFederationConfigPath}. Did you generate this project with "@nx/react:host" or "@nx/react:consumer"?`);
|
|
28
28
|
}
|
|
29
29
|
if (host.exists(appComponentPath)) {
|
|
30
30
|
let sourceCode = host.read(appComponentPath).toString();
|
|
@@ -32,7 +32,7 @@ function updateHostWithRemote(host, hostName, remoteName) {
|
|
|
32
32
|
host.write(appComponentPath, (0, devkit_1.applyChangesToString)(sourceCode, (0, ast_utils_1.addRemoteRoute)(source, (0, devkit_1.names)(remoteName))));
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
|
-
devkit_1.logger.warn(`Could not find app component at ${appComponentPath}. Did you generate this project with "@nx/react:host"?`);
|
|
35
|
+
devkit_1.logger.warn(`Could not find app component at ${appComponentPath}. Did you generate this project with "@nx/react:host" or "@nx/react:consumer"?`);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
function findAppComponentPath(host, sourceRoot) {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"$id": "GeneratorReactRemote",
|
|
4
4
|
"cli": "nx",
|
|
5
|
-
"title": "Generate Module Federation Setup for React Remote App",
|
|
6
|
-
"description": "Create Module Federation configuration files for given React Remote Application.",
|
|
5
|
+
"title": "Generate Module Federation Setup for React Producer (Remote) App",
|
|
6
|
+
"description": "Create Module Federation configuration files for given React Producer (Remote) Application.",
|
|
7
7
|
"type": "object",
|
|
8
8
|
"properties": {
|
|
9
9
|
"directory": {
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
},
|
|
19
19
|
"name": {
|
|
20
20
|
"type": "string",
|
|
21
|
-
"description": "The name of the remote application to generate the Module Federation configuration",
|
|
21
|
+
"description": "The name of the Producer (remote) application to generate the Module Federation configuration",
|
|
22
22
|
"pattern": "^[a-zA-Z_$][a-zA-Z_$0-9]*$",
|
|
23
23
|
"x-priority": "important"
|
|
24
24
|
},
|
|
25
25
|
"dynamic": {
|
|
26
26
|
"type": "boolean",
|
|
27
|
-
"description": "Should the host application use dynamic federation?",
|
|
27
|
+
"description": "Should the Consumer (host) application use dynamic federation?",
|
|
28
28
|
"default": false,
|
|
29
29
|
"x-priority": "internal"
|
|
30
30
|
},
|
|
@@ -147,16 +147,17 @@
|
|
|
147
147
|
},
|
|
148
148
|
"host": {
|
|
149
149
|
"type": "string",
|
|
150
|
-
"description": "The host
|
|
151
|
-
"x-priority": "important"
|
|
150
|
+
"description": "The Consumer (host) application for this Producer (remote).",
|
|
151
|
+
"x-priority": "important",
|
|
152
|
+
"alias": "consumer"
|
|
152
153
|
},
|
|
153
154
|
"devServerPort": {
|
|
154
155
|
"type": "number",
|
|
155
|
-
"description": "The port for the dev server of the remote app.",
|
|
156
|
+
"description": "The port for the dev server of the Producer (remote) app.",
|
|
156
157
|
"x-priority": "important"
|
|
157
158
|
},
|
|
158
159
|
"ssr": {
|
|
159
|
-
"description": "Whether to configure SSR for the host application",
|
|
160
|
+
"description": "Whether to configure SSR for the Consumer (host) application",
|
|
160
161
|
"type": "boolean",
|
|
161
162
|
"default": false
|
|
162
163
|
},
|
|
@@ -29,7 +29,10 @@ async function projectRootPath(tree, config) {
|
|
|
29
29
|
// libs/test-lib/src/lib
|
|
30
30
|
projectDir = 'lib';
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
else {
|
|
33
|
+
projectDir = '.';
|
|
34
|
+
}
|
|
35
|
+
return (0, devkit_1.joinPathFragments)(config.sourceRoot ?? config.root, projectDir);
|
|
33
36
|
}
|
|
34
37
|
function containsComponentDeclaration(tree, componentPath) {
|
|
35
38
|
if (!tsModule) {
|
|
@@ -70,7 +73,7 @@ async function createAllStories(tree, projectName, interactionTests, js, project
|
|
|
70
73
|
}
|
|
71
74
|
});
|
|
72
75
|
await Promise.all(componentPaths.map(async (componentPath) => {
|
|
73
|
-
const relativeCmpDir = componentPath.replace((0, path_1.join)(sourceRoot, '/'), '');
|
|
76
|
+
const relativeCmpDir = componentPath.replace((0, path_1.join)(sourceRoot ?? root, '/'), '');
|
|
74
77
|
if (!containsComponentDeclaration(tree, componentPath)) {
|
|
75
78
|
return;
|
|
76
79
|
}
|
|
@@ -32,8 +32,8 @@ async function storybookConfigurationGeneratorInternal(host, schema) {
|
|
|
32
32
|
let uiFramework = '@storybook/react-vite';
|
|
33
33
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(host, schema.project);
|
|
34
34
|
if (findWebpackConfig(host, projectConfig.root) ||
|
|
35
|
-
projectConfig.targets['build']?.executor === '@nx/rollup:rollup' ||
|
|
36
|
-
projectConfig.targets['build']?.executor === '@nx/expo:build') {
|
|
35
|
+
projectConfig.targets?.['build']?.executor === '@nx/rollup:rollup' ||
|
|
36
|
+
projectConfig.targets?.['build']?.executor === '@nx/expo:build') {
|
|
37
37
|
uiFramework = '@storybook/react-webpack5';
|
|
38
38
|
}
|
|
39
39
|
if (uiFramework === '@storybook/react-vite') {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasRsbuildPlugin = hasRsbuildPlugin;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function hasRsbuildPlugin(tree) {
|
|
6
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
7
|
+
return !!nxJson.plugins?.some((p) => typeof p === 'string'
|
|
8
|
+
? p === '@nx/rsbuild/plugin'
|
|
9
|
+
: p.plugin === '@nx/rsbuild/plugin');
|
|
10
|
+
}
|
/package/src/generators/component/files/{__fileName__.spec.tsx__tmpl__ → __fileName__.spec.__ext__}
RENAMED
|
File without changes
|
/package/src/generators/hook/files/{__fileName__.spec.tsx__tmpl__ → __fileName__.spec.__specExt__}
RENAMED
|
File without changes
|
/package/src/generators/redux/files/{__fileName__.slice.ts__tmpl__ → ts/__fileName__.__ext__}
RENAMED
|
File without changes
|