@nx/react 20.1.0-canary.20241030-62f58eb → 20.1.0-canary.20241101-d4f4dac

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.
Files changed (61) hide show
  1. package/package.json +5 -5
  2. package/src/generators/application/files/base-rspack/src/app/__fileName__.spec.tsx__tmpl__ +3 -3
  3. package/src/generators/application/files/base-rspack/src/main.tsx__tmpl__ +24 -4
  4. package/src/generators/application/files/base-rspack/tsconfig.app.json__tmpl__ +1 -1
  5. package/src/generators/application/files/base-vite/src/app/__fileName__.spec.tsx__tmpl__ +3 -3
  6. package/src/generators/application/files/base-vite/src/main.tsx__tmpl__ +31 -6
  7. package/src/generators/application/files/base-vite/tsconfig.app.json__tmpl__ +1 -1
  8. package/src/generators/application/files/base-webpack/src/app/__fileName__.spec.tsx__tmpl__ +3 -3
  9. package/src/generators/application/files/base-webpack/src/main.tsx__tmpl__ +22 -2
  10. package/src/generators/application/files/base-webpack/tsconfig.app.json__tmpl__ +1 -1
  11. package/src/generators/application/files/base-webpack/webpack.config.js__tmpl__ +3 -3
  12. package/src/generators/application/files/style-css-module/src/app/__fileName__.tsx__tmpl__ +26 -16
  13. package/src/generators/application/files/style-global-css/src/app/__fileName__.tsx__tmpl__ +29 -20
  14. package/src/generators/application/files/style-none/src/app/__fileName__.tsx__tmpl__ +26 -16
  15. package/src/generators/application/files/style-styled-jsx/src/app/__fileName__.tsx__tmpl__ +31 -22
  16. package/src/generators/application/files/style-styled-module/src/app/__fileName__.tsx__tmpl__ +30 -21
  17. package/src/generators/application/files/style-tailwind/src/app/__fileName__.tsx__tmpl__ +30 -18
  18. package/src/generators/application/lib/get-app-tests.js +8 -9
  19. package/src/generators/component/files/__fileName__.tsx__tmpl__ +55 -56
  20. package/src/generators/component-story/files/jsx/__componentFileName__.stories.jsx__tmpl__ +5 -5
  21. package/src/generators/component-story/files/tsx/__componentFileName__.stories.tsx__tmpl__ +3 -4
  22. package/src/generators/host/files/common/src/app/__fileName__.js__tmpl__ +20 -20
  23. package/src/generators/host/files/common/src/main.js__tmpl__ +9 -9
  24. package/src/generators/host/files/common-ts/src/app/__fileName__.tsx__tmpl__ +27 -27
  25. package/src/generators/host/files/common-ts/src/main.ts__tmpl__ +9 -9
  26. package/src/generators/host/files/rspack-common/src/app/__fileName__.jsx__tmpl__ +13 -13
  27. package/src/generators/host/files/rspack-common/src/main.jsx__tmpl__ +9 -9
  28. package/src/generators/host/files/rspack-module-federation/module-federation.config.js__tmpl__ +4 -4
  29. package/src/generators/host/files/rspack-module-federation/rspack.config.prod.js__tmpl__ +3 -1
  30. package/src/generators/host/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +6 -4
  31. package/src/generators/host/files/rspack-module-federation-ssr/rspack.server.config.js__tmpl__ +1 -1
  32. package/src/generators/host/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +6 -6
  33. package/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.server.config.ts__tmpl__ +1 -1
  34. package/src/generators/host/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +18 -18
  35. package/src/generators/host/files/rspack-module-federation-ts/rspack.config.prod.ts__tmpl__ +23 -21
  36. package/src/generators/host/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +1 -1
  37. package/src/generators/host/files/webpack-module-federation/module-federation.config.js__tmpl__ +4 -4
  38. package/src/generators/host/files/webpack-module-federation/webpack.config.prod.js__tmpl__ +23 -21
  39. package/src/generators/host/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ +6 -6
  40. package/src/generators/host/files/webpack-module-federation-ssr/webpack.server.config.js__tmpl__ +1 -1
  41. package/src/generators/host/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +6 -6
  42. package/src/generators/host/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +1 -1
  43. package/src/generators/host/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +18 -18
  44. package/src/generators/host/files/webpack-module-federation-ts/webpack.config.prod.ts__tmpl__ +23 -21
  45. package/src/generators/host/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +1 -1
  46. package/src/generators/library/files/common/tsconfig.lib.json__tmpl__ +1 -1
  47. package/src/generators/library/files/vite/tsconfig.lib.json__tmpl__ +1 -1
  48. package/src/generators/remote/files/rspack-module-federation/module-federation.config.js__tmpl__ +7 -7
  49. package/src/generators/remote/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +4 -4
  50. package/src/generators/remote/files/rspack-module-federation-ssr/rspack.server.config.js__tmpl__ +1 -1
  51. package/src/generators/remote/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +4 -4
  52. package/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.server.config.ts__tmpl__ +1 -1
  53. package/src/generators/remote/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +7 -7
  54. package/src/generators/remote/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +1 -1
  55. package/src/generators/remote/files/webpack-module-federation/module-federation.config.js__tmpl__ +7 -7
  56. package/src/generators/remote/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ +4 -4
  57. package/src/generators/remote/files/webpack-module-federation-ssr/webpack.server.config.js__tmpl__ +1 -1
  58. package/src/generators/remote/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +4 -4
  59. package/src/generators/remote/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +1 -1
  60. package/src/generators/remote/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +7 -7
  61. package/src/generators/remote/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/react",
