@nx/react 17.1.0-beta.0 → 17.1.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/package.json +6 -6
- package/plugins/component-testing/index.js +1 -1
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +1 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +32 -0
- package/src/executors/module-federation-dev-server/schema.json +4 -0
- package/src/generators/component/lib/normalize-options.js +2 -2
- package/src/generators/federate-module/schema.json +7 -7
- package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js +3 -0
- package/src/utils/get-in-source-vitest-tests-template.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react",
|
|
3
|
-
"version": "17.1.0-beta.
|
|
3
|
+
"version": "17.1.0-beta.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, 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": "3.0.5",
|
|
39
39
|
"tslib": "^2.3.0",
|
|
40
|
-
"@nx/devkit": "17.1.0-beta.
|
|
41
|
-
"@nx/js": "17.1.0-beta.
|
|
42
|
-
"@nx/eslint": "17.1.0-beta.
|
|
43
|
-
"@nx/web": "17.1.0-beta.
|
|
44
|
-
"@nrwl/react": "17.1.0-beta.
|
|
40
|
+
"@nx/devkit": "17.1.0-beta.3",
|
|
41
|
+
"@nx/js": "17.1.0-beta.3",
|
|
42
|
+
"@nx/eslint": "17.1.0-beta.3",
|
|
43
|
+
"@nx/web": "17.1.0-beta.3",
|
|
44
|
+
"@nrwl/react": "17.1.0-beta.3"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
@@ -84,7 +84,7 @@ function nxComponentTestingPreset(pathToConfig, options) {
|
|
|
84
84
|
const { buildBaseWebpackConfig } = require('./webpack-fallback');
|
|
85
85
|
webpackConfig = buildBaseWebpackConfig({
|
|
86
86
|
tsConfigPath: findTsConfig(normalizedProjectRootPath),
|
|
87
|
-
compiler: 'babel',
|
|
87
|
+
compiler: options?.compiler || 'babel',
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
return {
|
|
@@ -5,6 +5,7 @@ type ModuleFederationDevServerOptions = WebDevServerOptions & {
|
|
|
5
5
|
skipRemotes?: string[];
|
|
6
6
|
static?: boolean;
|
|
7
7
|
isInitialHost?: boolean;
|
|
8
|
+
parallel?: number;
|
|
8
9
|
};
|
|
9
10
|
export default function moduleFederationDevServer(options: ModuleFederationDevServerOptions, context: ExecutorContext): AsyncIterableIterator<{
|
|
10
11
|
success: boolean;
|
|
@@ -37,6 +37,38 @@ async function* moduleFederationDevServer(options, context) {
|
|
|
37
37
|
projectGraph: context.projectGraph,
|
|
38
38
|
root: context.root,
|
|
39
39
|
});
|
|
40
|
+
devkit_1.logger.info(`NX Building ${remotes.staticRemotes.length} static remotes...`);
|
|
41
|
+
await new Promise((res) => {
|
|
42
|
+
const staticProcess = (0, child_process_1.fork)(nxBin, [
|
|
43
|
+
'run-many',
|
|
44
|
+
`--target=build`,
|
|
45
|
+
`--projects=${remotes.staticRemotes.join(',')}`,
|
|
46
|
+
...(context.configurationName
|
|
47
|
+
? [`--configuration=${context.configurationName}`]
|
|
48
|
+
: []),
|
|
49
|
+
...(options.parallel ? [`--parallel=${options.parallel}`] : []),
|
|
50
|
+
], {
|
|
51
|
+
cwd: context.root,
|
|
52
|
+
stdio: ['ignore', 'pipe', 'pipe', 'ipc'],
|
|
53
|
+
});
|
|
54
|
+
staticProcess.stdout.on('data', (data) => {
|
|
55
|
+
const ANSII_CODE_REGEX = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
|
|
56
|
+
const stdoutString = data.toString().replace(ANSII_CODE_REGEX, '');
|
|
57
|
+
if (stdoutString.includes('Successfully ran target build')) {
|
|
58
|
+
staticProcess.stdout.removeAllListeners('data');
|
|
59
|
+
devkit_1.logger.info(`NX Built ${remotes.staticRemotes.length} static remotes`);
|
|
60
|
+
res();
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
staticProcess.stderr.on('data', (data) => devkit_1.logger.info(data.toString()));
|
|
64
|
+
staticProcess.on('exit', (code) => {
|
|
65
|
+
if (code !== 0) {
|
|
66
|
+
throw new Error(`Remote failed to start. See above for errors.`);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
process.on('SIGTERM', () => staticProcess.kill('SIGTERM'));
|
|
70
|
+
process.on('exit', () => staticProcess.kill('SIGTERM'));
|
|
71
|
+
});
|
|
40
72
|
let isCollectingStaticRemoteOutput = true;
|
|
41
73
|
const devRemoteIters = [];
|
|
42
74
|
for (const app of remotes.devRemotes) {
|
|
@@ -101,6 +101,10 @@
|
|
|
101
101
|
"description": "Whether the host that is running this executor is the first in the project tree to do so.",
|
|
102
102
|
"default": true,
|
|
103
103
|
"x-priority": "internal"
|
|
104
|
+
},
|
|
105
|
+
"parallel": {
|
|
106
|
+
"type": "number",
|
|
107
|
+
"description": "Max number of parallel processes for building static remotes"
|
|
104
108
|
}
|
|
105
109
|
}
|
|
106
110
|
}
|
|
@@ -22,7 +22,7 @@ async function normalizeOptions(tree, options) {
|
|
|
22
22
|
});
|
|
23
23
|
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
24
24
|
const { className } = (0, devkit_1.names)(name);
|
|
25
|
-
const { sourceRoot: projectSourceRoot, projectType } = project;
|
|
25
|
+
const { sourceRoot: projectSourceRoot, root: projectRoot, projectType, } = project;
|
|
26
26
|
const styledModule = /^(css|scss|less|none)$/.test(options.style)
|
|
27
27
|
? null
|
|
28
28
|
: options.style;
|
|
@@ -42,7 +42,7 @@ async function normalizeOptions(tree, options) {
|
|
|
42
42
|
className,
|
|
43
43
|
fileName,
|
|
44
44
|
filePath,
|
|
45
|
-
projectSourceRoot,
|
|
45
|
+
projectSourceRoot: projectSourceRoot ?? projectRoot,
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
exports.normalizeOptions = normalizeOptions;
|
|
@@ -12,22 +12,22 @@
|
|
|
12
12
|
],
|
|
13
13
|
"type": "object",
|
|
14
14
|
"properties": {
|
|
15
|
-
"
|
|
16
|
-
"description": "The name of the module.",
|
|
15
|
+
"path": {
|
|
17
16
|
"type": "string",
|
|
18
17
|
"$default": {
|
|
19
18
|
"$source": "argv",
|
|
20
19
|
"index": 0
|
|
21
20
|
},
|
|
21
|
+
"description": "The path to locate the federated module. This path should be relative to the workspace root and the file should exist.",
|
|
22
|
+
"x-prompt": "What is the path to the module to be federated?"
|
|
23
|
+
},
|
|
24
|
+
"name": {
|
|
25
|
+
"description": "The name of the module.",
|
|
26
|
+
"type": "string",
|
|
22
27
|
"x-prompt": "What name would you like to use for the module?",
|
|
23
28
|
"pattern": "^[a-zA-Z][^:]*$",
|
|
24
29
|
"x-priority": "important"
|
|
25
30
|
},
|
|
26
|
-
"path": {
|
|
27
|
-
"type": "string",
|
|
28
|
-
"description": "The path to locate the federated module. This path should be relative to the workspace root and the file should exist.",
|
|
29
|
-
"x-prompt": "What is the path to the module to be federated?"
|
|
30
|
-
},
|
|
31
31
|
"remote": {
|
|
32
32
|
"type": "string",
|
|
33
33
|
"description": "The name of the remote.",
|
|
@@ -11,6 +11,9 @@ const knownLocations = [
|
|
|
11
11
|
'pages/styles.css',
|
|
12
12
|
'pages/styles.scss',
|
|
13
13
|
'pages/styles.less',
|
|
14
|
+
'app/global.css',
|
|
15
|
+
'app/global.scss',
|
|
16
|
+
'app/global.less',
|
|
14
17
|
];
|
|
15
18
|
function addTailwindStyleImports(tree, project, _options) {
|
|
16
19
|
const candidates = knownLocations.map((x) => (0, devkit_1.joinPathFragments)(project.root, x));
|
|
@@ -8,7 +8,7 @@ if (import.meta.vitest) {
|
|
|
8
8
|
// For more information please visit the Vitest docs site here: https://vitest.dev/guide/in-source.html
|
|
9
9
|
|
|
10
10
|
const { it, expect, beforeEach } = import.meta.vitest;
|
|
11
|
-
let render:
|
|
11
|
+
let render: typeof import('@testing-library/react').render;
|
|
12
12
|
|
|
13
13
|
beforeEach(async () => {
|
|
14
14
|
render = (await import('@testing-library/react')).render;
|