@nrwl/react 15.7.0-beta.0 → 15.7.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/CHANGELOG.md +1 -1
- package/migrations.json +6 -0
- package/package.json +5 -5
- package/plugins/storybook/index.js +3 -3
- package/plugins/storybook/index.js.map +1 -1
- package/plugins/with-react.d.ts +11 -1
- package/plugins/with-react.js +60 -41
- package/plugins/with-react.js.map +1 -1
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +0 -1
- package/src/generators/application/files/{base-vite → nx-welcome}/src/app/nx-welcome.tsx +0 -0
- package/src/generators/application/files/style-css-module/src/app/__fileName__.tsx__tmpl__ +9 -0
- package/src/generators/application/files/style-global-css/src/app/__fileName__.tsx__tmpl__ +9 -0
- package/src/generators/application/files/style-none/src/app/__fileName__.tsx__tmpl__ +9 -0
- package/src/generators/application/files/style-styled-jsx/src/app/__fileName__.tsx__tmpl__ +2 -1
- package/src/generators/application/files/style-styled-module/src/app/__fileName__.tsx__tmpl__ +9 -0
- package/src/generators/application/lib/create-application-files.js +3 -0
- package/src/generators/application/lib/create-application-files.js.map +1 -1
- package/src/generators/application/lib/normalize-options.js +2 -1
- package/src/generators/application/lib/normalize-options.js.map +1 -1
- package/src/generators/host/files/common/src/app/__fileName__.tsx__tmpl__ +4 -0
- package/src/generators/host/files/module-federation-ssr/webpack.server.config.js__tmpl__ +3 -3
- package/src/generators/host/schema.d.ts +1 -0
- package/src/generators/host/schema.json +5 -0
- package/src/migrations/update-15-6-3/webpack-config-setup.d.ts +2 -0
- package/src/migrations/update-15-6-3/webpack-config-setup.js +108 -0
- package/src/migrations/update-15-6-3/webpack-config-setup.js.map +1 -0
- package/src/module-federation/with-module-federation.d.ts +6 -1
- package/src/module-federation/with-module-federation.js +6 -2
- package/src/module-federation/with-module-federation.js.map +1 -1
- package/src/rules/update-module-federation-project.d.ts +2 -2
- package/src/rules/update-module-federation-project.js +2 -0
- package/src/rules/update-module-federation-project.js.map +1 -1
- package/src/generators/application/files/base-webpack/src/app/nx-welcome.tsx +0 -820
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @nrwl/react
|
package/migrations.json
CHANGED
|
@@ -77,6 +77,12 @@
|
|
|
77
77
|
"version": "15.3.0-beta.0",
|
|
78
78
|
"description": "Install new dependencies for React projects using Webpack or Rollup.",
|
|
79
79
|
"factory": "./src/migrations/update-15-3-0/install-webpack-rollup-dependencies"
|
|
80
|
+
},
|
|
81
|
+
"react-webpack-config-setup": {
|
|
82
|
+
"cli": "nx",
|
|
83
|
+
"version": "15.6.3-beta.0",
|
|
84
|
+
"description": "Creates or updates webpack.config.js file with the new options for webpack.",
|
|
85
|
+
"factory": "./src/migrations/update-15-6-3/webpack-config-setup"
|
|
80
86
|
}
|
|
81
87
|
},
|
|
82
88
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nrwl/react",
|
|
3
|
-
"version": "15.7.0-beta.
|
|
3
|
+
"version": "15.7.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": {
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"migrations": "./migrations.json"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@nrwl/devkit": "15.7.0-beta.
|
|
35
|
-
"@nrwl/linter": "15.7.0-beta.
|
|
36
|
-
"@nrwl/workspace": "15.7.0-beta.
|
|
34
|
+
"@nrwl/devkit": "15.7.0-beta.3",
|
|
35
|
+
"@nrwl/linter": "15.7.0-beta.3",
|
|
36
|
+
"@nrwl/workspace": "15.7.0-beta.3",
|
|
37
37
|
"@phenomnomnominal/tsquery": "4.1.1",
|
|
38
38
|
"chalk": "^4.1.0",
|
|
39
39
|
"minimatch": "3.0.5"
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"types": "./index.d.ts",
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "b2bd4f27e04124c70a19c53191a4503bacf0b229"
|
|
46
46
|
}
|
|
@@ -46,7 +46,7 @@ const core = (prev, options) => (Object.assign(Object.assign({}, prev), { disabl
|
|
|
46
46
|
exports.core = core;
|
|
47
47
|
const webpack = (storybookWebpackConfig = {}, options) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
48
48
|
var _a, _b, _c, _d, _e;
|
|
49
|
-
devkit_1.logger.info('=> Loading
|
|
49
|
+
devkit_1.logger.info('=> Loading Nx React Storybook Addon from "@nrwl/react/plugins/storybook"');
|
|
50
50
|
// In case anyone is missing dep and did not run migrations.
|
|
51
51
|
// See: https://github.com/nrwl/nx/issues/14455
|
|
52
52
|
try {
|
|
@@ -62,10 +62,10 @@ const webpack = (storybookWebpackConfig = {}, options) => tslib_1.__awaiter(void
|
|
|
62
62
|
projectRoot: '', sourceRoot: '', fileReplacements: [], sourceMap: true, styles: (_a = options.styles) !== null && _a !== void 0 ? _a : [], optimization: {}, tsConfig: tsconfigPath, extractCss: storybookWebpackConfig.mode === 'production', target: 'web' });
|
|
63
63
|
// ESM build for modern browsers.
|
|
64
64
|
let baseWebpackConfig = {};
|
|
65
|
-
const configure = (0, config_1.
|
|
65
|
+
const configure = (0, config_1.composePluginsSync)(withNx({ skipTypeChecking: true }), withWeb(), (0, with_react_1.withReact)());
|
|
66
66
|
const finalConfig = configure(baseWebpackConfig, {
|
|
67
67
|
options: builderOptions,
|
|
68
|
-
context: {}, // The context is not used here.
|
|
68
|
+
context: { root: devkit_1.workspaceRoot }, // The context is not used here.
|
|
69
69
|
});
|
|
70
70
|
return Object.assign(Object.assign({}, storybookWebpackConfig), { module: Object.assign(Object.assign({}, storybookWebpackConfig.module), { rules: [
|
|
71
71
|
...storybookWebpackConfig.module.rules,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/react/plugins/storybook/index.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/react/plugins/storybook/index.ts"],"names":[],"mappings":";;;;AAAA,yCAAsE;AACtE,2DAAoE;AAEpE,+BAA4B;AAC5B,qCAKiB;AACjB,mDAA+C;AAC/C,8CAA0C;AAE1C,6DAA6D;AAC7D,sIAAsI;AACtI,SAAS,oBAAoB,CAAC,IAAI;IAChC,sFAAsF;IACtF,2EAA2E;IAC3E,MAAM,SAAS,GAAG,OAAO,CAAC;IAC1B,MAAM,gBAAgB,GAAG,cAAc,CAAC;IAExC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;SACjC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SAClE,MAAM,CACL,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACX,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,GAAG,CAAC;IACb,CAAC,EACD;QACE,mEAAmE;QACnE,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,IAAI;QAEtC,sCAAsC;QACtC,mIAAmI;QACnI,SAAS,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GAAG,CAAC,MAAA,sBAAsB,CAAC,OAAO,mCAAI,EAAE,CAAC,EACzC,GAAG,CAAC,MAAA,WAAW,CAAC,OAAO,mCAAI,EAAE,CAAC,CACJ,IAC5B;AACJ,CAAC,CAAA,CAAC;AAzEW,QAAA,OAAO,WAyElB"}
|
package/plugins/with-react.d.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import type { Configuration } from 'webpack';
|
|
2
|
-
|
|
2
|
+
import type { WithWebOptions } from '@nrwl/webpack';
|
|
3
|
+
import type { NxWebpackExecutionContext } from '@nrwl/webpack';
|
|
4
|
+
interface WithReactOptions extends WithWebOptions {
|
|
5
|
+
svgr?: false;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @param {WithReactOptions} pluginOptions
|
|
9
|
+
* @returns {NxWebpackPlugin}
|
|
10
|
+
*/
|
|
11
|
+
export declare function withReact(pluginOptions?: WithReactOptions): (config: Configuration, context: NxWebpackExecutionContext) => Configuration;
|
|
12
|
+
export {};
|
package/plugins/with-react.js
CHANGED
|
@@ -2,53 +2,72 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withReact = void 0;
|
|
4
4
|
const processed = new Set();
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
function addHotReload(config) {
|
|
6
|
+
var _a;
|
|
7
|
+
if (config.mode === 'development' && ((_a = config['devServer']) === null || _a === void 0 ? void 0 : _a.hot)) {
|
|
8
|
+
// add `react-refresh/babel` to babel loader plugin
|
|
9
|
+
const babelLoader = config.module.rules.find((rule) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return typeof rule !== 'string' &&
|
|
12
|
+
((_a = rule.loader) === null || _a === void 0 ? void 0 : _a.toString().includes('babel-loader'));
|
|
13
|
+
});
|
|
14
|
+
if (babelLoader && typeof babelLoader !== 'string') {
|
|
15
|
+
babelLoader.options['plugins'] = [
|
|
16
|
+
...(babelLoader.options['plugins'] || []),
|
|
17
|
+
[
|
|
18
|
+
require.resolve('react-refresh/babel'),
|
|
19
|
+
{
|
|
20
|
+
skipEnvCheck: true,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
const ReactRefreshPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
|
26
|
+
config.plugins.push(new ReactRefreshPlugin());
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// We remove potentially conflicting rules that target SVGs because we use @svgr/webpack loader
|
|
30
|
+
// See https://github.com/nrwl/nx/issues/14383
|
|
31
|
+
function removeSvgLoaderIfPresent(config) {
|
|
32
|
+
const svgLoaderIdx = config.module.rules.findIndex((rule) => typeof rule === 'object' && rule.test.toString().includes('svg'));
|
|
33
|
+
if (svgLoaderIdx === -1)
|
|
34
|
+
return;
|
|
35
|
+
config.module.rules.splice(svgLoaderIdx, 1);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @param {WithReactOptions} pluginOptions
|
|
39
|
+
* @returns {NxWebpackPlugin}
|
|
40
|
+
*/
|
|
41
|
+
function withReact(pluginOptions = {}) {
|
|
42
|
+
return function configure(config, context) {
|
|
8
43
|
const { withWeb } = require('@nrwl/webpack');
|
|
9
44
|
if (processed.has(config))
|
|
10
45
|
return config;
|
|
11
|
-
config
|
|
12
|
-
config
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
46
|
+
// Apply web config for CSS, JSX, index.html handling, etc.
|
|
47
|
+
config = withWeb(pluginOptions)(config, context);
|
|
48
|
+
addHotReload(config);
|
|
49
|
+
if ((pluginOptions === null || pluginOptions === void 0 ? void 0 : pluginOptions.svgr) !== false) {
|
|
50
|
+
removeSvgLoaderIfPresent(config);
|
|
51
|
+
config.module.rules.push({
|
|
52
|
+
test: /\.svg$/,
|
|
53
|
+
issuer: /\.(js|ts|md)x?$/,
|
|
54
|
+
use: [
|
|
55
|
+
{
|
|
56
|
+
loader: require.resolve('@svgr/webpack'),
|
|
57
|
+
options: {
|
|
58
|
+
svgo: false,
|
|
59
|
+
titleProp: true,
|
|
60
|
+
ref: true,
|
|
61
|
+
},
|
|
22
62
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
63
|
+
{
|
|
64
|
+
loader: require.resolve('file-loader'),
|
|
65
|
+
options: {
|
|
66
|
+
name: '[name].[hash].[ext]',
|
|
67
|
+
},
|
|
28
68
|
},
|
|
29
|
-
|
|
30
|
-
],
|
|
31
|
-
});
|
|
32
|
-
if (config.mode === 'development' && ((_a = config['devServer']) === null || _a === void 0 ? void 0 : _a.hot)) {
|
|
33
|
-
// add `react-refresh/babel` to babel loader plugin
|
|
34
|
-
const babelLoader = config.module.rules.find((rule) => {
|
|
35
|
-
var _a;
|
|
36
|
-
return typeof rule !== 'string' &&
|
|
37
|
-
((_a = rule.loader) === null || _a === void 0 ? void 0 : _a.toString().includes('babel-loader'));
|
|
69
|
+
],
|
|
38
70
|
});
|
|
39
|
-
if (babelLoader && typeof babelLoader !== 'string') {
|
|
40
|
-
babelLoader.options['plugins'] = [
|
|
41
|
-
...(babelLoader.options['plugins'] || []),
|
|
42
|
-
[
|
|
43
|
-
require.resolve('react-refresh/babel'),
|
|
44
|
-
{
|
|
45
|
-
skipEnvCheck: true,
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
];
|
|
49
|
-
}
|
|
50
|
-
const ReactRefreshPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
|
51
|
-
config.plugins.push(new ReactRefreshPlugin());
|
|
52
71
|
}
|
|
53
72
|
// enable webpack node api
|
|
54
73
|
config.node = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-react.js","sourceRoot":"","sources":["../../../../packages/react/plugins/with-react.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3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;QACtB,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAhDD,8BAgDC"}
|
|
@@ -6,7 +6,6 @@ declare type ModuleFederationDevServerOptions = WebDevServerOptions & {
|
|
|
6
6
|
};
|
|
7
7
|
export default function moduleFederationDevServer(options: ModuleFederationDevServerOptions, context: ExecutorContext): AsyncGenerator<{
|
|
8
8
|
baseUrl: string;
|
|
9
|
-
emittedFiles: import("../../../../../build/packages/webpack/src/utils/models").EmittedFile[];
|
|
10
9
|
success: boolean;
|
|
11
10
|
}, any, undefined>;
|
|
12
11
|
export {};
|
|
File without changes
|
|
@@ -3,7 +3,9 @@ import { Component } from 'react';
|
|
|
3
3
|
<% } %>
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
5
|
import styles from './<%= fileName %>.module.<%= style %>';
|
|
6
|
+
<% if (!minimal) { %>
|
|
6
7
|
import NxWelcome from "./nx-welcome";
|
|
8
|
+
<% } %>
|
|
7
9
|
|
|
8
10
|
<% if (classComponent) { %>
|
|
9
11
|
export class App extends Component {
|
|
@@ -13,7 +15,14 @@ export function App() {
|
|
|
13
15
|
<% } %>
|
|
14
16
|
return (
|
|
15
17
|
<>
|
|
18
|
+
<% if (!minimal) { %>
|
|
16
19
|
<NxWelcome title="<%= projectName %>"/>
|
|
20
|
+
<% } else { %>
|
|
21
|
+
<h1>
|
|
22
|
+
<span> Hello there, </span>
|
|
23
|
+
Welcome <%= projectName %> 👋
|
|
24
|
+
</h1>
|
|
25
|
+
<% } %>
|
|
17
26
|
<div />
|
|
18
27
|
</>);
|
|
19
28
|
<% if (classComponent) { %>
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { Component } from 'react';
|
|
3
3
|
<% } %>
|
|
4
4
|
import './<%= fileName %>.<%= style %>';
|
|
5
|
+
<% if (!minimal) { %>
|
|
5
6
|
import NxWelcome from "./nx-welcome";
|
|
7
|
+
<% } %>
|
|
6
8
|
|
|
7
9
|
<% if (classComponent) { %>
|
|
8
10
|
export class App extends Component {
|
|
@@ -12,7 +14,14 @@ export function App() {
|
|
|
12
14
|
<% } %>
|
|
13
15
|
return (
|
|
14
16
|
<>
|
|
17
|
+
<% if (!minimal) { %>
|
|
15
18
|
<NxWelcome title="<%= projectName %>"/>
|
|
19
|
+
<% } else { %>
|
|
20
|
+
<h1>
|
|
21
|
+
<span> Hello there, </span>
|
|
22
|
+
Welcome <%= projectName %> 👋
|
|
23
|
+
</h1>
|
|
24
|
+
<% } %>
|
|
16
25
|
<div />
|
|
17
26
|
</>);
|
|
18
27
|
<% if (classComponent) { %>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<% if (classComponent) { %>
|
|
2
2
|
import { Component } from 'react';
|
|
3
3
|
<% } %>
|
|
4
|
+
<% if (!minimal) { %>
|
|
4
5
|
import NxWelcome from "./nx-welcome";
|
|
6
|
+
<% } %>
|
|
5
7
|
|
|
6
8
|
<% if (classComponent) { %>
|
|
7
9
|
export class App extends Component {
|
|
@@ -11,7 +13,14 @@ export function App() {
|
|
|
11
13
|
<% } %>
|
|
12
14
|
return (
|
|
13
15
|
<>
|
|
16
|
+
<% if (!minimal) { %>
|
|
14
17
|
<NxWelcome title="<%= projectName %>"/>
|
|
18
|
+
<% } else { %>
|
|
19
|
+
<h1>
|
|
20
|
+
<span> Hello there, </span>
|
|
21
|
+
Welcome <%= projectName %> 👋
|
|
22
|
+
</h1>
|
|
23
|
+
<% } %>
|
|
15
24
|
<div />
|
|
16
25
|
</>);
|
|
17
26
|
<% if (classComponent) { %>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<% if (classComponent) { %>
|
|
2
2
|
import { Component } from 'react';
|
|
3
3
|
<% } %>
|
|
4
|
+
<% if (!minimal) { %>
|
|
4
5
|
import NxWelcome from "./nx-welcome";
|
|
6
|
+
<% } %>
|
|
5
7
|
|
|
6
8
|
<% if (classComponent) { %>
|
|
7
9
|
export class App extends Component {
|
|
@@ -12,7 +14,6 @@ export function App() {
|
|
|
12
14
|
return (
|
|
13
15
|
<>
|
|
14
16
|
<style jsx>{`/** your style here **/`}</style>
|
|
15
|
-
<NxWelcome title="<%= projectName %>"/>
|
|
16
17
|
</>
|
|
17
18
|
);
|
|
18
19
|
|
package/src/generators/application/files/style-styled-module/src/app/__fileName__.tsx__tmpl__
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { Component } from 'react';
|
|
3
3
|
<% } %>
|
|
4
4
|
import styled from '<%= styledModule %>';
|
|
5
|
+
<% if (!minimal) { %>
|
|
5
6
|
import NxWelcome from "./nx-welcome";
|
|
7
|
+
<% } %>
|
|
6
8
|
|
|
7
9
|
const StyledApp = styled.div`
|
|
8
10
|
// Your style here
|
|
@@ -16,7 +18,14 @@ export function App() {
|
|
|
16
18
|
<% } %>
|
|
17
19
|
return (
|
|
18
20
|
<StyledApp>
|
|
21
|
+
<% if (!minimal) { %>
|
|
19
22
|
<NxWelcome title="<%= projectName %>"/>
|
|
23
|
+
<% } else { %>
|
|
24
|
+
<h1>
|
|
25
|
+
<span> Hello there, </span>
|
|
26
|
+
Welcome <%= projectName %> 👋
|
|
27
|
+
</h1>
|
|
28
|
+
<% } %>
|
|
20
29
|
</StyledApp>
|
|
21
30
|
);
|
|
22
31
|
<% if (classComponent) { %>
|
|
@@ -34,6 +34,9 @@ function createApplicationFiles(host, options) {
|
|
|
34
34
|
(options.unitTestRunner === 'vitest' && options.inSourceTests == true)) {
|
|
35
35
|
host.delete(`${options.appProjectRoot}/src/app/${options.fileName}.spec.tsx`);
|
|
36
36
|
}
|
|
37
|
+
if (!options.minimal) {
|
|
38
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/nx-welcome'), options.appProjectRoot, templateVariables);
|
|
39
|
+
}
|
|
37
40
|
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, styleSolutionSpecificAppFiles), options.appProjectRoot, templateVariables);
|
|
38
41
|
if (options.js) {
|
|
39
42
|
(0, devkit_1.toJS)(host);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-application-files.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/application/lib/create-application-files.ts"],"names":[],"mappings":";;;AACA,yCAAgF;AAChF,+BAA4B;AAC5B,yEAAyF;AACzF,sEAAiE;AACjE,4GAAoG;AACpG,mDAA8C;AAE9C,SAAgB,sBAAsB,CAAC,IAAU,EAAE,OAAyB;IAC1E,IAAI,6BAAqC,CAAC;IAC1C,IAAI,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,KAAK,KAAK,YAAY,EAAE;QAC1D,6BAA6B,GAAG,8BAA8B,CAAC;KAChE;SAAM,IAAI,OAAO,CAAC,KAAK,KAAK,YAAY,EAAE;QACzC,6BAA6B,GAAG,2BAA2B,CAAC;KAC7D;SAAM,IAAI,OAAO,CAAC,KAAK,KAAK,MAAM,EAAE;QACnC,6BAA6B,GAAG,qBAAqB,CAAC;KACvD;SAAM,IAAI,OAAO,CAAC,SAAS,EAAE;QAC5B,6BAA6B,GAAG,2BAA2B,CAAC;KAC7D;SAAM;QACL,6BAA6B,GAAG,2BAA2B,CAAC;KAC7D;IAED,MAAM,0BAA0B,GAAG,IAAA,0CAA6B,EAC9D,IAAI,EACJ,OAAO,CAAC,cAAc,CACvB,CAAC;IACF,MAAM,QAAQ,GAAG,IAAA,2BAAW,EAAC,OAAO,CAAC,CAAC;IACtC,MAAM,iBAAiB,iDAClB,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,GACnB,OAAO,KACV,IAAI,EAAE,EAAE,EACR,cAAc,EAAE,IAAA,uBAAc,EAAC,OAAO,CAAC,cAAc,CAAC,EACtD,QAAQ,EACR,mBAAmB,EAAE,IAAA,oEAA8B,EAAC,QAAQ,CAAC,GAC9D,CAAC;IAEF,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,WAAI,EACF,SAAS,EACT,OAAO,CAAC,OAAO,KAAK,MAAM;QACxB,CAAC,CAAC,oBAAoB;QACtB,CAAC,CAAC,uBAAuB,CAC5B,EACD,OAAO,CAAC,cAAc,EACtB,iBAAiB,CAClB,CAAC;IAEF,IACE,OAAO,CAAC,cAAc,KAAK,MAAM;QACjC,CAAC,OAAO,CAAC,cAAc,KAAK,QAAQ,IAAI,OAAO,CAAC,aAAa,IAAI,IAAI,CAAC,EACtE;QACA,IAAI,CAAC,MAAM,CACT,GAAG,OAAO,CAAC,cAAc,YAAY,OAAO,CAAC,QAAQ,WAAW,CACjE,CAAC;KACH;
|
|
1
|
+
{"version":3,"file":"create-application-files.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/application/lib/create-application-files.ts"],"names":[],"mappings":";;;AACA,yCAAgF;AAChF,+BAA4B;AAC5B,yEAAyF;AACzF,sEAAiE;AACjE,4GAAoG;AACpG,mDAA8C;AAE9C,SAAgB,sBAAsB,CAAC,IAAU,EAAE,OAAyB;IAC1E,IAAI,6BAAqC,CAAC;IAC1C,IAAI,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,KAAK,KAAK,YAAY,EAAE;QAC1D,6BAA6B,GAAG,8BAA8B,CAAC;KAChE;SAAM,IAAI,OAAO,CAAC,KAAK,KAAK,YAAY,EAAE;QACzC,6BAA6B,GAAG,2BAA2B,CAAC;KAC7D;SAAM,IAAI,OAAO,CAAC,KAAK,KAAK,MAAM,EAAE;QACnC,6BAA6B,GAAG,qBAAqB,CAAC;KACvD;SAAM,IAAI,OAAO,CAAC,SAAS,EAAE;QAC5B,6BAA6B,GAAG,2BAA2B,CAAC;KAC7D;SAAM;QACL,6BAA6B,GAAG,2BAA2B,CAAC;KAC7D;IAED,MAAM,0BAA0B,GAAG,IAAA,0CAA6B,EAC9D,IAAI,EACJ,OAAO,CAAC,cAAc,CACvB,CAAC;IACF,MAAM,QAAQ,GAAG,IAAA,2BAAW,EAAC,OAAO,CAAC,CAAC;IACtC,MAAM,iBAAiB,iDAClB,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,GACnB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
18
|
function normalizeOptions(host, options) {
|
|
19
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
19
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
20
20
|
const appDirectory = normalizeDirectory(options);
|
|
21
21
|
const appProjectName = normalizeProjectName(options);
|
|
22
22
|
const e2eProjectName = options.rootProject
|
|
@@ -53,6 +53,7 @@ function normalizeOptions(host, options) {
|
|
|
53
53
|
normalized.e2eTestRunner = (_g = normalized.e2eTestRunner) !== null && _g !== void 0 ? _g : 'cypress';
|
|
54
54
|
normalized.inSourceTests = normalized.minimal || normalized.inSourceTests;
|
|
55
55
|
(_h = normalized.devServerPort) !== null && _h !== void 0 ? _h : (normalized.devServerPort = (0, find_free_port_1.findFreePort)(host));
|
|
56
|
+
normalized.minimal = (_j = normalized.minimal) !== null && _j !== void 0 ? _j : false;
|
|
56
57
|
return normalized;
|
|
57
58
|
}
|
|
58
59
|
exports.normalizeOptions = normalizeOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,wDAA4D;AAC5D,yCAMsB;AACtB,qDAAgD;AAEhD,SAAgB,kBAAkB,CAAC,OAAe;IAChD,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAA,+BAAsB,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACvE,OAAO,gBAAgB;QACrB,CAAC,CAAC,GAAG,IAAA,cAAK,EAAC,gBAAgB,CAAC,CAAC,QAAQ,IAAI,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QACvE,CAAC,CAAC,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;AACnC,CAAC;AALD,gDAKC;AAED,SAAgB,oBAAoB,CAAC,OAAe;IAClD,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAA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mCAAI,OAAO,CAAC;IACrD,UAAU,CAAC,OAAO,GAAG,MAAA,UAAU,CAAC,OAAO,mCAAI,SAAS,CAAC;IACrD,UAAU,CAAC,cAAc;QACvB,MAAA,UAAU,CAAC,cAAc,mCACzB,CAAC,UAAU,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACtD,UAAU,CAAC,aAAa,GAAG,MAAA,UAAU,CAAC,aAAa,mCAAI,SAAS,CAAC;IACjE,UAAU,CAAC,aAAa,GAAG,UAAU,CAAC,OAAO,IAAI,UAAU,CAAC,aAAa,CAAC;IAC1E,MAAA,UAAU,CAAC,aAAa,oCAAxB,UAAU,CAAC,aAAa,GAAK,IAAA,6BAAY,EAAC,IAAI,CAAC,EAAC;IAChD,UAAU,CAAC,OAAO,GAAG,MAAA,UAAU,CAAC,OAAO,mCAAI,KAAK,CAAC;IAEjD,OAAO,UAAU,CAAC;AACpB,CAAC;AA1DD,4CA0DC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
<% if (!minimal) { %>
|
|
2
3
|
import NxWelcome from "./nx-welcome";
|
|
4
|
+
<% } %>
|
|
3
5
|
import { Link, Route, Routes } from 'react-router-dom';
|
|
4
6
|
|
|
5
7
|
<% if (remotes.length > 0) { %>
|
|
@@ -17,7 +19,9 @@ export function App() {
|
|
|
17
19
|
<% }); %>
|
|
18
20
|
</ul>
|
|
19
21
|
<Routes>
|
|
22
|
+
<% if (!minimal) { %>
|
|
20
23
|
<Route path="/" element={<NxWelcome title="<%= projectName %>"/>} />
|
|
24
|
+
<% } %>
|
|
21
25
|
<% remotes.forEach(function(r) { %>
|
|
22
26
|
<Route path="/<%=r.fileName%>" element={<<%= r.className %>/>} />
|
|
23
27
|
<% }); %>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const { composePlugins, withNx } = require('@nrwl/webpack');
|
|
2
|
+
const { withReact } = require('@nrwl/react');
|
|
3
|
+
const { withModuleFederationForSSR } = require('@nrwl/react/module-federation');
|
|
4
4
|
|
|
5
5
|
const baseConfig = require('./module-federation.config');
|
|
6
6
|
|
|
@@ -162,6 +162,11 @@
|
|
|
162
162
|
"description": "Whether to configure SSR for the host application",
|
|
163
163
|
"type": "boolean",
|
|
164
164
|
"default": false
|
|
165
|
+
},
|
|
166
|
+
"minimal": {
|
|
167
|
+
"description": "Generate a React app with a minimal setup. No nx starter template.",
|
|
168
|
+
"type": "boolean",
|
|
169
|
+
"default": false
|
|
165
170
|
}
|
|
166
171
|
},
|
|
167
172
|
"required": ["name"],
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const executor_options_utils_1 = require("@nrwl/workspace/src/utilities/executor-options-utils");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
function default_1(tree) {
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
// Since projects can have multiple configurations, we need to know if the default options
|
|
10
|
+
// need to be migrated or not. If so then the subsequent configurations with `webpackConfig` also need to be.
|
|
11
|
+
const defaultOptionsUpdated = new Set();
|
|
12
|
+
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/webpack:webpack', (options, projectName, targetName, configurationName) => {
|
|
13
|
+
var _a;
|
|
14
|
+
const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
15
|
+
const defaultOptions = projectConfiguration.targets[targetName].options;
|
|
16
|
+
const defaultWasUpdated = defaultOptionsUpdated.has(projectName);
|
|
17
|
+
// If default was not updated (for different configurations), we don't do anything
|
|
18
|
+
// If isolatedConfig is set, we don't need to do anything
|
|
19
|
+
// If it is NOT React, we don't need to do anything
|
|
20
|
+
if (!defaultWasUpdated &&
|
|
21
|
+
((defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions['isolatedConfig']) ||
|
|
22
|
+
!(((_a = defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions['main']) === null || _a === void 0 ? void 0 : _a.match(/main\.(t|j)sx$/)) ||
|
|
23
|
+
(defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions['webpackConfig']) === '@nrwl/react/plugins/webpack'))) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
defaultOptionsUpdated.add(projectName);
|
|
27
|
+
// If this is not the default options (e.g. for development, production, or something custom),
|
|
28
|
+
// then skip it unless it specifically configures a webpackConfig file
|
|
29
|
+
if (configurationName && !(options === null || options === void 0 ? void 0 : options.webpackConfig)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
// If webpackConfig is set, update it with the new options
|
|
33
|
+
// If webpackConfig is not set, we need to create a new
|
|
34
|
+
// webpack.config.js file and set the path to it in the
|
|
35
|
+
// executor options
|
|
36
|
+
if ((options === null || options === void 0 ? void 0 : options['webpackConfig']) &&
|
|
37
|
+
options['webpackConfig'] !== '@nrwl/react/plugins/webpack') {
|
|
38
|
+
let oldName = options['webpackConfig'];
|
|
39
|
+
if (options['webpackConfig'].endsWith('.js')) {
|
|
40
|
+
oldName = options['webpackConfig'].replace('.js', '.old.js');
|
|
41
|
+
}
|
|
42
|
+
if (options['webpackConfig'].endsWith('.ts')) {
|
|
43
|
+
oldName = options['webpackConfig'].replace('.ts', '.old.ts');
|
|
44
|
+
}
|
|
45
|
+
renameFile(tree, options['webpackConfig'], oldName);
|
|
46
|
+
const justTheFileName = (0, path_1.basename)(oldName);
|
|
47
|
+
tree.write(options['webpackConfig'], `
|
|
48
|
+
const { composePlugins, withNx } = require('@nrwl/webpack');
|
|
49
|
+
const { withReact } = require('@nrwl/react');
|
|
50
|
+
|
|
51
|
+
// Nx plugins for webpack.
|
|
52
|
+
module.exports = composePlugins(withNx(), withReact(), (config, { options, context }) => {
|
|
53
|
+
// Note: This was added by an Nx migration.
|
|
54
|
+
// You should consider inlining the logic into this file.
|
|
55
|
+
// For more information on webpack config and Nx see:
|
|
56
|
+
// https://nx.dev/packages/webpack/documents/webpack-config-setup
|
|
57
|
+
return require('./${justTheFileName}')(config, context);
|
|
58
|
+
});
|
|
59
|
+
`);
|
|
60
|
+
options['isolatedConfig'] = true;
|
|
61
|
+
projectConfiguration.targets[targetName][configurationName !== null && configurationName !== void 0 ? configurationName : 'options'] = options;
|
|
62
|
+
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
|
|
63
|
+
devkit_1.logger.info(`
|
|
64
|
+
${options['webpackConfig']} has been renamed to ${oldName} and a new ${options['webpackConfig']}
|
|
65
|
+
has been created for your project ${projectName}.
|
|
66
|
+
You should consider inlining the logic from ${oldName} into ${options['webpackConfig']}.
|
|
67
|
+
You can read our guide on how to do this here:
|
|
68
|
+
|
|
69
|
+
https://nx.dev/packages/webpack/documents/webpack-config-setup
|
|
70
|
+
`);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
74
|
+
if (!options) {
|
|
75
|
+
options = {};
|
|
76
|
+
}
|
|
77
|
+
options['webpackConfig'] = `${projectConfiguration.root}/webpack.config.js`;
|
|
78
|
+
options['isolatedConfig'] = true;
|
|
79
|
+
tree.write(options['webpackConfig'], `
|
|
80
|
+
const { composePlugins, withNx } = require('@nrwl/webpack');
|
|
81
|
+
const { withReact } = require('@nrwl/react');
|
|
82
|
+
|
|
83
|
+
// Nx plugins for webpack.
|
|
84
|
+
module.exports = composePlugins(withNx(), withReact(), (config, { options, context }) => {
|
|
85
|
+
// Update the webpack config as needed here.
|
|
86
|
+
// e.g. config.plugins.push(new MyPlugin())
|
|
87
|
+
// For more information on webpack config and Nx see:
|
|
88
|
+
// https://nx.dev/packages/webpack/documents/webpack-config-setup
|
|
89
|
+
return config;
|
|
90
|
+
});
|
|
91
|
+
`);
|
|
92
|
+
projectConfiguration.targets[targetName].options = options;
|
|
93
|
+
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
exports.default = default_1;
|
|
100
|
+
function renameFile(tree, from, to) {
|
|
101
|
+
const buffer = tree.read(from);
|
|
102
|
+
if (!buffer) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
tree.write(to, buffer);
|
|
106
|
+
tree.delete(from);
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=webpack-config-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack-config-setup.js","sourceRoot":"","sources":["../../../../../../packages/react/src/migrations/update-15-6-3/webpack-config-setup.ts"],"names":[],"mappings":";;;AAAA,yCAMsB;AACtB,iGAA8F;AAC9F,+BAAgC;AAGhC,mBAA+B,IAAU;;QACvC,0FAA0F;QAC1F,6GAA6G;QAC7G,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAAU,CAAC;QAChD,IAAA,+CAAsB,EACpB,IAAI,EACJ,uBAAuB,EACvB,CAAC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,EAAE;;YACtD,MAAM,oBAAoB,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;YACzE,MAAM,cAAc,GAAG,oBAAoB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;YACxE,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAEjE,kFAAkF;YAClF,yDAAyD;YACzD,mDAAmD;YACnD,IACE,CAAC,iBAAiB;gBAClB,CAAC,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAG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C/B,IAAI,CAAC,MAAM,EAAE;QACX,OAAO;KACR;IACD,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACvB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { ModuleFederationConfig } from '@nrwl/devkit';
|
|
2
|
-
|
|
2
|
+
import type { AsyncNxWebpackPlugin } from '@nrwl/webpack';
|
|
3
|
+
/**
|
|
4
|
+
* @param {ModuleFederationConfig} options
|
|
5
|
+
* @return {Promise<AsyncNxWebpackPlugin>}
|
|
6
|
+
*/
|
|
7
|
+
export declare function withModuleFederation(options: ModuleFederationConfig): Promise<AsyncNxWebpackPlugin>;
|
|
@@ -17,12 +17,16 @@ function determineRemoteUrl(remote) {
|
|
|
17
17
|
const port = (_e = (_d = serveTarget.options) === null || _d === void 0 ? void 0 : _d.port) !== null && _e !== void 0 ? _e : 4201;
|
|
18
18
|
return `${host.endsWith('/') ? host.slice(0, -1) : host}:${port}/remoteEntry.js`;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* @param {ModuleFederationConfig} options
|
|
22
|
+
* @return {Promise<AsyncNxWebpackPlugin>}
|
|
23
|
+
*/
|
|
20
24
|
function withModuleFederation(options) {
|
|
21
25
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
26
|
const reactWebpackConfig = require('../../plugins/webpack');
|
|
23
27
|
const { sharedDependencies, sharedLibraries, mappedRemotes } = yield (0, utils_1.getModuleFederationConfig)(options, determineRemoteUrl);
|
|
24
|
-
return (config) => {
|
|
25
|
-
config = reactWebpackConfig(config);
|
|
28
|
+
return (config, ctx) => {
|
|
29
|
+
config = reactWebpackConfig(config, ctx);
|
|
26
30
|
config.output.uniqueName = options.name;
|
|
27
31
|
config.output.publicPath = 'auto';
|
|
28
32
|
config.optimization = {
|