3
- "version": "20.1.0-canary.20241030-62f58eb",
3
+ "version": "20.1.0-canary.20241101-d4f4dac",
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": {
@@ -39,10 +39,10 @@
39
39
  "picocolors": "^1.1.0",
40
40
  "tslib": "^2.3.0",
41
41
  "@module-federation/enhanced": "0.6.9",
42
- "@nx/devkit": "20.1.0-canary.20241030-62f58eb",
43
- "@nx/js": "20.1.0-canary.20241030-62f58eb",
44
- "@nx/eslint": "20.1.0-canary.20241030-62f58eb",
45
- "@nx/web": "20.1.0-canary.20241030-62f58eb",
42
+ "@nx/devkit": "20.1.0-canary.20241101-d4f4dac",
43
+ "@nx/js": "20.1.0-canary.20241101-d4f4dac",
44
+ "@nx/eslint": "20.1.0-canary.20241101-d4f4dac",
45
+ "@nx/web": "20.1.0-canary.20241101-d4f4dac",
46
46
  "express": "^4.19.2",
47
47
  "http-proxy-middleware": "^3.0.3"
48
48
  },
@@ -1,10 +1,10 @@
1
1
  import { render } from '@testing-library/react';
2
- <% if (routing) { %>
2
+ <%_ if (routing) { _%>
3
3
  import { BrowserRouter } from 'react-router-dom';
4
- <% } %>
4
+ <%_ } _%>
5
5
 
6
6
  import App from './<%= fileName %>';
7
7
 
8
8
  describe('App', () => {
9
- <%- appTests %>
9
+ <%- appTests _%>
10
10
  });
@@ -1,11 +1,31 @@
1
- <% if (strict) { %>import { StrictMode } from 'react';<% } %>
1
+ <%_ if (strict) { _%>import { StrictMode } from 'react';<%_ } _%>
2
2
  import * as ReactDOM from 'react-dom/client';
3
- <% if (routing) { %>import { BrowserRouter } from 'react-router-dom';<% } %>
3
+ <%_ if (routing) { _%>import { BrowserRouter } from 'react-router-dom';<%_ } _%>
4
4
 
5
5
  import App from './app/<%= fileName %>';
6
6
  import './styles.<%= style %>'
7
7
 
8
8
  const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
