@nx/react 17.3.1 → 17.3.2
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/migrations.json +6 -0
- package/package.json +6 -6
- package/src/generators/application/files/nx-welcome/src/app/nx-welcome.tsx +19 -0
- package/src/generators/host/host.js +2 -0
- package/src/generators/remote/remote.js +2 -0
- package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.d.ts +2 -0
- package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.js +26 -0
- package/src/utils/add-mf-env-to-inputs.d.ts +2 -0
- package/src/utils/add-mf-env-to-inputs.js +24 -0
package/migrations.json
CHANGED
|
@@ -47,6 +47,12 @@
|
|
|
47
47
|
"version": "16.7.0-beta.2",
|
|
48
48
|
"description": "Add @nx/react types to tsconfig types array",
|
|
49
49
|
"implementation": "./src/migrations/update-16-7-0-add-typings/update-16-7-0-add-typings"
|
|
50
|
+
},
|
|
51
|
+
"add-module-federation-env-var-to-target-defaults": {
|
|
52
|
+
"cli": "nx",
|
|
53
|
+
"version": "18.0.0-beta.0",
|
|
54
|
+
"description": "Add NX_MF_DEV_SERVER_STATIC_REMOTES to inputs for task hashing when '@nx/webpack:webpack' is used for Module Federation.",
|
|
55
|
+
"factory": "./src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults"
|
|
50
56
|
}
|
|
51
57
|
},
|
|
52
58
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react",
|
|
3
|
-
"version": "17.3.
|
|
3
|
+
"version": "17.3.2",
|
|
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, 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": {
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"file-loader": "^6.2.0",
|
|
38
38
|
"minimatch": "9.0.3",
|
|
39
39
|
"tslib": "^2.3.0",
|
|
40
|
-
"@nx/devkit": "17.3.
|
|
41
|
-
"@nx/js": "17.3.
|
|
42
|
-
"@nx/eslint": "17.3.
|
|
43
|
-
"@nx/web": "17.3.
|
|
44
|
-
"@nrwl/react": "17.3.
|
|
40
|
+
"@nx/devkit": "17.3.2",
|
|
41
|
+
"@nx/js": "17.3.2",
|
|
42
|
+
"@nx/eslint": "17.3.2",
|
|
43
|
+
"@nx/web": "17.3.2",
|
|
44
|
+
"@nrwl/react": "17.3.2"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
@@ -795,6 +795,25 @@ export function NxWelcome({ title }: { title: string }) {
|
|
|
795
795
|
nx g @nx/react:component ui/src/lib/button
|
|
796
796
|
</pre>
|
|
797
797
|
</details>
|
|
798
|
+
<details>
|
|
799
|
+
<summary>
|
|
800
|
+
<svg
|
|
801
|
+
fill="none"
|
|
802
|
+
stroke="currentColor"
|
|
803
|
+
viewBox="0 0 24 24"
|
|
804
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
805
|
+
>
|
|
806
|
+
<path
|
|
807
|
+
strokeLinecap="round"
|
|
808
|
+
strokeLinejoin="round"
|
|
809
|
+
strokeWidth="2"
|
|
810
|
+
d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
|
|
811
|
+
/>
|
|
812
|
+
</svg>
|
|
813
|
+
View project details
|
|
814
|
+
</summary>
|
|
815
|
+
<pre>nx show project {title} --web</pre>
|
|
816
|
+
</details>
|
|
798
817
|
<details>
|
|
799
818
|
<summary>
|
|
800
819
|
<svg
|
|
@@ -11,6 +11,7 @@ const add_module_federation_files_1 = require("./lib/add-module-federation-files
|
|
|
11
11
|
const normalize_remote_1 = require("./lib/normalize-remote");
|
|
12
12
|
const setup_ssr_for_host_1 = require("./lib/setup-ssr-for-host");
|
|
13
13
|
const update_module_federation_e2e_project_1 = require("./lib/update-module-federation-e2e-project");
|
|
14
|
+
const add_mf_env_to_inputs_1 = require("../../utils/add-mf-env-to-inputs");
|
|
14
15
|
async function hostGenerator(host, schema) {
|
|
15
16
|
return hostGeneratorInternal(host, {
|
|
16
17
|
projectNameAndRootFormat: 'derived',
|
|
@@ -78,6 +79,7 @@ async function hostGeneratorInternal(host, schema) {
|
|
|
78
79
|
if (!options.setParserOptionsProject) {
|
|
79
80
|
host.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.lint.json'));
|
|
80
81
|
}
|
|
82
|
+
(0, add_mf_env_to_inputs_1.addMfEnvToTargetDefaultInputs)(host);
|
|
81
83
|
if (!options.skipFormat) {
|
|
82
84
|
await (0, devkit_1.formatFiles)(host);
|
|
83
85
|
}
|
|
@@ -11,6 +11,7 @@ const setup_ssr_1 = require("../setup-ssr/setup-ssr");
|
|
|
11
11
|
const setup_ssr_for_remote_1 = require("./lib/setup-ssr-for-remote");
|
|
12
12
|
const setup_tspath_for_remote_1 = require("./lib/setup-tspath-for-remote");
|
|
13
13
|
const add_remote_to_dynamic_host_1 = require("./lib/add-remote-to-dynamic-host");
|
|
14
|
+
const add_mf_env_to_inputs_1 = require("../../utils/add-mf-env-to-inputs");
|
|
14
15
|
function addModuleFederationFiles(host, options) {
|
|
15
16
|
const templateVariables = {
|
|
16
17
|
...(0, devkit_1.names)(options.name),
|
|
@@ -85,6 +86,7 @@ async function remoteGeneratorInternal(host, schema) {
|
|
|
85
86
|
const pathToMFManifest = (0, devkit_1.joinPathFragments)(hostConfig.sourceRoot, 'assets/module-federation.manifest.json');
|
|
86
87
|
(0, add_remote_to_dynamic_host_1.addRemoteToDynamicHost)(host, options.name, options.devServerPort, pathToMFManifest);
|
|
87
88
|
}
|
|
89
|
+
(0, add_mf_env_to_inputs_1.addMfEnvToTargetDefaultInputs)(host);
|
|
88
90
|
if (!options.skipFormat) {
|
|
89
91
|
await (0, devkit_1.formatFiles)(host);
|
|
90
92
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
const add_mf_env_to_inputs_1 = require("../../utils/add-mf-env-to-inputs");
|
|
5
|
+
async function default_1(tree) {
|
|
6
|
+
if (!hasModuleFederationProject(tree)) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
(0, add_mf_env_to_inputs_1.addMfEnvToTargetDefaultInputs)(tree);
|
|
10
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
11
|
+
}
|
|
12
|
+
exports.default = default_1;
|
|
13
|
+
function hasModuleFederationProject(tree) {
|
|
14
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
15
|
+
for (const project of projects.values()) {
|
|
16
|
+
const targets = project.targets;
|
|
17
|
+
for (const [_, target] of Object.entries(targets)) {
|
|
18
|
+
if (target.executor === '@nx/webpack:webpack' &&
|
|
19
|
+
(tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.ts')) ||
|
|
20
|
+
tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.js')))) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addMfEnvToTargetDefaultInputs = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function addMfEnvToTargetDefaultInputs(tree) {
|
|
6
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
7
|
+
const webpackExecutor = '@nx/webpack:webpack';
|
|
8
|
+
const mfEnvVar = 'NX_MF_DEV_SERVER_STATIC_REMOTES';
|
|
9
|
+
nxJson.targetDefaults ??= {};
|
|
10
|
+
nxJson.targetDefaults[webpackExecutor] ??= {};
|
|
11
|
+
nxJson.targetDefaults[webpackExecutor].inputs ??= [];
|
|
12
|
+
let mfEnvVarExists = false;
|
|
13
|
+
for (const input of nxJson.targetDefaults[webpackExecutor].inputs) {
|
|
14
|
+
if (typeof input === 'object' && input['env'] === mfEnvVar) {
|
|
15
|
+
mfEnvVarExists = true;
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (!mfEnvVarExists) {
|
|
20
|
+
nxJson.targetDefaults[webpackExecutor].inputs.push({ env: mfEnvVar });
|
|
21
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.addMfEnvToTargetDefaultInputs = addMfEnvToTargetDefaultInputs;
|