@nx/react 18.0.0-beta.0 → 18.0.0-beta.1
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/plugins/component-testing/index.js +1 -1
- package/src/generators/application/application.js +4 -0
- package/src/generators/application/schema.json +3 -3
- package/src/generators/component/schema.d.ts +4 -4
- package/src/generators/component/schema.json +7 -7
- package/src/generators/component-cypress-spec/schema.json +1 -1
- package/src/generators/component-story/schema.json +1 -1
- package/src/generators/component-test/schema.json +1 -1
- package/src/generators/federate-module/schema.json +1 -1
- package/src/generators/hook/schema.d.ts +4 -4
- package/src/generators/hook/schema.json +5 -5
- package/src/generators/host/host.js +2 -0
- package/src/generators/host/schema.d.ts +1 -1
- package/src/generators/host/schema.json +3 -3
- package/src/generators/init/schema.json +1 -1
- package/src/generators/library/library.js +4 -0
- package/src/generators/library/schema.json +3 -3
- package/src/generators/redux/schema.d.ts +1 -1
- package/src/generators/redux/schema.json +2 -2
- package/src/generators/remote/remote.js +2 -0
- package/src/generators/remote/schema.d.ts +1 -1
- package/src/generators/remote/schema.json +3 -3
- package/src/generators/setup-ssr/schema.json +1 -1
- package/src/generators/setup-tailwind/schema.json +1 -1
- package/src/generators/stories/schema.json +1 -1
- package/src/generators/storybook-configuration/configuration.js +1 -1
- package/src/generators/storybook-configuration/schema.json +4 -4
- 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": "18.0.0-beta.
|
|
3
|
+
"version": "18.0.0-beta.1",
|
|
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": "18.0.0-beta.
|
|
41
|
-
"@nx/js": "18.0.0-beta.
|
|
42
|
-
"@nx/eslint": "18.0.0-beta.
|
|
43
|
-
"@nx/web": "18.0.0-beta.
|
|
44
|
-
"@nrwl/react": "18.0.0-beta.
|
|
40
|
+
"@nx/devkit": "18.0.0-beta.1",
|
|
41
|
+
"@nx/js": "18.0.0-beta.1",
|
|
42
|
+
"@nx/eslint": "18.0.0-beta.1",
|
|
43
|
+
"@nx/web": "18.0.0-beta.1",
|
|
44
|
+
"@nrwl/react": "18.0.0-beta.1"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
@@ -152,7 +152,7 @@ function buildTargetWebpack(ctx, buildTarget, componentTestingProjectName) {
|
|
|
152
152
|
}
|
|
153
153
|
return async () => {
|
|
154
154
|
customWebpack = await customWebpack;
|
|
155
|
-
// TODO(
|
|
155
|
+
// TODO(v19): Once webpackConfig is always set in @nx/webpack:webpack and isolatedConfig is removed, we no longer need this default.
|
|
156
156
|
const configure = composePluginsSync(withNx(), withWeb());
|
|
157
157
|
const defaultWebpack = configure({}, {
|
|
158
158
|
options: {
|
|
@@ -22,6 +22,7 @@ const show_possible_warnings_1 = require("./lib/show-possible-warnings");
|
|
|
22
22
|
const add_e2e_1 = require("./lib/add-e2e");
|
|
23
23
|
const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
|
|
24
24
|
const js_1 = require("@nx/js");
|
|
25
|
+
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
25
26
|
async function addLinting(host, options) {
|
|
26
27
|
const tasks = [];
|
|
27
28
|
if (options.linter === eslint_1.Linter.EsLint) {
|
|
@@ -208,6 +209,9 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
208
209
|
if (!options.skipFormat) {
|
|
209
210
|
await (0, devkit_1.formatFiles)(host);
|
|
210
211
|
}
|
|
212
|
+
tasks.push(() => {
|
|
213
|
+
(0, log_show_project_command_1.logShowProjectCommand)(options.projectName);
|
|
214
|
+
});
|
|
211
215
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
212
216
|
}
|
|
213
217
|
exports.applicationGeneratorInternal = applicationGeneratorInternal;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"cli": "nx",
|
|
4
4
|
"$id": "NxReactApp",
|
|
5
5
|
"title": "Create a React Application",
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"value": "scss",
|
|
59
|
-
"label": "SASS(.scss) [
|
|
59
|
+
"label": "SASS(.scss) [ https://sass-lang.com ]"
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
"value": "less",
|
|
63
|
-
"label": "LESS [
|
|
63
|
+
"label": "LESS [ https://lesscss.org ]"
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
"value": "styled-components",
|
|
@@ -3,7 +3,7 @@ import { SupportedStyles } from '../../../typings/style';
|
|
|
3
3
|
export interface Schema {
|
|
4
4
|
name: string;
|
|
5
5
|
/**
|
|
6
|
-
* @deprecated Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx
|
|
6
|
+
* @deprecated Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19.
|
|
7
7
|
*/
|
|
8
8
|
project?: string;
|
|
9
9
|
style: SupportedStyles;
|
|
@@ -11,18 +11,18 @@ export interface Schema {
|
|
|
11
11
|
directory?: string;
|
|
12
12
|
export?: boolean;
|
|
13
13
|
/**
|
|
14
|
-
* @deprecated Provide the `name` in pascal-case and use the `as-provided` format. This option will be removed in Nx
|
|
14
|
+
* @deprecated Provide the `name` in pascal-case and use the `as-provided` format. This option will be removed in Nx v19.
|
|
15
15
|
*/
|
|
16
16
|
pascalCaseFiles?: boolean;
|
|
17
17
|
/**
|
|
18
|
-
* @deprecated Provide the `directory` in pascal-case and use the `as-provided` format. This option will be removed in Nx
|
|
18
|
+
* @deprecated Provide the `directory` in pascal-case and use the `as-provided` format. This option will be removed in Nx v19.
|
|
19
19
|
*/
|
|
20
20
|
pascalCaseDirectory?: boolean;
|
|
21
21
|
classComponent?: boolean;
|
|
22
22
|
routing?: boolean;
|
|
23
23
|
js?: boolean;
|
|
24
24
|
/**
|
|
25
|
-
* @deprecated Provide the `directory` option instead and use the `as-provided` format. This option will be removed in Nx
|
|
25
|
+
* @deprecated Provide the `directory` option instead and use the `as-provided` format. This option will be removed in Nx v19.
|
|
26
26
|
*/
|
|
27
27
|
flat?: boolean;
|
|
28
28
|
globalCss?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"cli": "nx",
|
|
4
4
|
"$id": "NxReactComponent",
|
|
5
5
|
"title": "Create a React Component",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"$default": {
|
|
14
14
|
"$source": "projectName"
|
|
15
15
|
},
|
|
16
|
-
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx
|
|
16
|
+
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19."
|
|
17
17
|
},
|
|
18
18
|
"name": {
|
|
19
19
|
"type": "string",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
"value": "scss",
|
|
43
|
-
"label": "SASS(.scss) [
|
|
43
|
+
"label": "SASS(.scss) [ https://sass-lang.com ]"
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
"value": "less",
|
|
47
|
-
"label": "LESS [
|
|
47
|
+
"label": "LESS [ https://lesscss.org ]"
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
"value": "styled-components",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"type": "boolean",
|
|
92
92
|
"description": "Create component at the source root rather than its own directory.",
|
|
93
93
|
"default": false,
|
|
94
|
-
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. This option will be removed in Nx
|
|
94
|
+
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. This option will be removed in Nx v19."
|
|
95
95
|
},
|
|
96
96
|
"export": {
|
|
97
97
|
"type": "boolean",
|
|
@@ -105,14 +105,14 @@
|
|
|
105
105
|
"description": "Use pascal case component file name (e.g. `App.tsx`).",
|
|
106
106
|
"alias": "P",
|
|
107
107
|
"default": false,
|
|
108
|
-
"x-deprecated": "Provide the `name` in pascal-case and use the `as-provided` format. This option will be removed in Nx
|
|
108
|
+
"x-deprecated": "Provide the `name` in pascal-case and use the `as-provided` format. This option will be removed in Nx v19."
|
|
109
109
|
},
|
|
110
110
|
"pascalCaseDirectory": {
|
|
111
111
|
"type": "boolean",
|
|
112
112
|
"description": "Use pascal case directory name (e.g. `App/App.tsx`).",
|
|
113
113
|
"alias": "R",
|
|
114
114
|
"default": false,
|
|
115
|
-
"x-deprecated": "Provide the `directory` in pascal-case and use the `as-provided` format. This option will be removed in Nx
|
|
115
|
+
"x-deprecated": "Provide the `directory` in pascal-case and use the `as-provided` format. This option will be removed in Nx v19."
|
|
116
116
|
},
|
|
117
117
|
"classComponent": {
|
|
118
118
|
"type": "boolean",
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
export interface Schema {
|
|
2
2
|
name: string;
|
|
3
3
|
/**
|
|
4
|
-
* @deprecated Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx
|
|
4
|
+
* @deprecated Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19.
|
|
5
5
|
*/
|
|
6
6
|
project: string;
|
|
7
7
|
skipTests?: boolean;
|
|
8
8
|
directory?: string;
|
|
9
9
|
export?: boolean;
|
|
10
10
|
/**
|
|
11
|
-
* @deprecated Provide the `name` option instead and use the `as-provided` format. This option will be removed in Nx
|
|
11
|
+
* @deprecated Provide the `name` option instead and use the `as-provided` format. This option will be removed in Nx v19.
|
|
12
12
|
*/
|
|
13
13
|
pascalCaseFiles?: boolean;
|
|
14
14
|
/**
|
|
15
|
-
* @deprecated Provide the `directory` option instead and use the `as-provided` format. This option will be removed in Nx
|
|
15
|
+
* @deprecated Provide the `directory` option instead and use the `as-provided` format. This option will be removed in Nx v19.
|
|
16
16
|
*/
|
|
17
17
|
pascalCaseDirectory?: boolean;
|
|
18
18
|
/**
|
|
19
|
-
* @deprecated Provide the `directory` option instead and use the `as-provided` format. This option will be removed in Nx
|
|
19
|
+
* @deprecated Provide the `directory` option instead and use the `as-provided` format. This option will be removed in Nx v19.
|
|
20
20
|
*/
|
|
21
21
|
flat?: boolean;
|
|
22
22
|
js?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"cli": "nx",
|
|
4
4
|
"$id": "NxReactHook",
|
|
5
5
|
"title": "Create a React Hook for Nx",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"$default": {
|
|
20
20
|
"$source": "projectName"
|
|
21
21
|
},
|
|
22
|
-
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx
|
|
22
|
+
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19."
|
|
23
23
|
},
|
|
24
24
|
"name": {
|
|
25
25
|
"type": "string",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"type": "boolean",
|
|
57
57
|
"description": "Create hook at the source root rather than its own directory.",
|
|
58
58
|
"default": false,
|
|
59
|
-
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx
|
|
59
|
+
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19."
|
|
60
60
|
},
|
|
61
61
|
"export": {
|
|
62
62
|
"type": "boolean",
|
|
@@ -70,14 +70,14 @@
|
|
|
70
70
|
"description": "Use pascal case hook file name (e.g. `useHook.ts`).",
|
|
71
71
|
"alias": "P",
|
|
72
72
|
"default": false,
|
|
73
|
-
"x-deprecated": "Provide the `name` in pascal-case and use the `as-provided` format. This option will be removed in Nx
|
|
73
|
+
"x-deprecated": "Provide the `name` in pascal-case and use the `as-provided` format. This option will be removed in Nx v19."
|
|
74
74
|
},
|
|
75
75
|
"pascalCaseDirectory": {
|
|
76
76
|
"type": "boolean",
|
|
77
77
|
"description": "Use pascal case directory name (e.g. `useHook/useHook.ts`).",
|
|
78
78
|
"alias": "R",
|
|
79
79
|
"default": false,
|
|
80
|
-
"x-deprecated": "Provide the `directory` in pascal-case and use the `as-provided` format. This option will be removed in Nx
|
|
80
|
+
"x-deprecated": "Provide the `directory` in pascal-case and use the `as-provided` format. This option will be removed in Nx v19."
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
"required": ["name"]
|
|
@@ -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
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
|
2
2
|
import type { Linter } from '@nx/eslint';
|
|
3
|
-
import type { SupportedStyles } from '../../../typings';
|
|
3
|
+
import type { SupportedStyles } from '../../../typings/style';
|
|
4
4
|
|
|
5
5
|
export interface Schema {
|
|
6
6
|
classComponent?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"$id": "GeneratorReactHost",
|
|
4
4
|
"cli": "nx",
|
|
5
5
|
"title": "Generate Module Federation Setup for React Host App",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
"value": "scss",
|
|
46
|
-
"label": "SASS(.scss) [
|
|
46
|
+
"label": "SASS(.scss) [ https://sass-lang.com ]"
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
"value": "less",
|
|
50
|
-
"label": "LESS [
|
|
50
|
+
"label": "LESS [ https://lesscss.org ]"
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
"value": "styled-components",
|
|
@@ -17,6 +17,7 @@ const create_ts_config_1 = require("../../utils/create-ts-config");
|
|
|
17
17
|
const install_common_dependencies_1 = require("./lib/install-common-dependencies");
|
|
18
18
|
const set_defaults_1 = require("./lib/set-defaults");
|
|
19
19
|
const path_1 = require("path");
|
|
20
|
+
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
20
21
|
async function libraryGenerator(host, schema) {
|
|
21
22
|
return await libraryGeneratorInternal(host, {
|
|
22
23
|
projectNameAndRootFormat: 'derived',
|
|
@@ -179,6 +180,9 @@ async function libraryGeneratorInternal(host, schema) {
|
|
|
179
180
|
if (!options.skipFormat) {
|
|
180
181
|
await (0, devkit_1.formatFiles)(host);
|
|
181
182
|
}
|
|
183
|
+
tasks.push(() => {
|
|
184
|
+
(0, log_show_project_command_1.logShowProjectCommand)(options.name);
|
|
185
|
+
});
|
|
182
186
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
183
187
|
}
|
|
184
188
|
exports.libraryGeneratorInternal = libraryGeneratorInternal;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"cli": "nx",
|
|
4
4
|
"$id": "NxReactLibrary",
|
|
5
5
|
"title": "Create a React Library",
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
{ "value": "css", "label": "CSS" },
|
|
51
51
|
{
|
|
52
52
|
"value": "scss",
|
|
53
|
-
"label": "SASS(.scss) [
|
|
53
|
+
"label": "SASS(.scss) [ https://sass-lang.com ]"
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
"value": "less",
|
|
57
|
-
"label": "LESS [
|
|
57
|
+
"label": "LESS [ https://lesscss.org ]"
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
"value": "styled-components",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface Schema {
|
|
2
2
|
name: string;
|
|
3
3
|
/**
|
|
4
|
-
* @deprecated Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx
|
|
4
|
+
* @deprecated Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19.
|
|
5
5
|
*/
|
|
6
6
|
project?: string;
|
|
7
7
|
directory?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"cli": "nx",
|
|
4
4
|
"$id": "redux",
|
|
5
5
|
"title": "Create Redux state",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"$default": {
|
|
23
23
|
"$source": "projectName"
|
|
24
24
|
},
|
|
25
|
-
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx
|
|
25
|
+
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19."
|
|
26
26
|
},
|
|
27
27
|
"directory": {
|
|
28
28
|
"type": "string",
|
|
@@ -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
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
|
2
2
|
import type { Linter } from '@nx/eslint';
|
|
3
|
-
import type { SupportedStyles } from '../../../typings';
|
|
3
|
+
import type { SupportedStyles } from '../../../typings/style';
|
|
4
4
|
import type { NormalizedSchema as ApplicationNormalizedSchema } from '../application/schema';
|
|
5
5
|
|
|
6
6
|
export interface Schema {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"$id": "GeneratorReactRemote",
|
|
4
4
|
"cli": "nx",
|
|
5
5
|
"title": "Generate Module Federation Setup for React Remote App",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
"value": "scss",
|
|
52
|
-
"label": "SASS(.scss) [
|
|
52
|
+
"label": "SASS(.scss) [ https://sass-lang.com ]"
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
"value": "less",
|
|
56
|
-
"label": "LESS [
|
|
56
|
+
"label": "LESS [ https://lesscss.org ]"
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
"value": "styled-components",
|
|
@@ -5,7 +5,7 @@ const stories_1 = require("../stories/stories");
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const versions_1 = require("../../utils/versions");
|
|
7
7
|
async function generateStories(host, schema) {
|
|
8
|
-
// TODO(katerina): Nx
|
|
8
|
+
// TODO(katerina): Nx 19 -> remove Cypress
|
|
9
9
|
(0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
10
10
|
const { getE2eProjectName } = await Promise.resolve().then(() => require('@nx/cypress/src/utils/project-name'));
|
|
11
11
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(host, schema.project);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"cli": "nx",
|
|
4
4
|
"$id": "NxReactStorybookConfigure",
|
|
5
5
|
"title": "React Storybook Configure",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"configureCypress": {
|
|
30
30
|
"type": "boolean",
|
|
31
31
|
"description": "Run the cypress-configure generator.",
|
|
32
|
-
"x-deprecated": "Use interactionTests instead. This option will be removed in
|
|
32
|
+
"x-deprecated": "Use interactionTests instead. This option will be removed in v19."
|
|
33
33
|
},
|
|
34
34
|
"generateStories": {
|
|
35
35
|
"type": "boolean",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"generateCypressSpecs": {
|
|
42
42
|
"type": "boolean",
|
|
43
43
|
"description": "Automatically generate test files in the Cypress E2E app generated by the `cypress-configure` generator.",
|
|
44
|
-
"x-deprecated": "Use interactionTests instead. This option will be removed in
|
|
44
|
+
"x-deprecated": "Use interactionTests instead. This option will be removed in v19."
|
|
45
45
|
},
|
|
46
46
|
"configureStaticServe": {
|
|
47
47
|
"type": "boolean",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"cypressDirectory": {
|
|
54
54
|
"type": "string",
|
|
55
55
|
"description": "A directory where the Cypress project will be placed. Placed at the root by default.",
|
|
56
|
-
"x-deprecated": "Use interactionTests instead. This option will be removed in
|
|
56
|
+
"x-deprecated": "Use interactionTests instead. This option will be removed in v19."
|
|
57
57
|
},
|
|
58
58
|
"js": {
|
|
59
59
|
"type": "boolean",
|
|
@@ -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;
|