9
+ <%_ if(strict && !routing) { _%>
9
10
  root.render(
10
- <% if (strict) { %><StrictMode><% } %><% if (routing) { %><BrowserRouter><% } %><App /><% if (routing) { %></BrowserRouter><% } %><% if (strict) { %></StrictMode><% } %>
11
- );
11
+ <StrictMode>
12
+ <App/>
13
+ </StrictMode>
14
+ )
15
+ <%_ } _%>
16
+ <%_ if(!strict && routing) { _%>
17
+ root.render(
18
+ <BrowserRouter>
19
+ <App/>
20
+ </BrowserRouter>
21
+ )
22
+ <%_ } _%>
23
+ <%_ if(strict && routing) { _%>
24
+ root.render(
25
+ <StrictMode>
26
+ <BrowserRouter>
27
+ <App/>
28
+ </BrowserRouter>
29
+ </StrictMode>
30
+ )
31
+ <%_ } _%>
@@ -4,7 +4,7 @@
4
4
  "outDir": "<%= offsetFromRoot %>dist/out-tsc",
5
5
  "types": [
6
6
  "node",
7
- <% if (style === 'styled-jsx') { %>"@nx/react/typings/styled-jsx.d.ts",<% } %>
7
+ <%_ if (style === 'styled-jsx') { %>"@nx/react/typings/styled-jsx.d.ts",<% } _%>
8
8
  "@nx/react/typings/cssmodule.d.ts",
9
9
  "@nx/react/typings/image.d.ts"
10
10
  ]
@@ -1,10 +1,10 @@
1
1
  import { render } from '@testing-library/react';
2
- <% if (routing) { %>
2
+ <%_ if (routing) { _%>
3
3
  import { BrowserRouter } from 'react-router-dom';
4
- <% } %>
4
+ <%_ } _%>
5
5
 
6
6
  import App from './<%= fileName %>';
7
7
 
8
8
  describe('App', () => {
9
- <%- appTests %>
9
+ <%- appTests _%>
10
10
  });
@@ -1,10 +1,35 @@
1
- <% if (strict) { %>import { StrictMode } from 'react';<% } %>
1
+ <%_ if (strict) { _%>
2
+ import { StrictMode } from 'react';
3
+ <%_ } _%>
4
+ <%_ if (routing) { _%>
5
+ import { BrowserRouter } from 'react-router-dom';
6
+ <%_ } _%>
2
7
  import * as ReactDOM from 'react-dom/client';
3
- <% if (routing) { %>import { BrowserRouter } from 'react-router-dom';<% } %>
4
-
5
8
  import App from './app/<%= fileName %>';
6
9
 
