@nx/react 16.3.0-beta.6 → 16.3.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/package.json +7 -7
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +9 -7
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js.map +1 -1
- package/src/generators/application/schema.json +2 -3
- package/src/generators/redux/files/__directory__/__fileName__.slice.spec.ts__tmpl__ +10 -7
- package/src/generators/redux/files/__directory__/__fileName__.slice.ts__tmpl__ +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react",
|
|
3
|
-
"version": "16.3.0-beta.
|
|
3
|
+
"version": "16.3.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, 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": {
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"migrations": "./migrations.json"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@nrwl/react": "16.3.0-beta.
|
|
35
|
-
"@nx/devkit": "16.3.0-beta.
|
|
36
|
-
"@nx/js": "16.3.0-beta.
|
|
37
|
-
"@nx/linter": "16.3.0-beta.
|
|
38
|
-
"@nx/web": "16.3.0-beta.
|
|
34
|
+
"@nrwl/react": "16.3.0-beta.8",
|
|
35
|
+
"@nx/devkit": "16.3.0-beta.8",
|
|
36
|
+
"@nx/js": "16.3.0-beta.8",
|
|
37
|
+
"@nx/linter": "16.3.0-beta.8",
|
|
38
|
+
"@nx/web": "16.3.0-beta.8",
|
|
39
39
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
40
40
|
"@svgr/webpack": "^6.1.2",
|
|
41
41
|
"chalk": "^4.1.0",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"types": "./index.d.ts",
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "1b21c824ec666988e43c996307f381fbf53e9154"
|
|
50
50
|
}
|
|
@@ -7,6 +7,7 @@ const path_1 = require("path");
|
|
|
7
7
|
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
8
8
|
const chalk = require("chalk");
|
|
9
9
|
const wait_for_port_open_1 = require("@nx/web/src/utils/wait-for-port-open");
|
|
10
|
+
const find_matching_projects_1 = require("nx/src/utils/find-matching-projects");
|
|
10
11
|
const child_process_1 = require("child_process");
|
|
11
12
|
function moduleFederationDevServer(options, context) {
|
|
12
13
|
var _a, _b;
|
|
@@ -21,7 +22,7 @@ function moduleFederationDevServer(options, context) {
|
|
|
21
22
|
catch (_c) {
|
|
22
23
|
throw new Error(`Could not load ${moduleFederationConfigPath}. Was this project generated with "@nx/react:host"?\nSee: https://nx.dev/recipes/module-federation/faster-builds`);
|
|
23
24
|
}
|
|
24
|
-
const remotesToSkip = new Set((_a = options.skipRemotes) !== null && _a !== void 0 ? _a : []);
|
|
25
|
+
const remotesToSkip = new Set((0, find_matching_projects_1.findMatchingProjects)((_a = options.skipRemotes) !== null && _a !== void 0 ? _a : [], context.projectGraph.nodes));
|
|
25
26
|
const knownRemotes = ((_b = moduleFederationConfig.remotes) !== null && _b !== void 0 ? _b : []).filter((r) => {
|
|
26
27
|
const validRemote = Array.isArray(r) ? r[0] : r;
|
|
27
28
|
return !remotesToSkip.has(validRemote);
|
|
@@ -30,8 +31,8 @@ function moduleFederationDevServer(options, context) {
|
|
|
30
31
|
const devServeApps = !options.devRemotes
|
|
31
32
|
? []
|
|
32
33
|
: Array.isArray(options.devRemotes)
|
|
33
|
-
? options.devRemotes
|
|
34
|
-
: [options.devRemotes];
|
|
34
|
+
? (0, find_matching_projects_1.findMatchingProjects)(options.devRemotes, context.projectGraph.nodes)
|
|
35
|
+
: (0, find_matching_projects_1.findMatchingProjects)([options.devRemotes], context.projectGraph.nodes);
|
|
35
36
|
devkit_1.logger.info(`NX Starting module federation dev-server for ${chalk.bold(context.projectName)} with ${knownRemotes.length} remotes`);
|
|
36
37
|
const nxBin = require.resolve('nx');
|
|
37
38
|
const devRemoteIters = [];
|
|
@@ -49,11 +50,12 @@ function moduleFederationDevServer(options, context) {
|
|
|
49
50
|
}
|
|
50
51
|
else {
|
|
51
52
|
let outWithErr = [];
|
|
52
|
-
const staticProcess = (0, child_process_1.
|
|
53
|
+
const staticProcess = (0, child_process_1.fork)(nxBin, [
|
|
54
|
+
'run',
|
|
55
|
+
`${appName}:serve-static${context.configurationName ? `:${context.configurationName}` : ''}`,
|
|
56
|
+
], {
|
|
53
57
|
cwd: context.root,
|
|
54
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
55
|
-
shell: true,
|
|
56
|
-
windowsHide: true,
|
|
58
|
+
stdio: ['ignore', 'pipe', 'pipe', 'ipc'],
|
|
57
59
|
});
|
|
58
60
|
staticProcess.stdout.on('data', (data) => {
|
|
59
61
|
if (isCollectingStaticRemoteOutput) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-federation-dev-server.impl.js","sourceRoot":"","sources":["../../../../../../packages/react/src/executors/module-federation-dev-server/module-federation-dev-server.impl.ts"],"names":[],"mappings":";;;AAAA,uCAAkE;AAClE,0FAAqF;AAErF,+BAA4B;AAC5B,wEAG6C;AAC7C,+BAA+B;AAC/B,6EAAuE;AACvE,
|
|
1
|
+
{"version":3,"file":"module-federation-dev-server.impl.js","sourceRoot":"","sources":["../../../../../../packages/react/src/executors/module-federation-dev-server/module-federation-dev-server.impl.ts"],"names":[],"mappings":";;;AAAA,uCAAkE;AAClE,0FAAqF;AAErF,+BAA4B;AAC5B,wEAG6C;AAC7C,+BAA+B;AAC/B,6EAAuE;AACvE,gF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sBAAA,IAAA,sCAAqB,EACjC,QAAQ,EACR,GAAG,cAAc,EACjB,IAAA,oCAAmB,EACjB,CAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;YACvB,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC5B,IAAI,EAAE,CAAC;gBACP,OAAO;aACR;YACD,IAAI;gBACF,MAAM,OAAO,CAAC,GAAG,CACf,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gBACvB,0GAA0G;gBAC1G,+CAA+C;gBAC/C,IAAA,oCAAe,EAAC,IAAI,EAAE;oBACpB,OAAO,EAAE,GAAG;oBACZ,UAAU,EAAE,IAAI;iBACjB,CAAC,CACH,CACF,CAAC;gBACF,8BAA8B,GAAG,KAAK,CAAC;gBACvC,eAAM,CAAC,IAAI,CACT,4DAA4D,OAAO,CAAC,IAAI,EAAE,CAC3E,CAAC;gBACF,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,oBAAoB,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;aACtE;YAAC,WAAM;gBACN,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAC;aACH;oBAAS;gBACR,IAAI,EAAE,CAAC;aACR;QACH,CAAC,CAAA,CACF,CACF,CAAA,CAAA,CAAA,EAAC;;CACH;AAvID,4CAuIC"}
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
"index": 0
|
|
29
29
|
},
|
|
30
30
|
"x-prompt": "What name would you like to use for the application?",
|
|
31
|
-
"pattern": "^[a-zA-Z].*$"
|
|
32
|
-
"x-priority": "important"
|
|
31
|
+
"pattern": "^[a-zA-Z].*$"
|
|
33
32
|
},
|
|
34
33
|
"directory": {
|
|
35
34
|
"description": "The directory of the new application.",
|
|
@@ -191,6 +190,6 @@
|
|
|
191
190
|
"default": false
|
|
192
191
|
}
|
|
193
192
|
},
|
|
194
|
-
"required": [],
|
|
193
|
+
"required": ["name"],
|
|
195
194
|
"examplesFile": "../../../docs/application-examples.md"
|
|
196
195
|
}
|
|
@@ -10,43 +10,46 @@ describe('<%= propertyName %> reducer', () => {
|
|
|
10
10
|
expect(<%= propertyName %>Reducer(undefined, { type: '' })).toEqual(expected);
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
it('should handle fetch<%= className %>
|
|
13
|
+
it('should handle fetch<%= className %>', () => {
|
|
14
14
|
let state = <%= propertyName %>Reducer(
|
|
15
15
|
undefined,
|
|
16
|
-
fetch<%= className %>.pending(
|
|
16
|
+
fetch<%= className %>.pending('')
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
expect(state).toEqual(
|
|
20
20
|
expect.objectContaining({
|
|
21
21
|
loadingStatus: 'loading',
|
|
22
22
|
error: null,
|
|
23
|
-
entities: {}
|
|
23
|
+
entities: {},
|
|
24
|
+
ids: []
|
|
24
25
|
})
|
|
25
26
|
);
|
|
26
27
|
|
|
27
28
|
state = <%= propertyName %>Reducer(
|
|
28
29
|
state,
|
|
29
|
-
fetch<%= className %>.fulfilled([{ id: 1 }],
|
|
30
|
+
fetch<%= className %>.fulfilled([{ id: 1 }], '')
|
|
30
31
|
);
|
|
31
32
|
|
|
32
33
|
expect(state).toEqual(
|
|
33
34
|
expect.objectContaining({
|
|
34
35
|
loadingStatus: 'loaded',
|
|
35
36
|
error: null,
|
|
36
|
-
entities: { 1: { id: 1 } }
|
|
37
|
+
entities: { 1: { id: 1 } },
|
|
38
|
+
ids: [1]
|
|
37
39
|
})
|
|
38
40
|
);
|
|
39
41
|
|
|
40
42
|
state = <%= propertyName %>Reducer(
|
|
41
43
|
state,
|
|
42
|
-
fetch<%= className %>.rejected(new Error('Uh oh'),
|
|
44
|
+
fetch<%= className %>.rejected(new Error('Uh oh'), '')
|
|
43
45
|
);
|
|
44
46
|
|
|
45
47
|
expect(state).toEqual(
|
|
46
48
|
expect.objectContaining({
|
|
47
49
|
loadingStatus: 'error',
|
|
48
50
|
error: 'Uh oh',
|
|
49
|
-
entities: { 1: { id: 1 } }
|
|
51
|
+
entities: { 1: { id: 1 } },
|
|
52
|
+
ids: [1]
|
|
50
53
|
})
|
|
51
54
|
);
|
|
52
55
|
});
|
|
@@ -18,7 +18,7 @@ export interface <%= className %>Entity {
|
|
|
18
18
|
|
|
19
19
|
export interface <%= className %>State extends EntityState<<%= className %>Entity> {
|
|
20
20
|
loadingStatus: 'not loaded' | 'loading' | 'loaded' | 'error';
|
|
21
|
-
error
|
|
21
|
+
error?: string | null;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export const <%= propertyName %>Adapter = createEntityAdapter<<%= className %>Entity>();
|
|
@@ -40,7 +40,7 @@ export const <%= propertyName %>Adapter = createEntityAdapter<<%= className %>En
|
|
|
40
40
|
* }, [dispatch]);
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
export const fetch<%= className %> = createAsyncThunk(
|
|
43
|
+
export const fetch<%= className %> = createAsyncThunk<<%= className %>Entity[]>(
|
|
44
44
|
'<%= propertyName %>/fetchStatus',
|
|
45
45
|
async (_, thunkAPI) => {
|
|
46
46
|
/**
|
|
@@ -122,7 +122,7 @@ export const <%= propertyName %>Actions = <%= propertyName %>Slice.actions;
|
|
|
122
122
|
*/
|
|
123
123
|
const { selectAll, selectEntities } = <%= propertyName %>Adapter.getSelectors();
|
|
124
124
|
|
|
125
|
-
export const get<%= className %>State = (rootState:
|
|
125
|
+
export const get<%= className %>State = (rootState: {[<%= constantName %>_FEATURE_KEY]: <%= className %>State }): <%= className %>State => rootState[<%= constantName %>_FEATURE_KEY];
|
|
126
126
|
|
|
127
127
|
export const selectAll<%= className %> = createSelector(get<%= className %>State, selectAll);
|
|
128
128
|
|