@nx/react 20.6.1 → 20.6.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/package.json +6 -6
- package/src/generators/application/application.js +20 -19
- package/src/generators/application/lib/normalize-options.js +4 -1
- package/src/generators/library/library.js +1 -1
- package/src/utils/assertion.d.ts +2 -0
- package/src/utils/assertion.js +6 -0
- package/src/utils/ct-utils.d.ts +1 -1
- package/src/utils/format-file.d.ts +0 -1
- package/src/utils/format-file.js +0 -11
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/react",
|
3
|
-
"version": "20.6.
|
3
|
+
"version": "20.6.3",
|
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": {
|
@@ -38,11 +38,11 @@
|
|
38
38
|
"minimatch": "9.0.3",
|
39
39
|
"picocolors": "^1.1.0",
|
40
40
|
"tslib": "^2.3.0",
|
41
|
-
"@nx/devkit": "20.6.
|
42
|
-
"@nx/js": "20.6.
|
43
|
-
"@nx/eslint": "20.6.
|
44
|
-
"@nx/web": "20.6.
|
45
|
-
"@nx/module-federation": "20.6.
|
41
|
+
"@nx/devkit": "20.6.3",
|
42
|
+
"@nx/js": "20.6.3",
|
43
|
+
"@nx/eslint": "20.6.3",
|
44
|
+
"@nx/web": "20.6.3",
|
45
|
+
"@nx/module-federation": "20.6.3",
|
46
46
|
"express": "^4.21.2",
|
47
47
|
"http-proxy-middleware": "^3.0.3",
|
48
48
|
"semver": "^7.6.3"
|
@@ -46,25 +46,26 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
46
46
|
});
|
47
47
|
tasks.push(jsInitTask);
|
48
48
|
const options = await (0, normalize_options_1.normalizeOptions)(tree, schema);
|
49
|
-
options.useReactRouter =
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
49
|
+
options.useReactRouter =
|
50
|
+
options.routing && options.bundler === 'vite'
|
51
|
+
? options.useReactRouter ??
|
52
|
+
(await (0, prompt_1.promptWhenInteractive)({
|
53
|
+
name: 'response',
|
54
|
+
message: 'Would you like to use react-router for server-side rendering?',
|
55
|
+
type: 'autocomplete',
|
56
|
+
choices: [
|
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'))
|
68
|
+
: false;
|
68
69
|
(0, show_possible_warnings_1.showPossibleWarnings)(tree, options);
|
69
70
|
const initTask = await (0, init_1.default)(tree, {
|
70
71
|
...options,
|
@@ -31,7 +31,10 @@ async function normalizeOptions(host, options) {
|
|
31
31
|
? null
|
32
32
|
: options.style;
|
33
33
|
(0, assertion_1.assertValidStyle)(options.style);
|
34
|
-
|
34
|
+
(0, assertion_1.assertValidReactRouter)(options.useReactRouter, options.bundler);
|
35
|
+
if (options.useReactRouter && !options.bundler) {
|
36
|
+
options.bundler = 'vite';
|
37
|
+
}
|
35
38
|
options.useReactRouter = options.routing ? options.useReactRouter : false;
|
36
39
|
const normalized = {
|
37
40
|
...options,
|
@@ -190,7 +190,7 @@ async function libraryGeneratorInternal(host, schema) {
|
|
190
190
|
});
|
191
191
|
tasks.push(componentTask);
|
192
192
|
}
|
193
|
-
if (options.publishable
|
193
|
+
if (options.publishable) {
|
194
194
|
const projectConfiguration = (0, devkit_1.readProjectConfiguration)(host, options.name);
|
195
195
|
if (options.isUsingTsSolutionConfig) {
|
196
196
|
await (0, add_release_config_1.addReleaseConfigForTsSolution)(host, options.name, projectConfiguration);
|
package/src/utils/assertion.d.ts
CHANGED
package/src/utils/assertion.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.assertValidStyle = assertValidStyle;
|
4
|
+
exports.assertValidReactRouter = assertValidReactRouter;
|
4
5
|
const VALID_STYLES = [
|
5
6
|
'css',
|
6
7
|
'scss',
|
@@ -16,3 +17,8 @@ function assertValidStyle(style) {
|
|
16
17
|
throw new Error(`Unsupported style option found: ${style}. Valid values are: "${VALID_STYLES.join('", "')}"`);
|
17
18
|
}
|
18
19
|
}
|
20
|
+
function assertValidReactRouter(reactRouter, bundler) {
|
21
|
+
if (reactRouter && bundler !== 'vite') {
|
22
|
+
throw new Error(`Unsupported bundler found: ${bundler}. React Router is only supported with 'vite'.`);
|
23
|
+
}
|
24
|
+
}
|
package/src/utils/ct-utils.d.ts
CHANGED
@@ -10,5 +10,5 @@ export declare function getBundlerFromTarget(found: FoundTarget, tree: Tree): Pr
|
|
10
10
|
export declare function getActualBundler(tree: Tree, options: {
|
11
11
|
buildTarget?: string;
|
12
12
|
bundler?: 'vite' | 'webpack';
|
13
|
-
}, found: FoundTarget): Promise<"
|
13
|
+
}, found: FoundTarget): Promise<"webpack" | "vite">;
|
14
14
|
export declare function isComponent(tree: Tree, filePath: string): boolean;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare function formatFile(content: any, ...values: any[]): string;
|
package/src/utils/format-file.js
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.formatFile = formatFile;
|
4
|
-
const prettier_1 = require("prettier");
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
6
|
-
function formatFile(content, ...values) {
|
7
|
-
return (0, prettier_1.format)((0, devkit_1.stripIndents)(content, values), {
|
8
|
-
singleQuote: true,
|
9
|
-
parser: 'typescript',
|
10
|
-
});
|
11
|
-
}
|