7
- const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
8
- root.render(
9
- <% if (strict) { %><StrictMode><% } %><% if (routing) { %><BrowserRouter><% } %><App /><% if (routing) { %></BrowserRouter><% } %><% if (strict) { %></StrictMode><% } %>
10
+ const root = ReactDOM.createRoot(
11
+ document.getElementById('root') as HTMLElement
10
12
  );
13
+
14
+ root.render(
15
+ <%_ if(strict && !routing) { _%>
16
+ <StrictMode>
17
+ <App/>
18
+ </StrictMode>
19
+ <%_ } _%>
20
+ <%_ if(!strict && routing) { _%>
21
+ <BrowserRouter>
22
+ <App/>
23
+ </BrowserRouter>
24
+ <%_ } _%>
25
+ <%_ if(strict && routing) { _%>
26
+ <StrictMode>
27
+ <BrowserRouter>
28
+ <App/>
29
+ </BrowserRouter>
30
+ </StrictMode>
31
+ <%_ } _%>
32
+ <%_ if(!strict && !routing) { _%>
33
+ <App/>
34
+ <%_ } _%>
35
+ );
@@ -4,7 +4,7 @@
4
4
  "outDir": "<%= offsetFromRoot %>dist/out-tsc",
5
5
  "types": [
6
6
  "node",
7
- <% if (style === 'styled-jsx') { %>"@nx/react/typings/styled-jsx.d.ts",<% } %>
7
+ <%_ if (style === 'styled-jsx') { _%>"@nx/react/typings/styled-jsx.d.ts",<%_ } _%>
8
8
  "@nx/react/typings/cssmodule.d.ts",
9
9
  "@nx/react/typings/image.d.ts"
10
10
  ]
@@ -1,10 +1,10 @@
1
1
  import { render } from '@testing-library/react';
2
- <% if (routing) { %>
2
+ <%_ if (routing) { _%>
3
3
  import { BrowserRouter } from 'react-router-dom';
4
- <% } %>
4
+ <%_ } _%>
5
5
 
6
6
  import App from './<%= fileName %>';
7
7
 
8
8
  describe('App', () => {
9
- <%- appTests %>
9
+ <%- appTests _%>
10
10
  });
@@ -5,6 +5,26 @@ import * as ReactDOM from 'react-dom/client';
5
5
  import App from './app/<%= fileName %>';
6
6
 
7
7
  const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
8
+ <%_ if(strict && !routing) { _%>
8
9
  root.render(
9
- <% if (strict) { %><StrictMode><% } %><% if (routing) { %><BrowserRouter><% } %><App /><% if (routing) { %></BrowserRouter><% } %><% if (strict) { %></StrictMode><% } %>
10
- );
10
+ <StrictMode>
11
+ <App/>
12
+ </StrictMode>
13
+ )
14
+ <%_ } _%>
15
+ <%_ if(!strict && routing) { _%>
16
+ root.render(
17
+ <BrowserRouter>
18
+ <App/>
19
+ </BrowserRouter>
20
+ )
21
+ <%_ } _%>
22
+ <%_ if(strict && routing) { _%>
23
+ root.render(
24
+ <StrictMode>
25
+ <BrowserRouter>
26
+ <App/>
27
+ </BrowserRouter>
28
+ </StrictMode>
29
+ )
30
+ <%_ } _%>
@@ -4,7 +4,7 @@
4
4
  "outDir": "<%= offsetFromRoot %>dist/out-tsc",
5
5
  "types": [
6
6
  "node",
7
- <% if (style === 'styled-jsx') { %>"@nx/react/typings/styled-jsx.d.ts",<% } %>
7
+ <%_ if (style === 'styled-jsx') { _%>"@nx/react/typings/styled-jsx.d.ts",<%_ } _%>
8
8
  "@nx/react/typings/cssmodule.d.ts",
9
9
  "@nx/react/typings/image.d.ts"
10
10
  ]
@@ -1,4 +1,4 @@
1
- <% if (webpackPluginOptions) { %>
1
+ <%_ if (webpackPluginOptions) { _%>
2
2
  const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
3
3
  const { NxReactWebpackPlugin } = require('@nx/react/webpack-plugin');
4
4
  const { join } = require('path');
@@ -34,7 +34,7 @@ module.exports = {
34
34
  }),
35
35
  ],
36
36
  };
37
- <% } else { %>
37
+ <%_ } else { _%>
38
38
  const { composePlugins, withNx } = require('@nx/webpack');
39
39
  const { withReact } = require('@nx/react');
40
40
 
@@ -52,4 +52,4 @@ module.exports = composePlugins(
52
52
  return config;
53
53
  }
54
54
  );
55
- <% } %>
55
+ <%_ } _%>
@@ -1,35 +1,45 @@
1
1
  <% if (classComponent) { %>
2
2
  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
+ <%_ if (!minimal) { _%>
7
7
  import NxWelcome from "./nx-welcome";
8
- <% } %>
8
+ <%_ } _%>
9
9
 
10
- <% if (classComponent) { %>
10
+ <%_ if (classComponent) { _%>
11
11
  export class App extends Component {
12
- render() {
13
- <% } else { %>
12
+ override render() {
13
+ return (
14
+ <div>
15
+ <%_ if (!minimal) { _%>
16
+ <NxWelcome title="<%= projectName %>"/>
17
+ <%_ } else { _%>
18
+ <h1>
19
+ <span> Hello there, </span>
20
+ Welcome <%= projectName %> 👋
21
+ </h1>
22
+ <%_ } _%>
23
+ </div>
24
+ );
25
+ }
26
+ }
27
+ <%_ } else { _%>
14
28
  export function App() {
15
- <% } %>
16
29
  return (
17
30
  <div>
18
- <% if (!minimal) { %>
31
+ <%_ if (!minimal) { _%>
19
32
  <NxWelcome title="<%= projectName %>"/>
20
- <% } else { %>
33
+ <%_ } else { _%>
21
34
  <h1>
22
35
  <span> Hello there, </span>
23
36
  Welcome <%= projectName %> 👋
24
37
  </h1>
25
- <% } %>
26
- </div>);
27
- <% if (classComponent) { %>
28
- }
29
- }
30
- <% } else { %>
38
+ <%_ } _%>
39
+ </div>
40
+ );
31
41
  }
