@nx/react 24.0.0-beta.2 → 24.0.0-beta.3
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/dist/index.d.ts +0 -2
- package/dist/index.js +1 -5
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +3 -1
- package/dist/plugins/component-testing/index.js +92 -33
- package/dist/plugins/storybook/index.js +18 -18
- package/dist/plugins/with-react.d.ts +3 -7
- package/dist/plugins/with-react.js +5 -19
- package/dist/src/generators/application/application.js +1 -36
- package/dist/src/generators/application/files/base-rspack/rspack.config.js__tmpl__ +1 -24
- package/dist/src/generators/application/files/base-webpack/webpack.config.js__tmpl__ +1 -26
- package/dist/src/generators/application/lib/add-e2e.js +5 -6
- package/dist/src/generators/application/lib/add-linting.js +0 -1
- package/dist/src/generators/application/lib/add-project.js +0 -167
- package/dist/src/generators/application/lib/bundlers/add-rsbuild.js +0 -1
- package/dist/src/generators/application/lib/bundlers/add-vite.js +0 -2
- package/dist/src/generators/application/lib/bundlers/add-webpack.js +0 -1
- package/dist/src/generators/application/lib/create-application-files.d.ts +0 -1
- package/dist/src/generators/application/lib/create-application-files.js +2 -11
- package/dist/src/generators/application/lib/normalize-options.js +0 -4
- package/dist/src/generators/application/schema.d.ts +0 -2
- package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.js +1 -9
- package/dist/src/generators/cypress-component-configuration/schema.d.ts +0 -1
- package/dist/src/generators/init/init.js +3 -5
- package/dist/src/generators/init/schema.d.ts +0 -1
- package/dist/src/generators/library/lib/add-linting.js +0 -1
- package/dist/src/generators/library/lib/add-rollup-build-target.js +3 -47
- package/dist/src/generators/library/lib/normalize-options.js +0 -4
- package/dist/src/generators/library/library.js +1 -4
- package/dist/src/generators/library/schema.d.ts +0 -1
- package/dist/src/generators/storybook-configuration/configuration.js +1 -9
- package/dist/src/generators/storybook-configuration/schema.d.ts +0 -1
- package/dist/src/migrations/update-23-2-0/add-optional-module-federation-packages.js +2 -1
- package/dist/src/migrations/update-24-0-0/register-typescript-plugin-for-typecheck.d.ts +4 -0
- package/dist/src/migrations/update-24-0-0/register-typescript-plugin-for-typecheck.js +13 -0
- package/dist/src/migrations/update-24-0-0/register-typescript-plugin-for-typecheck.md +40 -0
- package/dist/src/plugins/router-plugin.d.ts +0 -1
- package/dist/src/plugins/router-plugin.js +5 -42
- package/dist/src/utils/ast-utils.d.ts +0 -1
- package/dist/src/utils/ast-utils.js +0 -23
- package/dist/src/utils/ct-utils.js +54 -14
- package/dist/src/utils/deprecation.d.ts +1 -1
- package/dist/src/utils/deprecation.js +3 -5
- package/dist/src/utils/versions.d.ts +0 -7
- package/dist/src/utils/versions.js +2 -9
- package/executors.json +1 -17
- package/generators.json +0 -27
- package/migrations.json +6 -0
- package/package.json +17 -47
- package/dist/mf/dynamic-federation.d.ts +0 -69
- package/dist/mf/dynamic-federation.js +0 -141
- package/dist/mf/index.d.ts +0 -1
- package/dist/mf/index.js +0 -8
- package/dist/module-federation.d.ts +0 -5
- package/dist/module-federation.js +0 -20
- package/dist/src/executors/module-federation-dev-server/lib/index.d.ts +0 -2
- package/dist/src/executors/module-federation-dev-server/lib/index.js +0 -5
- package/dist/src/executors/module-federation-dev-server/lib/normalize-options.d.ts +0 -4
- package/dist/src/executors/module-federation-dev-server/lib/normalize-options.js +0 -19
- package/dist/src/executors/module-federation-dev-server/lib/start-remotes.d.ts +0 -5
- package/dist/src/executors/module-federation-dev-server/lib/start-remotes.js +0 -33
- package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +0 -6
- package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +0 -80
- package/dist/src/executors/module-federation-dev-server/schema.d.ts +0 -19
- package/dist/src/executors/module-federation-dev-server/schema.json +0 -142
- package/dist/src/executors/module-federation-ssr-dev-server/lib/index.d.ts +0 -2
- package/dist/src/executors/module-federation-ssr-dev-server/lib/index.js +0 -5
- package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.d.ts +0 -4
- package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.js +0 -23
- package/dist/src/executors/module-federation-ssr-dev-server/lib/start-remotes.d.ts +0 -5
- package/dist/src/executors/module-federation-ssr-dev-server/lib/start-remotes.js +0 -34
- package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +0 -3
- package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +0 -83
- package/dist/src/executors/module-federation-ssr-dev-server/schema.d.ts +0 -29
- package/dist/src/executors/module-federation-ssr-dev-server/schema.json +0 -81
- package/dist/src/executors/module-federation-static-server/module-federation-static-server.impl.d.ts +0 -12
- package/dist/src/executors/module-federation-static-server/module-federation-static-server.impl.js +0 -244
- package/dist/src/executors/module-federation-static-server/schema.d.ts +0 -3
- package/dist/src/executors/module-federation-static-server/schema.json +0 -16
- package/dist/src/generators/federate-module/federate-module.d.ts +0 -4
- package/dist/src/generators/federate-module/federate-module.js +0 -67
- package/dist/src/generators/federate-module/lib/utils.d.ts +0 -23
- package/dist/src/generators/federate-module/lib/utils.js +0 -99
- package/dist/src/generators/federate-module/schema.d.ts +0 -15
- package/dist/src/generators/federate-module/schema.json +0 -89
- package/dist/src/generators/host/files/common/src/app/__fileName__.js__tmpl__ +0 -40
- package/dist/src/generators/host/files/common/src/main.js__tmpl__ +0 -13
- package/dist/src/generators/host/files/common/tsconfig.lint.json__tmpl__ +0 -19
- package/dist/src/generators/host/files/common-ts/src/app/__fileName__.tsx__tmpl__ +0 -41
- package/dist/src/generators/host/files/common-ts/src/main.ts__tmpl__ +0 -13
- package/dist/src/generators/host/files/rspack-common/src/app/__fileName__.jsx__tmpl__ +0 -42
- package/dist/src/generators/host/files/rspack-common/src/main.jsx__tmpl__ +0 -13
- package/dist/src/generators/host/files/rspack-common/tsconfig.lint.json__tmpl__ +0 -19
- package/dist/src/generators/host/files/rspack-module-federation/module-federation.config.js__tmpl__ +0 -24
- package/dist/src/generators/host/files/rspack-module-federation/rspack.config.js__tmpl__ +0 -42
- package/dist/src/generators/host/files/rspack-module-federation/rspack.config.prod.js__tmpl__ +0 -66
- package/dist/src/generators/host/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +0 -27
- package/dist/src/generators/host/files/rspack-module-federation-ssr/rspack.config.js__tmpl__ +0 -68
- package/dist/src/generators/host/files/rspack-module-federation-ssr/server.ts__tmpl__ +0 -28
- package/dist/src/generators/host/files/rspack-module-federation-ssr/src/main.server.tsx__tmpl__ +0 -49
- package/dist/src/generators/host/files/rspack-module-federation-ssr/tsconfig.server.json__tmpl__ +0 -17
- package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +0 -22
- package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +0 -68
- package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/server.ts__tmpl__ +0 -28
- package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/src/main.server.tsx__tmpl__ +0 -49
- package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/tsconfig.server.json__tmpl__ +0 -17
- package/dist/src/generators/host/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +0 -28
- package/dist/src/generators/host/files/rspack-module-federation-ts/rspack.config.prod.ts__tmpl__ +0 -67
- package/dist/src/generators/host/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +0 -42
- package/dist/src/generators/host/files/webpack-module-federation/module-federation.config.js__tmpl__ +0 -24
- package/dist/src/generators/host/files/webpack-module-federation/webpack.config.js__tmpl__ +0 -17
- package/dist/src/generators/host/files/webpack-module-federation/webpack.config.prod.js__tmpl__ +0 -39
- package/dist/src/generators/host/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ +0 -19
- package/dist/src/generators/host/files/webpack-module-federation-ssr/server.ts__tmpl__ +0 -28
- package/dist/src/generators/host/files/webpack-module-federation-ssr/tsconfig.server.json__tmpl__ +0 -17
- package/dist/src/generators/host/files/webpack-module-federation-ssr/webpack.server.config.js__tmpl__ +0 -17
- package/dist/src/generators/host/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +0 -16
- package/dist/src/generators/host/files/webpack-module-federation-ssr-ts/server.ts__tmpl__ +0 -28
- package/dist/src/generators/host/files/webpack-module-federation-ssr-ts/tsconfig.server.json__tmpl__ +0 -17
- package/dist/src/generators/host/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +0 -17
- package/dist/src/generators/host/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +0 -28
- package/dist/src/generators/host/files/webpack-module-federation-ts/webpack.config.prod.ts__tmpl__ +0 -40
- package/dist/src/generators/host/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +0 -18
- package/dist/src/generators/host/host.d.ts +0 -4
- package/dist/src/generators/host/host.js +0 -174
- package/dist/src/generators/host/lib/add-module-federation-files.d.ts +0 -6
- package/dist/src/generators/host/lib/add-module-federation-files.js +0 -92
- package/dist/src/generators/host/lib/normalize-host-name.d.ts +0 -2
- package/dist/src/generators/host/lib/normalize-host-name.js +0 -12
- package/dist/src/generators/host/lib/setup-ssr-for-host.d.ts +0 -6
- package/dist/src/generators/host/lib/setup-ssr-for-host.js +0 -59
- package/dist/src/generators/host/lib/update-module-federation-e2e-project.d.ts +0 -3
- package/dist/src/generators/host/lib/update-module-federation-e2e-project.js +0 -19
- package/dist/src/generators/host/lib/update-module-federation-tsconfig.d.ts +0 -3
- package/dist/src/generators/host/lib/update-module-federation-tsconfig.js +0 -34
- package/dist/src/generators/host/schema.d.ts +0 -44
- package/dist/src/generators/host/schema.json +0 -173
- package/dist/src/generators/remote/files/common/src/main.js__tmpl__ +0 -1
- package/dist/src/generators/remote/files/common/src/remote-entry.js__tmpl__ +0 -1
- package/dist/src/generators/remote/files/common-ts/src/main.ts__tmpl__ +0 -1
- package/dist/src/generators/remote/files/common-ts/src/remote-entry.ts__tmpl__ +0 -1
- package/dist/src/generators/remote/files/rspack-common/src/main.jsx__tmpl__ +0 -1
- package/dist/src/generators/remote/files/rspack-common/src/remote-entry.js__tmpl__ +0 -1
- package/dist/src/generators/remote/files/rspack-module-federation/module-federation.config.js__tmpl__ +0 -12
- package/dist/src/generators/remote/files/rspack-module-federation/rspack.config.js__tmpl__ +0 -45
- package/dist/src/generators/remote/files/rspack-module-federation/rspack.config.prod.js__tmpl__ +0 -1
- package/dist/src/generators/remote/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +0 -15
- package/dist/src/generators/remote/files/rspack-module-federation-ssr/rspack.config.js__tmpl__ +0 -71
- package/dist/src/generators/remote/files/rspack-module-federation-ssr/server.ts__tmpl__ +0 -45
- package/dist/src/generators/remote/files/rspack-module-federation-ssr/src/main.server.tsx__tmpl__ +0 -45
- package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +0 -19
- package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +0 -71
- package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/server.ts__tmpl__ +0 -45
- package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/src/main.server.tsx__tmpl__ +0 -45
- package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/tsconfig.lint.json__tmpl__ +0 -19
- package/dist/src/generators/remote/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +0 -16
- package/dist/src/generators/remote/files/rspack-module-federation-ts/rspack.config.prod.ts__tmpl__ +0 -1
- package/dist/src/generators/remote/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +0 -45
- package/dist/src/generators/remote/files/rspack-module-federation-ts/tsconfig.lint.json__tmpl__ +0 -19
- package/dist/src/generators/remote/files/webpack-module-federation/module-federation.config.js__tmpl__ +0 -12
- package/dist/src/generators/remote/files/webpack-module-federation/webpack.config.js__tmpl__ +0 -17
- package/dist/src/generators/remote/files/webpack-module-federation/webpack.config.prod.js__tmpl__ +0 -1
- package/dist/src/generators/remote/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ +0 -9
- package/dist/src/generators/remote/files/webpack-module-federation-ssr/server.ts__tmpl__ +0 -45
- package/dist/src/generators/remote/files/webpack-module-federation-ssr/webpack.server.config.js__tmpl__ +0 -17
- package/dist/src/generators/remote/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +0 -13
- package/dist/src/generators/remote/files/webpack-module-federation-ssr-ts/server.ts__tmpl__ +0 -45
- package/dist/src/generators/remote/files/webpack-module-federation-ssr-ts/tsconfig.lint.json__tmpl__ +0 -19
- package/dist/src/generators/remote/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +0 -17
- package/dist/src/generators/remote/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +0 -16
- package/dist/src/generators/remote/files/webpack-module-federation-ts/tsconfig.lint.json__tmpl__ +0 -19
- package/dist/src/generators/remote/files/webpack-module-federation-ts/webpack.config.prod.ts__tmpl__ +0 -1
- package/dist/src/generators/remote/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +0 -17
- package/dist/src/generators/remote/lib/add-remote-to-dynamic-host.d.ts +0 -2
- package/dist/src/generators/remote/lib/add-remote-to-dynamic-host.js +0 -12
- package/dist/src/generators/remote/lib/setup-package-json-exports-for-remote.d.ts +0 -3
- package/dist/src/generators/remote/lib/setup-package-json-exports-for-remote.js +0 -30
- package/dist/src/generators/remote/lib/setup-ssr-for-remote.d.ts +0 -4
- package/dist/src/generators/remote/lib/setup-ssr-for-remote.js +0 -61
- package/dist/src/generators/remote/lib/setup-tspath-for-remote.d.ts +0 -3
- package/dist/src/generators/remote/lib/setup-tspath-for-remote.js +0 -14
- package/dist/src/generators/remote/lib/update-host-with-remote.d.ts +0 -2
- package/dist/src/generators/remote/lib/update-host-with-remote.js +0 -79
- package/dist/src/generators/remote/remote.d.ts +0 -6
- package/dist/src/generators/remote/remote.js +0 -201
- package/dist/src/generators/remote/schema.d.ts +0 -39
- package/dist/src/generators/remote/schema.json +0 -173
- package/dist/src/generators/setup-ssr/files/server.ts__tmpl__ +0 -28
- package/dist/src/generators/setup-ssr/files/src/main.server.tsx__tmpl__ +0 -47
- package/dist/src/generators/setup-ssr/files/tsconfig.server.json__tmpl__ +0 -17
- package/dist/src/generators/setup-ssr/schema.d.ts +0 -8
- package/dist/src/generators/setup-ssr/schema.json +0 -54
- package/dist/src/generators/setup-ssr/setup-ssr.d.ts +0 -4
- package/dist/src/generators/setup-ssr/setup-ssr.js +0 -198
- package/dist/src/module-federation/ast-utils.d.ts +0 -8
- package/dist/src/module-federation/ast-utils.js +0 -101
- package/dist/src/rules/update-module-federation-project.d.ts +0 -11
- package/dist/src/rules/update-module-federation-project.js +0 -72
- package/dist/src/utils/add-mf-env-to-inputs.d.ts +0 -2
- package/dist/src/utils/add-mf-env-to-inputs.js +0 -29
- package/dist/src/utils/module-federation-deprecation.d.ts +0 -12
- package/dist/src/utils/module-federation-deprecation.js +0 -46
- package/dist/src/utils/normalize-remote.d.ts +0 -8
- package/dist/src/utils/normalize-remote.js +0 -31
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addModuleFederationFiles = addModuleFederationFiles;
|
|
4
|
-
exports.remoteGenerator = remoteGenerator;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
const internal_1 = require("@nx/devkit/internal");
|
|
7
|
-
const assert_supported_react_version_1 = require("../../utils/assert-supported-react-version");
|
|
8
|
-
const internal_2 = require("@nx/eslint/internal");
|
|
9
|
-
const devkit_1 = require("@nx/devkit");
|
|
10
|
-
const path_1 = require("path");
|
|
11
|
-
const js_1 = require("@nx/js");
|
|
12
|
-
const internal_3 = require("@nx/js/internal");
|
|
13
|
-
const update_module_federation_project_1 = require("../../rules/update-module-federation-project");
|
|
14
|
-
const add_mf_env_to_inputs_1 = require("../../utils/add-mf-env-to-inputs");
|
|
15
|
-
const normalize_remote_1 = require("../../utils/normalize-remote");
|
|
16
|
-
const find_free_port_1 = require("../application/lib/find-free-port");
|
|
17
|
-
const maybe_js_1 = require("../../utils/maybe-js");
|
|
18
|
-
const module_federation_deprecation_1 = require("../../utils/module-federation-deprecation");
|
|
19
|
-
const versions_1 = require("../../utils/versions");
|
|
20
|
-
const application_1 = tslib_1.__importDefault(require("../application/application"));
|
|
21
|
-
const create_application_files_1 = require("../application/lib/create-application-files");
|
|
22
|
-
const normalize_options_1 = require("../application/lib/normalize-options");
|
|
23
|
-
const setup_ssr_1 = tslib_1.__importDefault(require("../setup-ssr/setup-ssr"));
|
|
24
|
-
const add_remote_to_dynamic_host_1 = require("./lib/add-remote-to-dynamic-host");
|
|
25
|
-
const setup_package_json_exports_for_remote_1 = require("./lib/setup-package-json-exports-for-remote");
|
|
26
|
-
const setup_ssr_for_remote_1 = require("./lib/setup-ssr-for-remote");
|
|
27
|
-
const setup_tspath_for_remote_1 = require("./lib/setup-tspath-for-remote");
|
|
28
|
-
const update_host_with_remote_1 = require("./lib/update-host-with-remote");
|
|
29
|
-
function addModuleFederationFiles(host, options) {
|
|
30
|
-
const templateVariables = options.bundler === 'rspack'
|
|
31
|
-
? {
|
|
32
|
-
...(0, create_application_files_1.getDefaultTemplateVariables)(host, options),
|
|
33
|
-
rspackPluginOptions: {
|
|
34
|
-
...(0, create_application_files_1.createNxRspackPluginOptions)(options, (0, devkit_1.offsetFromRoot)(options.appProjectRoot), false),
|
|
35
|
-
mainServer: `./server.ts`,
|
|
36
|
-
},
|
|
37
|
-
}
|
|
38
|
-
: {
|
|
39
|
-
...(0, devkit_1.names)(options.projectName),
|
|
40
|
-
...options,
|
|
41
|
-
tmpl: '',
|
|
42
|
-
};
|
|
43
|
-
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, `./files/${options.js
|
|
44
|
-
? options.bundler === 'rspack'
|
|
45
|
-
? 'rspack-common'
|
|
46
|
-
: 'common'
|
|
47
|
-
: 'common-ts'}`), options.appProjectRoot, templateVariables);
|
|
48
|
-
const pathToModuleFederationFiles = options.typescriptConfiguration
|
|
49
|
-
? `${options.bundler === 'rspack' ? 'rspack-' : 'webpack-'}module-federation-ts`
|
|
50
|
-
: `${options.bundler === 'rspack' ? 'rspack-' : 'webpack-'}module-federation`;
|
|
51
|
-
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, `./files/${pathToModuleFederationFiles}`), options.appProjectRoot, templateVariables);
|
|
52
|
-
if (options.typescriptConfiguration) {
|
|
53
|
-
const pathToBundlerConfig = (0, devkit_1.joinPathFragments)(options.appProjectRoot, options.bundler === 'rspack' ? 'rspack.config.js' : 'webpack.config.js');
|
|
54
|
-
const pathToWebpackProdConfig = (0, devkit_1.joinPathFragments)(options.appProjectRoot, options.bundler === 'rspack'
|
|
55
|
-
? 'rspack.config.prod.js'
|
|
56
|
-
: 'webpack.config.prod.js');
|
|
57
|
-
if (host.exists(pathToBundlerConfig)) {
|
|
58
|
-
host.delete(pathToBundlerConfig);
|
|
59
|
-
}
|
|
60
|
-
if (host.exists(pathToWebpackProdConfig)) {
|
|
61
|
-
host.delete(pathToWebpackProdConfig);
|
|
62
|
-
}
|
|
63
|
-
// Delete TypeScript prod config in TS solution setup - not needed in Crystal
|
|
64
|
-
if ((0, internal_3.isUsingTsSolutionSetup)(host)) {
|
|
65
|
-
const pathToTsProdConfig = (0, devkit_1.joinPathFragments)(options.appProjectRoot, options.bundler === 'rspack'
|
|
66
|
-
? 'rspack.config.prod.ts'
|
|
67
|
-
: 'webpack.config.prod.ts');
|
|
68
|
-
if (host.exists(pathToTsProdConfig)) {
|
|
69
|
-
host.delete(pathToTsProdConfig);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
async function remoteGenerator(host, schema) {
|
|
75
|
-
(0, assert_supported_react_version_1.assertSupportedReactVersion)(host);
|
|
76
|
-
(0, module_federation_deprecation_1.warnReactRemoteGeneratorDeprecation)();
|
|
77
|
-
const tasks = [];
|
|
78
|
-
const name = await (0, normalize_remote_1.normalizeRemoteName)(host, schema.name, schema);
|
|
79
|
-
const options = {
|
|
80
|
-
...(await (0, normalize_options_1.normalizeOptions)(host, {
|
|
81
|
-
...schema,
|
|
82
|
-
name,
|
|
83
|
-
})),
|
|
84
|
-
// when js is set to true, we want to use the js configuration
|
|
85
|
-
js: schema.js ?? false,
|
|
86
|
-
typescriptConfiguration: schema.js
|
|
87
|
-
? false
|
|
88
|
-
: (schema.typescriptConfiguration ?? true),
|
|
89
|
-
dynamic: schema.dynamic ?? false,
|
|
90
|
-
// TODO(colum): remove when Webpack MF works with Crystal
|
|
91
|
-
addPlugin: !schema.bundler || schema.bundler === 'rspack' ? true : false,
|
|
92
|
-
bundler: schema.bundler ?? 'rspack',
|
|
93
|
-
// Unlike a plain app, a remote needs a port of its own: updateModuleFederationProject
|
|
94
|
-
// writes it to the serve target, and a dynamic remote's is also recorded in the host
|
|
95
|
-
// manifest. findFreePort reads the ports already claimed, so remotes step past each other.
|
|
96
|
-
port: schema.port ?? schema.devServerPort ?? (0, find_free_port_1.findFreePort)(host),
|
|
97
|
-
};
|
|
98
|
-
if (options.dynamic) {
|
|
99
|
-
// Dynamic remotes generate with library { type: 'var' } by default.
|
|
100
|
-
// We need to ensure that the remote name is a valid variable name.
|
|
101
|
-
const isValidRemote = (0, js_1.isValidVariable)(options.projectName);
|
|
102
|
-
if (!isValidRemote.isValid) {
|
|
103
|
-
throw new Error(`Invalid remote name provided: ${options.projectName}. ${isValidRemote.message}`);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
await (0, internal_1.ensureRootProjectName)(options, 'application');
|
|
107
|
-
const isValidRemote = (0, js_1.isValidVariable)(options.projectName);
|
|
108
|
-
if (!isValidRemote.isValid) {
|
|
109
|
-
throw new Error(`Invalid remote name provided: ${options.projectName}. ${isValidRemote.message}`);
|
|
110
|
-
}
|
|
111
|
-
const initAppTask = await (0, application_1.default)(host, {
|
|
112
|
-
...options,
|
|
113
|
-
name: options.projectName,
|
|
114
|
-
skipFormat: true,
|
|
115
|
-
});
|
|
116
|
-
tasks.push(initAppTask);
|
|
117
|
-
// In TS solution setup, update package.json to use simple name instead of scoped name
|
|
118
|
-
if ((0, internal_3.isUsingTsSolutionSetup)(host)) {
|
|
119
|
-
const remotePackageJsonPath = (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json');
|
|
120
|
-
if (host.exists(remotePackageJsonPath)) {
|
|
121
|
-
(0, devkit_1.updateJson)(host, remotePackageJsonPath, (json) => {
|
|
122
|
-
json.name = options.projectName;
|
|
123
|
-
return json;
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
if (options.host) {
|
|
128
|
-
(0, update_host_with_remote_1.updateHostWithRemote)(host, options.host, options.projectName);
|
|
129
|
-
}
|
|
130
|
-
// Module federation requires bootstrap code to be dynamically imported.
|
|
131
|
-
// Renaming original entry file so we can use `import(./bootstrap)` in
|
|
132
|
-
// new entry file.
|
|
133
|
-
host.rename((0, path_1.join)(options.appProjectRoot, (0, maybe_js_1.maybeJs)({ js: options.js, useJsx: options.bundler === 'rspack' }, 'src/main.tsx')), (0, path_1.join)(options.appProjectRoot, (0, maybe_js_1.maybeJs)({ js: options.js, useJsx: options.bundler === 'rspack' }, 'src/bootstrap.tsx')));
|
|
134
|
-
addModuleFederationFiles(host, options);
|
|
135
|
-
(0, update_module_federation_project_1.updateModuleFederationProject)(host, options);
|
|
136
|
-
// Conditionally setup TS path or package.json exports based on TS solution setup
|
|
137
|
-
if ((0, internal_3.isUsingTsSolutionSetup)(host)) {
|
|
138
|
-
(0, setup_package_json_exports_for_remote_1.setupPackageJsonExportsForRemote)(host, options);
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
(0, setup_tspath_for_remote_1.setupTspathForRemote)(host, options);
|
|
142
|
-
}
|
|
143
|
-
if (options.ssr) {
|
|
144
|
-
if (options.bundler !== 'rspack') {
|
|
145
|
-
const setupSsrTask = await (0, setup_ssr_1.default)(host, {
|
|
146
|
-
project: options.projectName,
|
|
147
|
-
serverPort: options.port,
|
|
148
|
-
skipFormat: true,
|
|
149
|
-
bundler: options.bundler,
|
|
150
|
-
});
|
|
151
|
-
tasks.push(setupSsrTask);
|
|
152
|
-
}
|
|
153
|
-
const setupSsrForRemoteTask = await (0, setup_ssr_for_remote_1.setupSsrForRemote)(host, options, options.projectName);
|
|
154
|
-
tasks.push(setupSsrForRemoteTask);
|
|
155
|
-
const projectConfig = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
|
|
156
|
-
if (options.bundler !== 'rspack') {
|
|
157
|
-
projectConfig.targets.server.options.webpackConfig = (0, devkit_1.joinPathFragments)(projectConfig.root, `webpack.server.config.${options.typescriptConfiguration ? 'ts' : 'js'}`);
|
|
158
|
-
(0, devkit_1.updateProjectConfiguration)(host, options.projectName, projectConfig);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
if (!(0, internal_2.isTypedLintingEnabled)(options)) {
|
|
162
|
-
host.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.lint.json'));
|
|
163
|
-
}
|
|
164
|
-
if (options.host && options.bundler === 'rspack') {
|
|
165
|
-
const projectConfig = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
|
|
166
|
-
projectConfig.targets.serve ??= {};
|
|
167
|
-
projectConfig.targets.serve.dependsOn ??= [];
|
|
168
|
-
projectConfig.targets.serve.dependsOn.push(`${options.host}:serve`);
|
|
169
|
-
(0, devkit_1.updateProjectConfiguration)(host, options.projectName, projectConfig);
|
|
170
|
-
}
|
|
171
|
-
if (options.host && options.dynamic) {
|
|
172
|
-
const hostConfig = (0, devkit_1.readProjectConfiguration)(host, schema.host);
|
|
173
|
-
const pathToMFManifest = (0, devkit_1.joinPathFragments)((0, internal_3.getProjectSourceRoot)(hostConfig, host), 'assets/module-federation.manifest.json');
|
|
174
|
-
(0, add_remote_to_dynamic_host_1.addRemoteToDynamicHost)(host, options.projectName, options.port, pathToMFManifest);
|
|
175
|
-
}
|
|
176
|
-
(0, add_mf_env_to_inputs_1.addMfEnvToTargetDefaultInputs)(host, options.bundler);
|
|
177
|
-
const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, {}, {
|
|
178
|
-
'@module-federation/enhanced': versions_1.moduleFederationEnhancedVersion,
|
|
179
|
-
'@nx/web': versions_1.nxVersion,
|
|
180
|
-
'@nx/module-federation': versions_1.nxVersion,
|
|
181
|
-
// The webpack path also generates a `serve-static` target running the
|
|
182
|
-
// `module-federation-static-server` executor, which proxies via express.
|
|
183
|
-
...(options.bundler !== 'rspack'
|
|
184
|
-
? {
|
|
185
|
-
express: versions_1.expressVersion,
|
|
186
|
-
'http-proxy-middleware': versions_1.httpProxyMiddlewareVersion,
|
|
187
|
-
}
|
|
188
|
-
: {}),
|
|
189
|
-
}, undefined, true);
|
|
190
|
-
tasks.push(installTask);
|
|
191
|
-
// The TS config templates use extensionless relative imports and
|
|
192
|
-
// `__dirname`, which Node's native type stripping cannot load.
|
|
193
|
-
if (options.typescriptConfiguration) {
|
|
194
|
-
tasks.push((0, internal_3.addSwcRegisterDependencies)(host));
|
|
195
|
-
}
|
|
196
|
-
if (!options.skipFormat) {
|
|
197
|
-
await (0, devkit_1.formatFiles)(host);
|
|
198
|
-
}
|
|
199
|
-
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
200
|
-
}
|
|
201
|
-
exports.default = remoteGenerator;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { LinterType } from '@nx/js';
|
|
2
|
-
import type { SupportedStyles } from '../../../typings/style';
|
|
3
|
-
import type { NormalizedSchema as ApplicationNormalizedSchema } from '../application/schema';
|
|
4
|
-
|
|
5
|
-
export interface Schema {
|
|
6
|
-
classComponent?: boolean;
|
|
7
|
-
compiler?: 'babel' | 'swc';
|
|
8
|
-
port?: number;
|
|
9
|
-
/** @deprecated Use {@link Schema.port} instead. This option will be removed in Nx v24. */
|
|
10
|
-
devServerPort?: number;
|
|
11
|
-
directory: string;
|
|
12
|
-
e2eTestRunner: 'cypress' | 'playwright' | 'none';
|
|
13
|
-
globalCss?: boolean;
|
|
14
|
-
host?: string;
|
|
15
|
-
js?: boolean;
|
|
16
|
-
linter?: LinterType;
|
|
17
|
-
name?: string;
|
|
18
|
-
routing?: boolean;
|
|
19
|
-
enableTypedLinting?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
22
|
-
*/
|
|
23
|
-
setParserOptionsProject?: boolean;
|
|
24
|
-
skipFormat: boolean;
|
|
25
|
-
skipNxJson?: boolean;
|
|
26
|
-
skipPackageJson?: boolean;
|
|
27
|
-
ssr?: boolean;
|
|
28
|
-
strict?: boolean;
|
|
29
|
-
style: SupportedStyles;
|
|
30
|
-
tags?: string;
|
|
31
|
-
unitTestRunner: 'jest' | 'vitest' | 'none';
|
|
32
|
-
typescriptConfiguration?: boolean;
|
|
33
|
-
dynamic?: boolean;
|
|
34
|
-
bundler?: 'rspack' | 'webpack';
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface NormalizedSchema extends ApplicationNormalizedSchema {
|
|
38
|
-
typescriptConfiguration: boolean;
|
|
39
|
-
}
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"$id": "GeneratorReactRemote",
|
|
4
|
-
"cli": "nx",
|
|
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
|
-
"type": "object",
|
|
8
|
-
"properties": {
|
|
9
|
-
"directory": {
|
|
10
|
-
"description": "The directory of the new application.",
|
|
11
|
-
"type": "string",
|
|
12
|
-
"alias": "dir",
|
|
13
|
-
"$default": {
|
|
14
|
-
"$source": "argv",
|
|
15
|
-
"index": 0
|
|
16
|
-
},
|
|
17
|
-
"x-prompt": "Which directory do you want to create the application in?"
|
|
18
|
-
},
|
|
19
|
-
"name": {
|
|
20
|
-
"type": "string",
|
|
21
|
-
"description": "The name of the Producer (remote) application to generate the Module Federation configuration",
|
|
22
|
-
"pattern": "^[a-zA-Z][^:]*$",
|
|
23
|
-
"x-priority": "important"
|
|
24
|
-
},
|
|
25
|
-
"dynamic": {
|
|
26
|
-
"type": "boolean",
|
|
27
|
-
"description": "Should the Consumer (host) application use dynamic federation?",
|
|
28
|
-
"default": false,
|
|
29
|
-
"x-priority": "internal"
|
|
30
|
-
},
|
|
31
|
-
"style": {
|
|
32
|
-
"description": "The file extension to be used for style files.",
|
|
33
|
-
"type": "string",
|
|
34
|
-
"default": "css",
|
|
35
|
-
"alias": "s",
|
|
36
|
-
"enum": ["css", "scss", "none"],
|
|
37
|
-
"x-prompt": {
|
|
38
|
-
"message": "Which stylesheet format would you like to use?",
|
|
39
|
-
"type": "list",
|
|
40
|
-
"items": [
|
|
41
|
-
{
|
|
42
|
-
"value": "css",
|
|
43
|
-
"label": "CSS"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"value": "scss",
|
|
47
|
-
"label": "SASS(.scss) [ https://sass-lang.com ]"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"value": "none",
|
|
51
|
-
"label": "None"
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
"linter": {
|
|
57
|
-
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
58
|
-
"type": "string",
|
|
59
|
-
"enum": ["eslint", "oxlint", "none"]
|
|
60
|
-
},
|
|
61
|
-
"routing": {
|
|
62
|
-
"type": "boolean",
|
|
63
|
-
"description": "Generate application with routes.",
|
|
64
|
-
"default": false
|
|
65
|
-
},
|
|
66
|
-
"skipFormat": {
|
|
67
|
-
"description": "Skip formatting files.",
|
|
68
|
-
"type": "boolean",
|
|
69
|
-
"default": false,
|
|
70
|
-
"x-priority": "internal"
|
|
71
|
-
},
|
|
72
|
-
"skipNxJson": {
|
|
73
|
-
"description": "Skip updating nx.json with default options based on values provided to this app (e.g. babel, style).",
|
|
74
|
-
"type": "boolean",
|
|
75
|
-
"default": false,
|
|
76
|
-
"x-priority": "internal"
|
|
77
|
-
},
|
|
78
|
-
"unitTestRunner": {
|
|
79
|
-
"type": "string",
|
|
80
|
-
"enum": ["jest", "vitest", "none"],
|
|
81
|
-
"description": "Test runner to use for unit tests.",
|
|
82
|
-
"default": "jest"
|
|
83
|
-
},
|
|
84
|
-
"e2eTestRunner": {
|
|
85
|
-
"type": "string",
|
|
86
|
-
"enum": ["playwright", "cypress", "none"],
|
|
87
|
-
"description": "Test runner to use for end to end (E2E) tests.",
|
|
88
|
-
"x-prompt": "Which E2E test runner would you like to use?",
|
|
89
|
-
"default": "playwright"
|
|
90
|
-
},
|
|
91
|
-
"tags": {
|
|
92
|
-
"type": "string",
|
|
93
|
-
"description": "Add tags to the application (used for linting).",
|
|
94
|
-
"alias": "t"
|
|
95
|
-
},
|
|
96
|
-
"classComponent": {
|
|
97
|
-
"type": "boolean",
|
|
98
|
-
"description": "Use class components instead of functional component.",
|
|
99
|
-
"alias": "C",
|
|
100
|
-
"default": false
|
|
101
|
-
},
|
|
102
|
-
"js": {
|
|
103
|
-
"type": "boolean",
|
|
104
|
-
"description": "Generate JavaScript files rather than TypeScript files.",
|
|
105
|
-
"default": false
|
|
106
|
-
},
|
|
107
|
-
"globalCss": {
|
|
108
|
-
"type": "boolean",
|
|
109
|
-
"description": "Default is false. When true, the component is generated with *.css/*.scss instead of *.module.css/*.module.scss.",
|
|
110
|
-
"default": false
|
|
111
|
-
},
|
|
112
|
-
"strict": {
|
|
113
|
-
"type": "boolean",
|
|
114
|
-
"description": "Creates an application with strict mode and strict type checking.",
|
|
115
|
-
"default": true
|
|
116
|
-
},
|
|
117
|
-
"enableTypedLinting": {
|
|
118
|
-
"type": "boolean",
|
|
119
|
-
"description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
|
|
120
|
-
"default": false
|
|
121
|
-
},
|
|
122
|
-
"setParserOptionsProject": {
|
|
123
|
-
"type": "boolean",
|
|
124
|
-
"description": "Deprecated alias for `enableTypedLinting`.",
|
|
125
|
-
"default": false,
|
|
126
|
-
"x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
|
|
127
|
-
},
|
|
128
|
-
"compiler": {
|
|
129
|
-
"type": "string",
|
|
130
|
-
"description": "The compiler to use.",
|
|
131
|
-
"enum": ["babel", "swc"],
|
|
132
|
-
"default": "babel"
|
|
133
|
-
},
|
|
134
|
-
"host": {
|
|
135
|
-
"type": "string",
|
|
136
|
-
"description": "The Consumer (host) application for this Producer (remote).",
|
|
137
|
-
"x-priority": "important",
|
|
138
|
-
"alias": "consumer"
|
|
139
|
-
},
|
|
140
|
-
"port": {
|
|
141
|
-
"type": "number",
|
|
142
|
-
"description": "The port on which this Producer (remote) app should be served.",
|
|
143
|
-
"aliases": ["devServerPort"],
|
|
144
|
-
"x-priority": "important"
|
|
145
|
-
},
|
|
146
|
-
"ssr": {
|
|
147
|
-
"description": "Whether to configure SSR for the Consumer (host) application",
|
|
148
|
-
"type": "boolean",
|
|
149
|
-
"default": false
|
|
150
|
-
},
|
|
151
|
-
"typescriptConfiguration": {
|
|
152
|
-
"type": "boolean",
|
|
153
|
-
"description": "Whether the module federation configuration and webpack configuration files should use TS. When --js is used, this flag is ignored.",
|
|
154
|
-
"default": true
|
|
155
|
-
},
|
|
156
|
-
"skipPackageJson": {
|
|
157
|
-
"description": "Do not add dependencies to `package.json`.",
|
|
158
|
-
"type": "boolean",
|
|
159
|
-
"default": false,
|
|
160
|
-
"x-priority": "internal"
|
|
161
|
-
},
|
|
162
|
-
"bundler": {
|
|
163
|
-
"description": "The bundler to use.",
|
|
164
|
-
"type": "string",
|
|
165
|
-
"enum": ["rspack", "webpack"],
|
|
166
|
-
"x-prompt": "Which bundler do you want to use to build the application?",
|
|
167
|
-
"default": "rspack",
|
|
168
|
-
"x-priority": "important"
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
"required": ["directory"],
|
|
172
|
-
"additionalProperties": false
|
|
173
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as path from 'path';
|
|
2
|
-
import express from 'express';
|
|
3
|
-
import cors from 'cors';
|
|
4
|
-
|
|
5
|
-
import { handleRequest } from './src/main.server';
|
|
6
|
-
|
|
7
|
-
const port = process.env['PORT'] || <%= port %>;
|
|
8
|
-
const app = express();
|
|
9
|
-
|
|
10
|
-
const browserDist = path.join(process.cwd(), '<%= browserBuildOutputPath %>');
|
|
11
|
-
const indexPath = path.join(browserDist, 'index.html');
|
|
12
|
-
|
|
13
|
-
app.use(cors());
|
|
14
|
-
|
|
15
|
-
app.get(
|
|
16
|
-
'*.*',
|
|
17
|
-
express.static(browserDist, {
|
|
18
|
-
maxAge: '1y',
|
|
19
|
-
})
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
app.use('*', handleRequest(indexPath));
|
|
23
|
-
|
|
24
|
-
const server = app.listen(port, () => {
|
|
25
|
-
// Server has started
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
server.on('error', console.error);
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { Request, Response } from 'express';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import * as ReactDOMServer from 'react-dom/server';
|
|
4
|
-
import isbot from 'isbot'
|
|
5
|
-
|
|
6
|
-
import App from './<%= appComponentImport %>';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
let indexHtml: null | string = null;
|
|
10
|
-
|
|
11
|
-
export function handleRequest(indexPath: string) {
|
|
12
|
-
return function render(req: Request, res: Response) {
|
|
13
|
-
let didError = false;
|
|
14
|
-
|
|
15
|
-
if (!indexHtml) {
|
|
16
|
-
indexHtml = fs.readFileSync(indexPath).toString();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const [htmlStart, htmlEnd] = indexHtml.split(`<div id="root"></div>`);
|
|
20
|
-
|
|
21
|
-
// For bots (e.g. search engines), the content will not be streamed but render all at once.
|
|
22
|
-
// For users, content should be streamed to the user as they are ready.
|
|
23
|
-
const callbackName = isbot(req.headers['user-agent']) ? 'onAllReady' : 'onShellReady';
|
|
24
|
-
|
|
25
|
-
const stream = ReactDOMServer.renderToPipeableStream(
|
|
26
|
-
<App />,
|
|
27
|
-
{
|
|
28
|
-
[callbackName]() {
|
|
29
|
-
res.statusCode = didError ? 500 : 200;
|
|
30
|
-
res.setHeader('Content-type', 'text/html; charset=utf-8');
|
|
31
|
-
res.write(`${htmlStart}<div id="root">`);
|
|
32
|
-
stream.pipe(res);
|
|
33
|
-
res.write(`</div>${htmlEnd}`);
|
|
34
|
-
},
|
|
35
|
-
onShellError(error) {
|
|
36
|
-
console.error(error);
|
|
37
|
-
res.statusCode = 500;
|
|
38
|
-
res.send('<!doctype html><h1>Server Error</h1>');
|
|
39
|
-
},
|
|
40
|
-
onError(error) {
|
|
41
|
-
didError = true;
|
|
42
|
-
console.error(error);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.app.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../out-tsc/server",
|
|
5
|
-
"target": "es2019",
|
|
6
|
-
"types": [
|
|
7
|
-
"node",
|
|
8
|
-
"@nx/react/typings/cssmodule.d.ts",
|
|
9
|
-
"@nx/react/typings/image.d.ts"
|
|
10
|
-
]
|
|
11
|
-
},
|
|
12
|
-
"include": [
|
|
13
|
-
<%- extraInclude %>
|
|
14
|
-
"src/main.server.tsx",
|
|
15
|
-
"server.ts"
|
|
16
|
-
]
|
|
17
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"$id": "GeneratorReactSSRSetup",
|
|
4
|
-
"cli": "nx",
|
|
5
|
-
"title": "Generate SSR setup for a React app",
|
|
6
|
-
"description": "Create the additional configuration required to enable SSR via Express for a React application.",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"properties": {
|
|
9
|
-
"project": {
|
|
10
|
-
"type": "string",
|
|
11
|
-
"description": "The name of the application to add SSR support to.",
|
|
12
|
-
"$default": {
|
|
13
|
-
"$source": "argv",
|
|
14
|
-
"index": 0
|
|
15
|
-
},
|
|
16
|
-
"x-prompt": "What app would you like to add SSR support to?",
|
|
17
|
-
"x-dropdown": "projects",
|
|
18
|
-
"x-priority": "important"
|
|
19
|
-
},
|
|
20
|
-
"appComponentImportPath": {
|
|
21
|
-
"type": "string",
|
|
22
|
-
"description": "The import path of the <App/ > component, relative to project sourceRoot.",
|
|
23
|
-
"default": "app/app"
|
|
24
|
-
},
|
|
25
|
-
"serverPort": {
|
|
26
|
-
"type": "number",
|
|
27
|
-
"default": 4200,
|
|
28
|
-
"description": "The port for the Express server.",
|
|
29
|
-
"x-priority": "important"
|
|
30
|
-
},
|
|
31
|
-
"skipFormat": {
|
|
32
|
-
"type": "boolean",
|
|
33
|
-
"description": "Skip formatting the workspace after the generator completes.",
|
|
34
|
-
"x-priority": "internal"
|
|
35
|
-
},
|
|
36
|
-
"extraInclude": {
|
|
37
|
-
"type": "array",
|
|
38
|
-
"items": {
|
|
39
|
-
"type": "string"
|
|
40
|
-
},
|
|
41
|
-
"hidden": true,
|
|
42
|
-
"description": "Extra include entries in tsconfig.",
|
|
43
|
-
"default": []
|
|
44
|
-
},
|
|
45
|
-
"bundler": {
|
|
46
|
-
"description": "The bundler to use.",
|
|
47
|
-
"type": "string",
|
|
48
|
-
"enum": ["rspack", "webpack"],
|
|
49
|
-
"default": "webpack"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"required": ["project"],
|
|
53
|
-
"additionalProperties": false
|
|
54
|
-
}
|