@nx/react 23.2.0-beta.6 → 23.2.0-beta.8
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/module-federation.d.ts +1 -2
- package/dist/module-federation.js +2 -3
- package/dist/plugins/component-testing/webpack-fallback.js +5 -0
- package/dist/src/generators/application/application.js +12 -24
- package/dist/src/generators/application/files/nx-welcome/claimed/src/app/nx-welcome.tsx__tmpl__ +2 -0
- package/dist/src/generators/application/files/nx-welcome/not-configured/src/app/nx-welcome.tsx__tmpl__ +2 -0
- package/dist/src/generators/application/files/nx-welcome/unclaimed/src/app/nx-welcome.tsx__tmpl__ +2 -0
- package/dist/src/generators/application/files/react-router-ssr/nx-welcome/claimed/app/nx-welcome.tsx__tmpl__ +2 -0
- package/dist/src/generators/application/files/react-router-ssr/nx-welcome/not-configured/app/nx-welcome.tsx__tmpl__ +2 -0
- package/dist/src/generators/application/files/react-router-ssr/nx-welcome/unclaimed/app/nx-welcome.tsx__tmpl__ +2 -0
- package/dist/src/generators/application/lib/add-linting.d.ts +0 -1
- package/dist/src/generators/application/lib/add-linting.js +21 -32
- package/dist/src/generators/application/lib/create-application-files.d.ts +1 -1
- package/dist/src/generators/application/lib/normalize-options.js +15 -11
- package/dist/src/generators/application/schema.d.ts +4 -2
- package/dist/src/generators/application/schema.json +2 -4
- package/dist/src/generators/federate-module/schema.d.ts +2 -2
- package/dist/src/generators/federate-module/schema.json +2 -3
- package/dist/src/generators/host/lib/setup-ssr-for-host.js +7 -8
- package/dist/src/generators/host/schema.d.ts +4 -2
- package/dist/src/generators/host/schema.json +2 -3
- package/dist/src/generators/library/lib/add-linting.js +28 -29
- package/dist/src/generators/library/lib/normalize-options.js +28 -21
- package/dist/src/generators/library/lib/update-app-routes.js +1 -2
- package/dist/src/generators/library/schema.d.ts +4 -2
- package/dist/src/generators/library/schema.json +2 -4
- package/dist/src/generators/remote/lib/setup-ssr-for-remote.js +8 -9
- package/dist/src/generators/remote/schema.d.ts +2 -2
- package/dist/src/generators/remote/schema.json +2 -3
- package/dist/src/generators/storybook-configuration/schema.d.ts +2 -2
- package/dist/src/generators/storybook-configuration/schema.json +1 -2
- package/dist/src/utils/ast-utils.js +2 -2
- package/package.json +17 -17
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { withModuleFederation } from '@nx/module-federation/webpack';
|
|
2
|
-
import { withModuleFederationForSSR } from '@nx/module-federation/webpack';
|
|
1
|
+
import { withModuleFederation, withModuleFederationForSSR } from '@nx/module-federation/webpack';
|
|
3
2
|
/**
|
|
4
3
|
* @deprecated Use `@nx/module-federation/webpack` instead. This will be removed in Nx v22.
|
|
5
4
|
*/
|
|
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.withModuleFederationForSSR = exports.withModuleFederation = void 0;
|
|
4
4
|
const webpack_1 = require("@nx/module-federation/webpack");
|
|
5
5
|
Object.defineProperty(exports, "withModuleFederation", { enumerable: true, get: function () { return webpack_1.withModuleFederation; } });
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "withModuleFederationForSSR", { enumerable: true, get: function () { return webpack_2.withModuleFederationForSSR; } });
|
|
6
|
+
Object.defineProperty(exports, "withModuleFederationForSSR", { enumerable: true, get: function () { return webpack_1.withModuleFederationForSSR; } });
|
|
8
7
|
// Support for older generated code: `const withModuleFederation = require('@nx/react/module-federation')`
|
|
9
8
|
/**
|
|
10
9
|
* @deprecated Use `@nx/module-federation/webpack` instead. This will be removed in Nx v22.
|
|
@@ -18,4 +17,4 @@ module.exports.withModuleFederation = webpack_1.withModuleFederation;
|
|
|
18
17
|
/**
|
|
19
18
|
* @deprecated Use `@nx/module-federation/webpack` instead. This will be removed in Nx v22.
|
|
20
19
|
*/
|
|
21
|
-
module.exports.withModuleFederationForSSR =
|
|
20
|
+
module.exports.withModuleFederationForSSR = webpack_1.withModuleFederationForSSR;
|
|
@@ -78,6 +78,11 @@ const loaderModulesOptions = {
|
|
|
78
78
|
modules: {
|
|
79
79
|
mode: 'local',
|
|
80
80
|
getLocalIdent: webpack_1.getCSSModuleLocalIdent,
|
|
81
|
+
// css-loader 7 defaults namedExport to true, and to camel-case-only
|
|
82
|
+
// locals when it is off. Generated components import the default
|
|
83
|
+
// export and reference class names as authored, so pin both.
|
|
84
|
+
namedExport: false,
|
|
85
|
+
exportLocalsConvention: 'asIs',
|
|
81
86
|
},
|
|
82
87
|
importLoaders: 1,
|
|
83
88
|
};
|
|
@@ -6,9 +6,8 @@ const tslib_1 = require("tslib");
|
|
|
6
6
|
const internal_1 = require("@nx/devkit/internal");
|
|
7
7
|
const assert_supported_react_version_1 = require("../../utils/assert-supported-react-version");
|
|
8
8
|
const devkit_1 = require("@nx/devkit");
|
|
9
|
-
const internal_2 = require("@nx/devkit/internal");
|
|
10
9
|
const js_1 = require("@nx/js");
|
|
11
|
-
const
|
|
10
|
+
const internal_2 = require("@nx/js/internal");
|
|
12
11
|
const create_ts_config_1 = require("../../utils/create-ts-config");
|
|
13
12
|
const init_1 = tslib_1.__importDefault(require("../init/init"));
|
|
14
13
|
const create_application_files_1 = require("./lib/create-application-files");
|
|
@@ -35,7 +34,7 @@ async function applicationGenerator(tree, schema) {
|
|
|
35
34
|
async function applicationGeneratorInternal(tree, schema) {
|
|
36
35
|
(0, assert_supported_react_version_1.assertSupportedReactVersion)(tree);
|
|
37
36
|
const tasks = [];
|
|
38
|
-
const addTsPlugin = (0,
|
|
37
|
+
const addTsPlugin = (0, internal_2.shouldConfigureTsSolutionSetup)(tree, schema.addPlugin, schema.useTsSolution);
|
|
39
38
|
const jsInitTask = await (0, js_1.initGenerator)(tree, {
|
|
40
39
|
...schema,
|
|
41
40
|
tsConfigName: schema.rootProject ? 'tsconfig.json' : 'tsconfig.base.json',
|
|
@@ -49,22 +48,11 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
49
48
|
options.useReactRouter =
|
|
50
49
|
options.routing && options.bundler === 'vite'
|
|
51
50
|
? (options.useReactRouter ??
|
|
52
|
-
(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
name: 'Yes',
|
|
59
|
-
message: 'I want to use react-router [ https://reactrouter.com/start/framework/routing ]',
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: 'No',
|
|
63
|
-
message: 'I do not want to use react-router for server-side rendering',
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
initial: 0,
|
|
67
|
-
}, { response: 'No' }).then((r) => r.response === 'Yes')))
|
|
51
|
+
((0, internal_1.isInteractive)()
|
|
52
|
+
? await (0, internal_1.confirmationPrompt)({
|
|
53
|
+
message: 'Would you like to use react-router for server-side rendering?',
|
|
54
|
+
})
|
|
55
|
+
: false))
|
|
68
56
|
: false;
|
|
69
57
|
const initTask = await (0, init_1.default)(tree, {
|
|
70
58
|
...options,
|
|
@@ -76,7 +64,7 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
76
64
|
const nxJson = (0, devkit_1.readNxJson)(tree) ?? {};
|
|
77
65
|
const existing = findBuildDefault(nxJson.targetDefaults);
|
|
78
66
|
if (!existing) {
|
|
79
|
-
(0,
|
|
67
|
+
(0, internal_1.upsertTargetDefault)(tree, nxJson, {
|
|
80
68
|
target: 'build',
|
|
81
69
|
cache: true,
|
|
82
70
|
dependsOn: ['^build'],
|
|
@@ -84,7 +72,7 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
84
72
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
85
73
|
}
|
|
86
74
|
else if (!existing.dependsOn) {
|
|
87
|
-
(0,
|
|
75
|
+
(0, internal_1.upsertTargetDefault)(tree, nxJson, {
|
|
88
76
|
target: 'build',
|
|
89
77
|
dependsOn: ['^build'],
|
|
90
78
|
});
|
|
@@ -108,7 +96,7 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
108
96
|
// If we are using the new TS solution
|
|
109
97
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
110
98
|
if (options.isUsingTsSolutionConfig) {
|
|
111
|
-
await (0,
|
|
99
|
+
await (0, internal_2.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
|
|
112
100
|
}
|
|
113
101
|
const lintTask = await (0, add_linting_1.addLinting)(tree, options);
|
|
114
102
|
tasks.push(lintTask);
|
|
@@ -157,14 +145,14 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
157
145
|
});
|
|
158
146
|
}
|
|
159
147
|
// Only for the new TS solution
|
|
160
|
-
(0,
|
|
148
|
+
(0, internal_2.updateTsconfigFiles)(tree, options.appProjectRoot, 'tsconfig.app.json', {
|
|
161
149
|
jsx: 'react-jsx',
|
|
162
150
|
module: 'esnext',
|
|
163
151
|
moduleResolution: 'bundler',
|
|
164
152
|
}, options.linter === 'eslint'
|
|
165
153
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
166
154
|
: undefined, options.useReactRouter ? 'app' : 'src');
|
|
167
|
-
(0,
|
|
155
|
+
(0, internal_2.sortPackageJsonFields)(tree, options.appProjectRoot);
|
|
168
156
|
if (!options.skipFormat) {
|
|
169
157
|
await (0, devkit_1.formatFiles)(tree);
|
|
170
158
|
}
|
package/dist/src/generators/application/files/nx-welcome/claimed/src/app/nx-welcome.tsx__tmpl__
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
Delete this file and get started with your project!
|
|
6
6
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
7
7
|
*/
|
|
8
|
+
/* oxlint-disable jsx-a11y/prefer-tag-over-role -- the icons below
|
|
9
|
+
are inline SVGs, which have no tag to swap the role for. */
|
|
8
10
|
export function NxWelcome({ title }: { title: string }) {
|
|
9
11
|
return (
|
|
10
12
|
<>
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
Delete this file and get started with your project!
|
|
6
6
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
7
7
|
*/
|
|
8
|
+
/* oxlint-disable jsx-a11y/prefer-tag-over-role -- the icons below
|
|
9
|
+
are inline SVGs, which have no tag to swap the role for. */
|
|
8
10
|
export function NxWelcome({ title }: { title: string }) {
|
|
9
11
|
return (
|
|
10
12
|
<>
|
package/dist/src/generators/application/files/nx-welcome/unclaimed/src/app/nx-welcome.tsx__tmpl__
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
Delete this file and get started with your project!
|
|
6
6
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
7
7
|
*/
|
|
8
|
+
/* oxlint-disable jsx-a11y/prefer-tag-over-role -- the icons below
|
|
9
|
+
are inline SVGs, which have no tag to swap the role for. */
|
|
8
10
|
export function NxWelcome({ title }: { title: string }) {
|
|
9
11
|
return (
|
|
10
12
|
<>
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
Delete this file and get started with your project!
|
|
6
6
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
7
7
|
*/
|
|
8
|
+
/* oxlint-disable jsx-a11y/prefer-tag-over-role -- the icons below
|
|
9
|
+
are inline SVGs, which have no tag to swap the role for. */
|
|
8
10
|
export function NxWelcome({ title }: { title: string }) {
|
|
9
11
|
return (
|
|
10
12
|
<>
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
Delete this file and get started with your project!
|
|
6
6
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
7
7
|
*/
|
|
8
|
+
/* oxlint-disable jsx-a11y/prefer-tag-over-role -- the icons below
|
|
9
|
+
are inline SVGs, which have no tag to swap the role for. */
|
|
8
10
|
export function NxWelcome({ title }: { title: string }) {
|
|
9
11
|
return (
|
|
10
12
|
<>
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
Delete this file and get started with your project!
|
|
6
6
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
7
7
|
*/
|
|
8
|
+
/* oxlint-disable jsx-a11y/prefer-tag-over-role -- the icons below
|
|
9
|
+
are inline SVGs, which have no tag to swap the role for. */
|
|
8
10
|
export function NxWelcome({ title }: { title: string }) {
|
|
9
11
|
return (
|
|
10
12
|
<>
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { type Tree, type GeneratorCallback } from '@nx/devkit';
|
|
2
2
|
import { NormalizedSchema } from '../schema';
|
|
3
3
|
export declare function addLinting(host: Tree, options: NormalizedSchema): Promise<GeneratorCallback>;
|
|
4
|
-
export declare function isEslintInstalled(tree: Tree): boolean;
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addLinting = addLinting;
|
|
4
|
-
exports.isEslintInstalled = isEslintInstalled;
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const eslint_1 = require("@nx/eslint");
|
|
7
5
|
const internal_1 = require("@nx/eslint/internal");
|
|
8
|
-
const devkit_2 = require("@nx/devkit");
|
|
9
6
|
const internal_2 = require("@nx/js/internal");
|
|
10
7
|
const lint_1 = require("../../../utils/lint");
|
|
11
8
|
const versions_1 = require("../../../utils/versions");
|
|
12
9
|
async function addLinting(host, options) {
|
|
10
|
+
if (options.linter === 'none') {
|
|
11
|
+
return () => { };
|
|
12
|
+
}
|
|
13
13
|
const tasks = [];
|
|
14
|
+
tasks.push(await (0, internal_2.addLintingToProject)(host, {
|
|
15
|
+
oxlintPlugins: ['react', 'react-perf', 'jsx-a11y'],
|
|
16
|
+
linter: options.linter,
|
|
17
|
+
project: options.projectName,
|
|
18
|
+
tsConfigPaths: [
|
|
19
|
+
(0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
|
|
20
|
+
],
|
|
21
|
+
unitTestRunner: options.unitTestRunner,
|
|
22
|
+
rootProject: options.rootProject,
|
|
23
|
+
skipPackageJson: options.skipPackageJson,
|
|
24
|
+
enableTypedLinting: (0, internal_1.isTypedLintingEnabled)(options),
|
|
25
|
+
addPlugin: options.addPlugin,
|
|
26
|
+
}));
|
|
27
|
+
// Predefined configs, `extends` and ignore entries are ESLint concepts with
|
|
28
|
+
// no equivalent in other linters.
|
|
14
29
|
if (options.linter === 'eslint') {
|
|
15
|
-
const lintTask = await (0, eslint_1.lintProjectGenerator)(host, {
|
|
16
|
-
linter: options.linter,
|
|
17
|
-
project: options.projectName,
|
|
18
|
-
tsConfigPaths: [
|
|
19
|
-
(0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
|
|
20
|
-
],
|
|
21
|
-
unitTestRunner: options.unitTestRunner,
|
|
22
|
-
skipFormat: true,
|
|
23
|
-
rootProject: options.rootProject,
|
|
24
|
-
skipPackageJson: options.skipPackageJson,
|
|
25
|
-
enableTypedLinting: (0, internal_1.isTypedLintingEnabled)(options),
|
|
26
|
-
addPlugin: options.addPlugin,
|
|
27
|
-
});
|
|
28
|
-
tasks.push(lintTask);
|
|
29
30
|
if ((0, internal_1.isEslintConfigSupported)(host)) {
|
|
30
31
|
if ((0, internal_1.useFlatConfig)(host)) {
|
|
31
32
|
(0, internal_1.addPredefinedConfigToFlatLintConfig)(host, options.appProjectRoot, 'flat/react', { checkBaseConfig: true });
|
|
@@ -41,7 +42,7 @@ async function addLinting(host, options) {
|
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
if (!options.skipPackageJson) {
|
|
44
|
-
const installTask = (0,
|
|
45
|
+
const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies, lint_1.extraEslintDependencies.devDependencies, undefined, true);
|
|
45
46
|
const addSwcTask = (0, internal_2.addSwcDependencies)(host);
|
|
46
47
|
tasks.push(installTask, addSwcTask);
|
|
47
48
|
}
|
|
@@ -49,10 +50,10 @@ async function addLinting(host, options) {
|
|
|
49
50
|
await ignoreReactRouterFilesInEslintConfig(host, options.appProjectRoot);
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
|
-
return (0,
|
|
53
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
53
54
|
}
|
|
54
55
|
async function ignoreReactRouterFilesInEslintConfig(tree, projectRoot) {
|
|
55
|
-
if (!
|
|
56
|
+
if (!(0, internal_2.detectLinters)(tree).includes('eslint')) {
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
58
59
|
(0, devkit_1.ensurePackage)('@nx/eslint', versions_1.nxVersion);
|
|
@@ -71,15 +72,3 @@ async function ignoreReactRouterFilesInEslintConfig(tree, projectRoot) {
|
|
|
71
72
|
const directory = isUsingFlatConfig ? '' : (projectRoot ?? '');
|
|
72
73
|
addIgnoresToLintConfig(tree, directory, ['**/build', '**/.react-router']);
|
|
73
74
|
}
|
|
74
|
-
function isEslintInstalled(tree) {
|
|
75
|
-
try {
|
|
76
|
-
require('eslint');
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
catch { }
|
|
80
|
-
// it might not be installed yet, but it might be in the tree pending install
|
|
81
|
-
const { devDependencies, dependencies } = tree.exists('package.json')
|
|
82
|
-
? (0, devkit_1.readJson)(tree, 'package.json')
|
|
83
|
-
: {};
|
|
84
|
-
return !!devDependencies?.['eslint'] || !!dependencies?.['eslint'];
|
|
85
|
-
}
|
|
@@ -12,7 +12,6 @@ export declare function getDefaultTemplateVariables(host: Tree, options: Normali
|
|
|
12
12
|
tags?: string;
|
|
13
13
|
inSourceTests?: boolean;
|
|
14
14
|
e2eTestRunner: 'cypress' | 'playwright' | 'none';
|
|
15
|
-
linter: import("@nx/eslint").Linter | import("@nx/eslint").LinterType;
|
|
16
15
|
classComponent?: boolean;
|
|
17
16
|
routing?: boolean;
|
|
18
17
|
useReactRouter?: boolean;
|
|
@@ -32,6 +31,7 @@ export declare function getDefaultTemplateVariables(host: Tree, options: Normali
|
|
|
32
31
|
useTsSolution?: boolean;
|
|
33
32
|
formatter?: 'prettier' | 'none';
|
|
34
33
|
useProjectJson?: boolean;
|
|
34
|
+
linter: import("@nx/js").LinterType;
|
|
35
35
|
projectName: string;
|
|
36
36
|
appProjectRoot: string;
|
|
37
37
|
e2eProjectName: string;
|
|
@@ -46,17 +46,21 @@ async function normalizeOptions(host, options) {
|
|
|
46
46
|
names: (0, devkit_1.names)(projectNames.projectSimpleName),
|
|
47
47
|
isUsingTsSolutionConfig,
|
|
48
48
|
useProjectJson: options.useProjectJson ?? !isUsingTsSolutionConfig,
|
|
49
|
+
routing: options.routing ?? false,
|
|
50
|
+
useReactRouter: options.useReactRouter ?? false,
|
|
51
|
+
strict: options.strict ?? true,
|
|
52
|
+
classComponent: options.classComponent ?? false,
|
|
53
|
+
compiler: options.compiler ?? 'babel',
|
|
54
|
+
bundler: options.bundler ?? 'webpack',
|
|
55
|
+
unitTestRunner: options.unitTestRunner ?? 'jest',
|
|
56
|
+
e2eTestRunner: options.e2eTestRunner ?? 'playwright',
|
|
57
|
+
inSourceTests: options.minimal || options.inSourceTests,
|
|
58
|
+
devServerPort: options.devServerPort ?? options.port ?? (0, find_free_port_1.findFreePort)(host),
|
|
59
|
+
minimal: options.minimal ?? false,
|
|
60
|
+
// Programmatic callers such as the host and remote generators leave this
|
|
61
|
+
// unset; the guards downstream read an unresolved `undefined` as "not eslint"
|
|
62
|
+
// and would half-configure the project.
|
|
63
|
+
linter: await (0, internal_2.normalizeLinterOption)(host, options.linter),
|
|
49
64
|
};
|
|
50
|
-
normalized.routing = normalized.routing ?? false;
|
|
51
|
-
normalized.useReactRouter = normalized.useReactRouter ?? false;
|
|
52
|
-
normalized.strict = normalized.strict ?? true;
|
|
53
|
-
normalized.classComponent = normalized.classComponent ?? false;
|
|
54
|
-
normalized.compiler = normalized.compiler ?? 'babel';
|
|
55
|
-
normalized.bundler = normalized.bundler ?? 'webpack';
|
|
56
|
-
normalized.unitTestRunner = normalized.unitTestRunner ?? 'jest';
|
|
57
|
-
normalized.e2eTestRunner = normalized.e2eTestRunner ?? 'playwright';
|
|
58
|
-
normalized.inSourceTests = normalized.minimal || normalized.inSourceTests;
|
|
59
|
-
normalized.devServerPort ??= options.port ?? (0, find_free_port_1.findFreePort)(host);
|
|
60
|
-
normalized.minimal = normalized.minimal ?? false;
|
|
61
65
|
return normalized;
|
|
62
66
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { names } from '@nx/devkit';
|
|
2
|
-
import type {
|
|
2
|
+
import type { LinterType } from '@nx/js';
|
|
3
3
|
import type { SupportedStyles } from '../../../typings/style';
|
|
4
4
|
|
|
5
5
|
export interface Schema {
|
|
@@ -11,7 +11,7 @@ export interface Schema {
|
|
|
11
11
|
unitTestRunner?: 'jest' | 'vitest' | 'none';
|
|
12
12
|
inSourceTests?: boolean;
|
|
13
13
|
e2eTestRunner: 'cypress' | 'playwright' | 'none';
|
|
14
|
-
linter
|
|
14
|
+
linter?: LinterType;
|
|
15
15
|
classComponent?: boolean;
|
|
16
16
|
routing?: boolean;
|
|
17
17
|
useReactRouter?: boolean;
|
|
@@ -41,6 +41,8 @@ export interface Schema {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export interface NormalizedSchema<T extends Schema = Schema> extends T {
|
|
44
|
+
// `normalizeOptions` always resolves this, so it is no longer optional.
|
|
45
|
+
linter: LinterType;
|
|
44
46
|
projectName: string;
|
|
45
47
|
appProjectRoot: string;
|
|
46
48
|
e2eProjectName: string;
|
|
@@ -97,11 +97,9 @@
|
|
|
97
97
|
"x-priority": "important"
|
|
98
98
|
},
|
|
99
99
|
"linter": {
|
|
100
|
-
"description": "The tool to use for running lint checks.",
|
|
100
|
+
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
101
101
|
"type": "string",
|
|
102
|
-
"enum": ["eslint", "none"],
|
|
103
|
-
"default": "none",
|
|
104
|
-
"x-prompt": "Which linter would you like to use?",
|
|
102
|
+
"enum": ["eslint", "oxlint", "none"],
|
|
105
103
|
"x-priority": "important"
|
|
106
104
|
},
|
|
107
105
|
"unitTestRunner": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LinterType } from '@nx/js';
|
|
2
2
|
|
|
3
3
|
export interface Schema {
|
|
4
4
|
name: string;
|
|
@@ -7,7 +7,7 @@ export interface Schema {
|
|
|
7
7
|
remoteDirectory?: string;
|
|
8
8
|
e2eTestRunner?: 'cypress' | 'playwright' | 'none';
|
|
9
9
|
host?: string;
|
|
10
|
-
linter?:
|
|
10
|
+
linter?: LinterType;
|
|
11
11
|
skipFormat?: boolean;
|
|
12
12
|
style?: SupportedStyles;
|
|
13
13
|
unitTestRunner?: 'jest' | 'vitest' | 'none';
|
|
@@ -50,10 +50,9 @@
|
|
|
50
50
|
"alias": "s"
|
|
51
51
|
},
|
|
52
52
|
"linter": {
|
|
53
|
-
"description": "The tool to use for running lint checks.",
|
|
53
|
+
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
54
54
|
"type": "string",
|
|
55
|
-
"enum": ["eslint"]
|
|
56
|
-
"default": "eslint"
|
|
55
|
+
"enum": ["eslint", "oxlint", "none"]
|
|
57
56
|
},
|
|
58
57
|
"skipFormat": {
|
|
59
58
|
"description": "Skip formatting files.",
|
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setupSsrForHost = setupSsrForHost;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const devkit_2 = require("@nx/devkit");
|
|
6
5
|
const versions_1 = require("../../../utils/versions");
|
|
7
6
|
const create_application_files_1 = require("../../application/lib/create-application-files");
|
|
8
7
|
async function setupSsrForHost(tree, options, appName, defaultRemoteManifest) {
|
|
9
8
|
const tasks = [];
|
|
10
|
-
let project = (0,
|
|
9
|
+
let project = (0, devkit_1.readProjectConfiguration)(tree, appName);
|
|
11
10
|
if (options.bundler !== 'rspack') {
|
|
12
11
|
project.targets.serve.executor =
|
|
13
12
|
'@nx/react:module-federation-ssr-dev-server';
|
|
14
|
-
(0,
|
|
13
|
+
(0, devkit_1.updateProjectConfiguration)(tree, appName, project);
|
|
15
14
|
}
|
|
16
15
|
const pathToModuleFederationSsrFiles = options.typescriptConfiguration
|
|
17
16
|
? `${options.bundler === 'rspack' ? 'rspack-' : 'webpack-'}module-federation-ssr-ts`
|
|
@@ -28,7 +27,7 @@ async function setupSsrForHost(tree, options, appName, defaultRemoteManifest) {
|
|
|
28
27
|
static: !options?.dynamic,
|
|
29
28
|
remotes: defaultRemoteManifest.map(({ name, port }) => {
|
|
30
29
|
return {
|
|
31
|
-
...(0,
|
|
30
|
+
...(0, devkit_1.names)(name),
|
|
32
31
|
port,
|
|
33
32
|
};
|
|
34
33
|
}),
|
|
@@ -42,13 +41,13 @@ async function setupSsrForHost(tree, options, appName, defaultRemoteManifest) {
|
|
|
42
41
|
browserBuildOutputPath: project.targets.build?.options?.outputPath,
|
|
43
42
|
remotes: defaultRemoteManifest.map(({ name, port }) => {
|
|
44
43
|
return {
|
|
45
|
-
...(0,
|
|
44
|
+
...(0, devkit_1.names)(name),
|
|
46
45
|
port,
|
|
47
46
|
};
|
|
48
47
|
}),
|
|
49
48
|
};
|
|
50
|
-
(0,
|
|
51
|
-
const installTask = (0,
|
|
49
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, `../files/${pathToModuleFederationSsrFiles}`), project.root, templateVariables);
|
|
50
|
+
const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
52
51
|
'@module-federation/node': versions_1.moduleFederationNodeVersion,
|
|
53
52
|
cors: versions_1.corsVersion,
|
|
54
53
|
isbot: versions_1.isbotVersion,
|
|
@@ -56,5 +55,5 @@ async function setupSsrForHost(tree, options, appName, defaultRemoteManifest) {
|
|
|
56
55
|
'@types/express': versions_1.typesExpressVersion,
|
|
57
56
|
}, {}, undefined, true);
|
|
58
57
|
tasks.push(installTask);
|
|
59
|
-
return (0,
|
|
58
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
60
59
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LinterType } from '@nx/js';
|
|
2
2
|
import type { SupportedStyles } from '../../../typings/style';
|
|
3
3
|
|
|
4
4
|
export interface Schema {
|
|
@@ -9,7 +9,7 @@ export interface Schema {
|
|
|
9
9
|
e2eTestRunner: 'cypress' | 'playwright' | 'none';
|
|
10
10
|
globalCss?: boolean;
|
|
11
11
|
js?: boolean;
|
|
12
|
-
linter
|
|
12
|
+
linter?: LinterType;
|
|
13
13
|
name?: string;
|
|
14
14
|
remotes?: string[];
|
|
15
15
|
enableTypedLinting?: boolean;
|
|
@@ -33,6 +33,8 @@ export interface Schema {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export interface NormalizedSchema extends Schema {
|
|
36
|
+
// `normalizeOptions` always resolves this, so it is no longer optional.
|
|
37
|
+
linter: LinterType;
|
|
36
38
|
appProjectRoot: string;
|
|
37
39
|
e2eProjectName: string;
|
|
38
40
|
projectName: string;
|
|
@@ -48,10 +48,9 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"linter": {
|
|
51
|
-
"description": "The tool to use for running lint checks.",
|
|
51
|
+
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
52
52
|
"type": "string",
|
|
53
|
-
"enum": ["eslint"]
|
|
54
|
-
"default": "eslint"
|
|
53
|
+
"enum": ["eslint", "oxlint", "none"]
|
|
55
54
|
},
|
|
56
55
|
"dynamic": {
|
|
57
56
|
"type": "boolean",
|
|
@@ -1,37 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addLinting = addLinting;
|
|
4
|
-
const eslint_1 = require("@nx/eslint");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
6
6
|
const lint_1 = require("../../../utils/lint");
|
|
7
|
-
const
|
|
7
|
+
const internal_2 = require("@nx/eslint/internal");
|
|
8
8
|
async function addLinting(host, options) {
|
|
9
|
+
if (options.linter === 'none') {
|
|
10
|
+
return () => { };
|
|
11
|
+
}
|
|
12
|
+
const tasks = [];
|
|
13
|
+
tasks.push(await (0, internal_1.addLintingToProject)(host, {
|
|
14
|
+
oxlintPlugins: ['react', 'react-perf', 'jsx-a11y'],
|
|
15
|
+
linter: options.linter,
|
|
16
|
+
project: options.name,
|
|
17
|
+
tsConfigPaths: [
|
|
18
|
+
(0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.lib.json'),
|
|
19
|
+
],
|
|
20
|
+
unitTestRunner: options.unitTestRunner,
|
|
21
|
+
skipPackageJson: options.skipPackageJson,
|
|
22
|
+
enableTypedLinting: (0, internal_2.isTypedLintingEnabled)(options),
|
|
23
|
+
addPlugin: options.addPlugin,
|
|
24
|
+
}));
|
|
25
|
+
// Predefined configs, `extends` and ignore entries are ESLint concepts with
|
|
26
|
+
// no equivalent in other linters.
|
|
9
27
|
if (options.linter === 'eslint') {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
project: options.name,
|
|
14
|
-
tsConfigPaths: [
|
|
15
|
-
(0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.lib.json'),
|
|
16
|
-
],
|
|
17
|
-
unitTestRunner: options.unitTestRunner,
|
|
18
|
-
skipFormat: true,
|
|
19
|
-
skipPackageJson: options.skipPackageJson,
|
|
20
|
-
enableTypedLinting: (0, internal_1.isTypedLintingEnabled)(options),
|
|
21
|
-
addPlugin: options.addPlugin,
|
|
22
|
-
});
|
|
23
|
-
tasks.push(lintTask);
|
|
24
|
-
if ((0, internal_1.isEslintConfigSupported)(host)) {
|
|
25
|
-
if ((0, internal_1.useFlatConfig)(host)) {
|
|
26
|
-
(0, internal_1.addPredefinedConfigToFlatLintConfig)(host, options.projectRoot, 'flat/react', { checkBaseConfig: true });
|
|
28
|
+
if ((0, internal_2.isEslintConfigSupported)(host)) {
|
|
29
|
+
if ((0, internal_2.useFlatConfig)(host)) {
|
|
30
|
+
(0, internal_2.addPredefinedConfigToFlatLintConfig)(host, options.projectRoot, 'flat/react', { checkBaseConfig: true });
|
|
27
31
|
// Add an empty rules object to users know how to add/override rules
|
|
28
|
-
(0,
|
|
32
|
+
(0, internal_2.addOverrideToLintConfig)(host, options.projectRoot, {
|
|
29
33
|
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
|
|
30
34
|
rules: {},
|
|
31
35
|
});
|
|
32
36
|
}
|
|
33
37
|
else {
|
|
34
|
-
const addExtendsTask = (0,
|
|
38
|
+
const addExtendsTask = (0, internal_2.addExtendsToLintConfig)(host, options.projectRoot, {
|
|
35
39
|
name: 'plugin:@nx/react',
|
|
36
40
|
needCompatFixup: true,
|
|
37
41
|
});
|
|
@@ -39,17 +43,12 @@ async function addLinting(host, options) {
|
|
|
39
43
|
}
|
|
40
44
|
// Add out-tsc ignore pattern when using TS solution setup
|
|
41
45
|
if (options.isUsingTsSolutionConfig) {
|
|
42
|
-
(0,
|
|
46
|
+
(0, internal_2.addIgnoresToLintConfig)(host, options.projectRoot, ['**/out-tsc']);
|
|
43
47
|
}
|
|
44
48
|
}
|
|
45
|
-
let installTask = () => { };
|
|
46
49
|
if (!options.skipPackageJson) {
|
|
47
|
-
|
|
48
|
-
tasks.push(installTask);
|
|
50
|
+
tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies, lint_1.extraEslintDependencies.devDependencies, undefined, true));
|
|
49
51
|
}
|
|
50
|
-
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
return () => { };
|
|
54
52
|
}
|
|
53
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
55
54
|
}
|
|
@@ -33,39 +33,46 @@ async function normalizeOptions(host, options) {
|
|
|
33
33
|
bundler = 'rollup';
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
compiler: options.compiler ?? 'babel',
|
|
39
|
-
bundler,
|
|
40
|
-
fileName,
|
|
41
|
-
routePath: `/${projectNames.projectSimpleName}`,
|
|
42
|
-
name: isUsingTsSolutionConfig && !options.name ? importPath : projectName,
|
|
43
|
-
projectRoot,
|
|
44
|
-
parsedTags,
|
|
45
|
-
importPath,
|
|
46
|
-
useProjectJson: options.useProjectJson ?? !isUsingTsSolutionConfig,
|
|
47
|
-
};
|
|
48
|
-
// Libraries with a bundler or is publishable must also be buildable.
|
|
49
|
-
normalized.buildable = Boolean(normalized.bundler !== 'none' || options.buildable || options.publishable);
|
|
50
|
-
normalized.inSourceTests === normalized.minimal || normalized.inSourceTests;
|
|
36
|
+
let appMain;
|
|
37
|
+
let appSourceRoot;
|
|
51
38
|
if (options.appProject) {
|
|
52
39
|
const appProjectConfig = (0, devkit_1.getProjects)(host).get(options.appProject);
|
|
53
40
|
const appProjectType = (0, internal_2.getProjectType)(host, appProjectConfig.root, appProjectConfig.projectType);
|
|
54
41
|
if (appProjectType !== 'application') {
|
|
55
42
|
throw new Error(`appProject expected type of "application" but got "${appProjectType}"`);
|
|
56
43
|
}
|
|
57
|
-
|
|
58
|
-
normalized.appMain =
|
|
44
|
+
appMain =
|
|
59
45
|
appProjectConfig.targets.build?.options?.main ??
|
|
60
46
|
findMainEntry(host, appProjectConfig.root);
|
|
61
|
-
|
|
47
|
+
appSourceRoot = (0, devkit_1.normalizePath)((0, internal_2.getProjectSourceRoot)(appProjectConfig, host));
|
|
62
48
|
// TODO(jack): We should use appEntryFile instead of appProject so users can directly set it rather than us inferring it.
|
|
63
|
-
if (!
|
|
49
|
+
if (!appMain) {
|
|
64
50
|
throw new Error(`Could not locate project main for ${options.appProject}`);
|
|
65
51
|
}
|
|
66
52
|
}
|
|
67
|
-
(0, assertion_1.assertValidStyle)(
|
|
68
|
-
normalized
|
|
53
|
+
(0, assertion_1.assertValidStyle)(options.style);
|
|
54
|
+
const normalized = {
|
|
55
|
+
...options,
|
|
56
|
+
compiler: options.compiler ?? 'babel',
|
|
57
|
+
bundler,
|
|
58
|
+
fileName,
|
|
59
|
+
routePath: `/${projectNames.projectSimpleName}`,
|
|
60
|
+
name: isUsingTsSolutionConfig && !options.name ? importPath : projectName,
|
|
61
|
+
projectRoot,
|
|
62
|
+
parsedTags,
|
|
63
|
+
importPath,
|
|
64
|
+
useProjectJson: options.useProjectJson ?? !isUsingTsSolutionConfig,
|
|
65
|
+
isUsingTsSolutionConfig,
|
|
66
|
+
js: options.js ?? false,
|
|
67
|
+
unitTestRunner: options.unitTestRunner ?? 'none',
|
|
68
|
+
// Libraries with a bundler or that are publishable must also be buildable.
|
|
69
|
+
buildable: Boolean(bundler !== 'none' || options.buildable || options.publishable),
|
|
70
|
+
appMain,
|
|
71
|
+
appSourceRoot,
|
|
72
|
+
// The React-specific ESLint shaping is guarded on `=== 'eslint'`, so an
|
|
73
|
+
// unresolved `undefined` would create a bare config with none of it.
|
|
74
|
+
linter: await (0, internal_2.normalizeLinterOption)(host, options.linter),
|
|
75
|
+
};
|
|
69
76
|
return normalized;
|
|
70
77
|
}
|
|
71
78
|
function findMainEntry(tree, projectRoot) {
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.updateAppRoutes = updateAppRoutes;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const ast_utils_1 = require("../../../utils/ast-utils");
|
|
6
|
-
const ast_utils_2 = require("../../../utils/ast-utils");
|
|
7
6
|
const maybe_js_1 = require("../../../utils/maybe-js");
|
|
8
7
|
const versions_1 = require("../../../utils/versions");
|
|
9
8
|
const internal_1 = require("@nx/js/internal");
|
|
@@ -32,7 +31,7 @@ function updateAppRoutes(host, options) {
|
|
|
32
31
|
const { content: componentContent, source: componentSource } = readComponent(host, appComponentPath);
|
|
33
32
|
const isComponentRouterPresent = componentContent.match(/react-router-dom/);
|
|
34
33
|
if (!isComponentRouterPresent) {
|
|
35
|
-
const changes = (0, devkit_1.applyChangesToString)(componentContent, (0,
|
|
34
|
+
const changes = (0, devkit_1.applyChangesToString)(componentContent, (0, ast_utils_1.addInitialRoutes)(appComponentPath, componentSource));
|
|
36
35
|
host.write(appComponentPath, changes);
|
|
37
36
|
}
|
|
38
37
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LinterType } from '@nx/js';
|
|
2
2
|
import type { SupportedStyles } from '../../../typings/style';
|
|
3
3
|
|
|
4
4
|
export interface Schema {
|
|
@@ -12,7 +12,7 @@ export interface Schema {
|
|
|
12
12
|
importPath?: string;
|
|
13
13
|
inSourceTests?: boolean;
|
|
14
14
|
js?: boolean;
|
|
15
|
-
linter
|
|
15
|
+
linter?: LinterType;
|
|
16
16
|
name?: string;
|
|
17
17
|
publishable?: boolean;
|
|
18
18
|
routing?: boolean;
|
|
@@ -34,6 +34,8 @@ export interface Schema {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export interface NormalizedSchema extends Schema {
|
|
37
|
+
// `normalizeOptions` always resolves this, so it is no longer optional.
|
|
38
|
+
linter: LinterType;
|
|
37
39
|
js: boolean;
|
|
38
40
|
name: string;
|
|
39
41
|
fileName: string;
|
|
@@ -65,11 +65,9 @@
|
|
|
65
65
|
"x-priority": "important"
|
|
66
66
|
},
|
|
67
67
|
"linter": {
|
|
68
|
-
"description": "The tool to use for running lint checks.",
|
|
68
|
+
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
69
69
|
"type": "string",
|
|
70
|
-
"enum": ["eslint", "none"],
|
|
71
|
-
"default": "none",
|
|
72
|
-
"x-prompt": "Which linter would you like to use?",
|
|
70
|
+
"enum": ["eslint", "oxlint", "none"],
|
|
73
71
|
"x-priority": "important"
|
|
74
72
|
},
|
|
75
73
|
"unitTestRunner": {
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setupSsrForRemote = setupSsrForRemote;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const devkit_2 = require("@nx/devkit");
|
|
6
5
|
const versions_1 = require("../../../utils/versions");
|
|
7
6
|
const create_application_files_1 = require("../../application/lib/create-application-files");
|
|
8
7
|
async function setupSsrForRemote(tree, options, appName) {
|
|
9
8
|
const tasks = [];
|
|
10
|
-
const project = (0,
|
|
9
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, appName);
|
|
11
10
|
const pathToModuleFederationSsrFiles = options.typescriptConfiguration
|
|
12
11
|
? `${options.bundler === 'rspack' ? 'rspack-' : 'webpack-'}module-federation-ssr-ts`
|
|
13
12
|
: `${options.bundler === 'rspack' ? 'rspack-' : 'webpack-'}module-federation-ssr`;
|
|
@@ -29,28 +28,28 @@ async function setupSsrForRemote(tree, options, appName) {
|
|
|
29
28
|
browserBuildOutputPath: project.targets.build?.options?.outputPath,
|
|
30
29
|
serverBuildOutputPath: project.targets.server?.options?.outputPath,
|
|
31
30
|
};
|
|
32
|
-
(0,
|
|
31
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, `../files/${pathToModuleFederationSsrFiles}`), project.root, templateVariables);
|
|
33
32
|
// For hosts to use when running remotes in static mode.
|
|
34
33
|
const originalOutputPath = (project.targets.build?.options?.outputPath ??
|
|
35
34
|
options.isUsingTsSolutionConfig)
|
|
36
35
|
? 'dist'
|
|
37
|
-
: (0,
|
|
36
|
+
: (0, devkit_1.joinPathFragments)((0, devkit_1.offsetFromRoot)(options.appProjectRoot), 'dist', options.appProjectRoot != '.'
|
|
38
37
|
? options.appProjectRoot
|
|
39
38
|
: options.projectName);
|
|
40
39
|
const serverOptions = project.targets.server?.options;
|
|
41
40
|
const serverOutputPath = serverOptions?.outputPath ??
|
|
42
|
-
(0,
|
|
41
|
+
(0, devkit_1.joinPathFragments)(originalOutputPath, 'server');
|
|
43
42
|
const serverOutputName = serverOptions?.outputFileName ?? 'main.js';
|
|
44
43
|
project.targets['serve-static'] = {
|
|
45
44
|
dependsOn: ['build', 'server'],
|
|
46
45
|
executor: 'nx:run-commands',
|
|
47
46
|
defaultConfiguration: 'development',
|
|
48
47
|
options: {
|
|
49
|
-
command: `PORT=${options.devServerPort ?? 4200} node ${(0,
|
|
48
|
+
command: `PORT=${options.devServerPort ?? 4200} node ${(0, devkit_1.joinPathFragments)(serverOutputPath, serverOutputName)}`,
|
|
50
49
|
},
|
|
51
50
|
};
|
|
52
|
-
(0,
|
|
53
|
-
const installTask = (0,
|
|
51
|
+
(0, devkit_1.updateProjectConfiguration)(tree, appName, project);
|
|
52
|
+
const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
54
53
|
'@module-federation/node': versions_1.moduleFederationNodeVersion,
|
|
55
54
|
cors: versions_1.corsVersion,
|
|
56
55
|
isbot: versions_1.isbotVersion,
|
|
@@ -58,5 +57,5 @@ async function setupSsrForRemote(tree, options, appName) {
|
|
|
58
57
|
'@types/express': versions_1.typesExpressVersion,
|
|
59
58
|
}, {}, undefined, true);
|
|
60
59
|
tasks.push(installTask);
|
|
61
|
-
return (0,
|
|
60
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
62
61
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LinterType } from '@nx/js';
|
|
2
2
|
import type { SupportedStyles } from '../../../typings/style';
|
|
3
3
|
import type { NormalizedSchema as ApplicationNormalizedSchema } from '../application/schema';
|
|
4
4
|
|
|
@@ -11,7 +11,7 @@ export interface Schema {
|
|
|
11
11
|
globalCss?: boolean;
|
|
12
12
|
host?: string;
|
|
13
13
|
js?: boolean;
|
|
14
|
-
linter
|
|
14
|
+
linter?: LinterType;
|
|
15
15
|
name?: string;
|
|
16
16
|
routing?: boolean;
|
|
17
17
|
enableTypedLinting?: boolean;
|
|
@@ -54,10 +54,9 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"linter": {
|
|
57
|
-
"description": "The tool to use for running lint checks.",
|
|
57
|
+
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
58
58
|
"type": "string",
|
|
59
|
-
"enum": ["eslint"]
|
|
60
|
-
"default": "eslint"
|
|
59
|
+
"enum": ["eslint", "oxlint", "none"]
|
|
61
60
|
},
|
|
62
61
|
"routing": {
|
|
63
62
|
"type": "boolean",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LinterType } from '@nx/js';
|
|
2
2
|
|
|
3
3
|
export interface StorybookConfigureSchema {
|
|
4
4
|
project: string;
|
|
@@ -6,7 +6,7 @@ export interface StorybookConfigureSchema {
|
|
|
6
6
|
generateStories?: boolean;
|
|
7
7
|
js?: boolean;
|
|
8
8
|
tsConfiguration?: boolean;
|
|
9
|
-
linter?:
|
|
9
|
+
linter?: LinterType;
|
|
10
10
|
ignorePaths?: string[];
|
|
11
11
|
configureStaticServe?: boolean;
|
|
12
12
|
addPlugin?: boolean;
|
|
@@ -257,12 +257,12 @@ function addInitialRoutes(sourcePath, source, addBrowserRouter) {
|
|
|
257
257
|
<br/>
|
|
258
258
|
<hr/>
|
|
259
259
|
<br/>
|
|
260
|
-
<
|
|
260
|
+
<nav>
|
|
261
261
|
<ul>
|
|
262
262
|
<li><Link to="/">Home</Link></li>
|
|
263
263
|
<li><Link to="/page-2">Page 2</Link></li>
|
|
264
264
|
</ul>
|
|
265
|
-
</
|
|
265
|
+
</nav>
|
|
266
266
|
<Routes>
|
|
267
267
|
<Route
|
|
268
268
|
path="/"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react",
|
|
3
|
-
"version": "23.2.0-beta.
|
|
3
|
+
"version": "23.2.0-beta.8",
|
|
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": {
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"react-dom": ">=18.0.0 <20.0.0",
|
|
97
97
|
"express": "^4.21.2",
|
|
98
98
|
"http-proxy-middleware": "^3.0.7",
|
|
99
|
-
"@nx/module-federation": "23.2.0-beta.
|
|
99
|
+
"@nx/module-federation": "23.2.0-beta.8"
|
|
100
100
|
},
|
|
101
101
|
"peerDependenciesMeta": {
|
|
102
102
|
"babel-plugin-react-compiler": {
|
|
@@ -118,27 +118,27 @@
|
|
|
118
118
|
"minimatch": "10.2.5",
|
|
119
119
|
"tslib": "^2.3.0",
|
|
120
120
|
"semver": "^7.6.3",
|
|
121
|
-
"@nx/devkit": "23.2.0-beta.
|
|
122
|
-
"@nx/js": "23.2.0-beta.
|
|
123
|
-
"@nx/eslint": "23.2.0-beta.
|
|
124
|
-
"@nx/web": "23.2.0-beta.
|
|
121
|
+
"@nx/devkit": "23.2.0-beta.8",
|
|
122
|
+
"@nx/js": "23.2.0-beta.8",
|
|
123
|
+
"@nx/eslint": "23.2.0-beta.8",
|
|
124
|
+
"@nx/web": "23.2.0-beta.8"
|
|
125
125
|
},
|
|
126
126
|
"devDependencies": {
|
|
127
127
|
"express": "^4.21.2",
|
|
128
128
|
"http-proxy-middleware": "^3.0.7",
|
|
129
|
-
"@nx/cypress": "23.2.0-beta.
|
|
130
|
-
"@nx/module-federation": "23.2.0-beta.
|
|
131
|
-
"@nx/playwright": "23.2.0-beta.
|
|
132
|
-
"@nx/rollup": "23.2.0-beta.
|
|
133
|
-
"@nx/rsbuild": "23.2.0-beta.
|
|
134
|
-
"@nx/vite": "23.2.0-beta.
|
|
135
|
-
"@nx/vitest": "23.2.0-beta.
|
|
136
|
-
"@nx/webpack": "23.2.0-beta.
|
|
137
|
-
"@nx/storybook": "23.2.0-beta.
|
|
138
|
-
"nx": "23.2.0-beta.
|
|
129
|
+
"@nx/cypress": "23.2.0-beta.8",
|
|
130
|
+
"@nx/module-federation": "23.2.0-beta.8",
|
|
131
|
+
"@nx/playwright": "23.2.0-beta.8",
|
|
132
|
+
"@nx/rollup": "23.2.0-beta.8",
|
|
133
|
+
"@nx/rsbuild": "23.2.0-beta.8",
|
|
134
|
+
"@nx/vite": "23.2.0-beta.8",
|
|
135
|
+
"@nx/vitest": "23.2.0-beta.8",
|
|
136
|
+
"@nx/webpack": "23.2.0-beta.8",
|
|
137
|
+
"@nx/storybook": "23.2.0-beta.8",
|
|
138
|
+
"nx": "23.2.0-beta.8"
|
|
139
139
|
},
|
|
140
140
|
"optionalDependencies": {
|
|
141
|
-
"@nx/vite": "23.2.0-beta.
|
|
141
|
+
"@nx/vite": "23.2.0-beta.8"
|
|
142
142
|
},
|
|
143
143
|
"publishConfig": {
|
|
144
144
|
"access": "public"
|