32
- <% } %>
42
+ <%_ } _%>
33
43
 
34
44
  export default App;
35
45
 
@@ -1,35 +1,44 @@
1
- <% if (classComponent) { %>
1
+ <%_ if (classComponent) { _%>
2
2
  import { Component } from 'react';
3
- <% } %>
3
+ <%_ } _%>
4
4
  import './<%= fileName %>.<%= style %>';
5
- <% if (!minimal) { %>
5
+ <%_ if (!minimal) { _%>
6
6
  import NxWelcome from "./nx-welcome";
7
- <% } %>
7
+ <%_ } _%>
8
8
 
9
- <% if (classComponent) { %>
9
+ <%_ if (classComponent) { _%>
10
10
  export class App extends Component {
11
- render() {
12
- <% } else { %>
11
+ override render() {
12
+ return (
13
+ <div>
14
+ <%_ if (!minimal) { _%>
15
+ <NxWelcome title="<%= projectName %>"/>
16
+ <%_ } else { _%>
17
+ <h1>
18
+ <span> Hello there, </span>
19
+ Welcome <%= projectName %> 👋
20
+ </h1>
21
+ <%_ } _%>
22
+ </div>
23
+ );
24
+ }
25
+ }
26
+ <%_ } else { _%>
13
27
  export function App() {
14
- <% } %>
15
28
  return (
16
- <div>
17
- <% if (!minimal) { %>
18
- <NxWelcome title="<%= projectName %>"/>
19
- <% } else { %>
29
+ <div>
30
+ <%_ if (!minimal) { _%>
31
+ <NxWelcome title="<%= projectName %>"/>
32
+ <%_ } else { _%>
20
33
  <h1>
21
34
  <span> Hello there, </span>
22
35
  Welcome <%= projectName %> 👋
23
36
  </h1>
24
- <% } %>
25
- </div>);
26
- <% if (classComponent) { %>
27
- }
37
+ <%_ } _%>
38
+ </div>
39
+ );
28
40
  }
29
- <% } else { %>
30
- }
31
- <% } %>
32
-
41
+ <%_ } _%>
33
42
  export default App;
34
43
 
35
44
  <% if (inSourceTests === true) { %> <%- inSourceVitestTests %> <% } %>
@@ -1,33 +1,43 @@
1
- <% if (classComponent) { %>
1
+ <%_ if (classComponent) { _%>
2
2
  import { Component } from 'react';
3
- <% } %>
4
- <% if (!minimal) { %>
3
+ <%_ } _%>
4
+ <%_ if (!minimal) { _%>
5
5
  import NxWelcome from "./nx-welcome";
6
- <% } %>
6
+ <%_ } _%>
7
7
 
8
- <% if (classComponent) { %>
8
+ <%_ if (classComponent) { _%>
9
9
  export class App extends Component {
10
10
  override render() {
11
- <% } else { %>
11
+ return (
12
+ <div>
13
+ <%_ if (!minimal) { _%>
14
+ <NxWelcome title="<%= projectName %>"/>
15
+ <%_ } else { _%>
16
+ <h1>
17
+ <span> Hello there, </span>
18
+ Welcome <%= projectName %> 👋
19
+ </h1>
20
+ <%_ } _%>
21
+ </div>
22
+ );
23
+ }
24
+ }
25
+ <%_ } else { _%>
12
26
  export function App() {
13
- <% } %>
14
27
  return (
15
28
  <div>
16
- <% if (!minimal) { %>
29
+ <%_ if (!minimal) { _%>
17
30
  <NxWelcome title="<%= projectName %>"/>
18
- <% } else { %>
31
+ <%_ } else { _%>
19
32
  <h1>
20
33
  <span> Hello there, </span>
21
34
  Welcome <%= projectName %> 👋
22
35
  </h1>
23
- <% } %>
24
- </div>);
25
- <% if (classComponent) { %>
26
- }
27
- }
28
- <% } else { %>
36
+ <%_ } _%>
37
+ </div>
38
+ );
29
39
  }
30
- <% } %>
40
+ <%_ } _%>
31
41
 
32
42
  export default App;
33
43
 
@@ -1,36 +1,45 @@
1
- <% if (classComponent) { %>
1
+ <%_ if (classComponent) { _%>
2
2
  import { Component } from 'react';
3
- <% } %>
4
- <% if (!minimal) { %>
3
+ <%_ } _%>
4
+ <%_ if (!minimal) { _%>
5
5
  import NxWelcome from "./nx-welcome";
6
- <% } %>
6
+ <%_ } _%>
7
7
 
8
- <% if (classComponent) { %>
8
+ <%_ if (classComponent) { _%>
9
9
  export class App extends Component {
10
- render() {
11
- <% } else { %>
10
+ override render() {
11
+ return (
12
+ <div>
13
+ <style jsx>{`/** your style here **/`}</style>
14
+ <%_ if (!minimal) { _%>
15
+ <NxWelcome title="<%= projectName %>"/>
16
+ <%_ } else { _%>
17
+ <h1>
18
+ <span> Hello there, </span>
19
+ Welcome <%= projectName %> 👋
20
+ </h1>
21
+ <%_ } _%>
22
+ </div>
23
+ );
24
+ }
25
+ }
26
+ <%_ } else { _%>
12
27
  export function App() {
13
- <% } %>
14
28
  return (
15
29
  <div>
16
30
  <style jsx>{`/** your style here **/`}</style>
17
- <% if (!minimal) { %>
18
- <NxWelcome title="<%= projectName %>"/>
19
- <% } else { %>
20
- <h1>
21
- <span> Hello there, </span>
22
- Welcome <%= projectName %> 👋
23
- </h1>
24
- <% } %>
31
+ <%_ if (!minimal) { _%>
32
+ <NxWelcome title="<%= projectName %>"/>
33
+ <%_ } else { _%>
34
+ <h1>
35
+ <span> Hello there, </span>
36
+ Welcome <%= projectName %> 👋
37
+ </h1>
38
+ <%_ } _%>
25
39
  </div>
26
40
  );
27
-
28
- <% if (classComponent) { %>
29
- }
30
- }
31
- <% } else { %>
32
41
  }
33
- <% } %>
42
+ <%_ } _%>
34
43
 
35
44
  export default App;
36
45
 
@@ -1,39 +1,48 @@
1
- <% if (classComponent) { %>
1
+ <%_ if (classComponent) { _%>
2
2
  import { Component } from 'react';
3
- <% } %>
3
+ <%_ } _%>
4
4
  import styled from '<%= styledModule %>';
5
- <% if (!minimal) { %>
5
+ <%_ if (!minimal) { _%>
6
6
  import NxWelcome from "./nx-welcome";
7
- <% } %>
7
+ <%_ } _%>
8
8
 
9
9
  const StyledApp = styled.div`
10
10
  // Your style here
11
11
  `;
12
12
 
13
- <% if (classComponent) { %>
13
+ <%_ if (classComponent) { _%>
14
14
  export class App extends Component {
15
- render() {
16
- <% } else { %>
17
- export function App() {
18
- <% } %>
19
- return (
15
+ override render() {
16
+ return (
20
17
  <StyledApp>
21
- <% if (!minimal) { %>
18
+ <%_ if (!minimal) { _%>
22
19
  <NxWelcome title="<%= projectName %>"/>
23
- <% } else { %>
24
- <h1>
25
- <span> Hello there, </span>
26
- Welcome <%= projectName %> 👋
27
- </h1>
28
- <% } %>
20
+ <%_ } else { _%>
21
+ <h1>
22
+ <span> Hello there, </span>
23
+ Welcome <%= projectName %> 👋
24
+ </h1>
25
+ <%_ } _%>
29
26
  </StyledApp>
30
- );
31
- <% if (classComponent) { %>
27
+ );
32
28
  }
33
29
  }
34
- <% } else { %>
30
+ <%_ } else { _%>
31
+ export function App() {
32
+ return (
33
+ <StyledApp>
34
+ <%_ if (!minimal) { _%>
35
+ <NxWelcome title="<%= projectName %>"/>
36
+ <%_ } else { _%>
37
+ <h1>
38
+ <span> Hello there, </span>
39
+ Welcome <%= projectName %> 👋
40
+ </h1>
41
+ <%_ } _%>
42
+ </StyledApp>
43
+ );
35
44
  }
36
- <% } %>
45
+ <%_ } _%>
37
46
 
38
47
  export default App;
39
48
 
@@ -1,32 +1,44 @@
1
- <% if (classComponent) { %>
1
+ <%_ if (classComponent) { _%>
2
2
  import { Component } from 'react';
3
- <% } if (!minimal) { %>
3
+ <%_ } if (!minimal) { _%>
4
4
  import NxWelcome from "./nx-welcome";
5
- <% } %>
5
+ <%_ } if (bundler === "rspack") { _%>
6
+ import '../styles.css';
7
+ <%_ } _%>
6
8
 
7
- <% if (classComponent) { %>
9
+ <%_ if (classComponent) { _%>
8
10
  export class App extends Component {
9
- render() {
10
- <% } else { %>
11
+ override render() {
12
+ return (
13
+ <div>
14
+ <%_ if (!minimal) { _%>
15
+ <NxWelcome title="<%= projectName %>"/>
16
+ <%_ } else { _%>
17
+ <h1>
18
+ <span> Hello there, </span>
19
+ Welcome <%= projectName %> 👋
20
+ </h1>
21
+ <%_ } _%>
22
+ </div>
23
+ );
24
+ }
25
+ }
26
+ <%_ } else { _%>
11
27
  export function App() {
12
- <% } %>
13
28
  return (
14
- <div>
15
- <% if (!minimal) { %>
16
- <NxWelcome title="<%= projectName %>"/>
17
- <% } else { %>
29
+ <div>
30
+ <%_ if (!minimal) { _%>
31
+ <NxWelcome title="<%= projectName %>"/>
32
+ <%_ } else { _%>
18
33
  <h1>
19
34
  <span> Hello there, </span>
20
35
  Welcome <%= projectName %> 👋
21
36
  </h1>
22
- <% } %>
23
- </div>);
24
- <% if (classComponent) { %>
25
- }
26
- }
27
- <% } else { %>
37
+ <%_ } _%>
38
+ </div>
39
+ );
28
40
  }
29
- <% } %>
41
+ <%_ } _%>
30
42
 
31
43
  export default App;
32
44
 
@@ -2,19 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAppTests = getAppTests;
4
4
  function getAppTests(options) {
5
- return `
6
- it('should render successfully', () => {
7
- ${options.routing
5
+ return `it('should render successfully', () => {
6
+ ${options.routing
8
7
  ? 'const { baseElement } = render(<BrowserRouter><App /></BrowserRouter>);'
9
8
  : 'const { baseElement } = render(<App />);'}
10
- expect(baseElement).toBeTruthy();
11
- });
9
+ expect(baseElement).toBeTruthy();
10
+ });
12
11
 
13
- it('should have a greeting as the title', () => {
14
- ${options.routing
12
+ it('should have a greeting as the title', () => {
13
+ ${options.routing
15
14
  ? 'const { getByText } = render(<BrowserRouter><App /></BrowserRouter>);'
16
15
  : 'const { getByText } = render(<App />);'}
17
- expect(getByText(/Welcome ${options.projectName}/gi)).toBeTruthy();
18
- });
16
+ expect(getByText(/Welcome ${options.projectName}/gi)).toBeTruthy();
17
+ });
19
18
  `;
20
19
  }