@nx/react 0.0.0-pr-31222-862e973 → 0.0.0-pr-31313-387cdca
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/LICENSE +1 -1
- package/README.md +1 -1
- package/generators.json +9 -13
- package/index.d.ts +1 -2
- package/index.js +2 -5
- package/mf/dynamic-federation.d.ts +64 -0
- package/mf/dynamic-federation.js +64 -0
- package/migrations.json +80 -148
- package/module-federation.d.ts +6 -4
- package/module-federation.js +16 -7
- package/package.json +11 -11
- package/plugins/bundle-rollup.js +4 -1
- package/plugins/component-testing/index.js +1 -1
- package/plugins/jest.js +6 -11
- package/plugins/nx-react-webpack-plugin/lib/apply-react-config.js +6 -22
- package/plugins/storybook/index.js +1 -2
- package/plugins/with-react.d.ts +4 -0
- package/router-plugin.d.ts +1 -0
- package/router-plugin.js +5 -0
- package/src/executors/module-federation-dev-server/lib/index.d.ts +2 -0
- package/src/executors/module-federation-dev-server/lib/index.js +5 -0
- package/src/executors/module-federation-dev-server/lib/normalize-options.d.ts +4 -0
- package/src/executors/module-federation-dev-server/lib/normalize-options.js +19 -0
- package/src/executors/module-federation-dev-server/lib/start-remotes.d.ts +5 -0
- package/src/executors/module-federation-dev-server/lib/start-remotes.js +33 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +1 -1
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +6 -110
- package/src/executors/module-federation-dev-server/schema.d.ts +9 -7
- package/src/executors/module-federation-dev-server/schema.json +15 -10
- package/src/executors/module-federation-ssr-dev-server/lib/index.d.ts +2 -0
- package/src/executors/module-federation-ssr-dev-server/lib/index.js +5 -0
- package/src/executors/module-federation-ssr-dev-server/lib/normalize-options.d.ts +4 -0
- package/src/executors/module-federation-ssr-dev-server/lib/normalize-options.js +23 -0
- package/src/executors/module-federation-ssr-dev-server/lib/start-remotes.d.ts +5 -0
- package/src/executors/module-federation-ssr-dev-server/lib/start-remotes.js +34 -0
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +1 -17
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +5 -153
- package/src/executors/module-federation-ssr-dev-server/schema.d.ts +29 -0
- package/src/executors/module-federation-ssr-dev-server/schema.json +14 -9
- package/src/executors/module-federation-static-server/module-federation-static-server.impl.d.ts +2 -2
- package/src/executors/module-federation-static-server/module-federation-static-server.impl.js +11 -12
- package/src/executors/module-federation-static-server/schema.json +2 -1
- package/src/generators/application/application.d.ts +3 -3
- package/src/generators/application/application.js +108 -186
- package/src/generators/application/files/base-rsbuild/src/app/__fileName__.spec.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-rsbuild/src/assets/.gitkeep +0 -0
- package/src/generators/application/files/base-rsbuild/src/favicon.ico +0 -0
- package/src/generators/application/files/base-rsbuild/src/index.html +14 -0
- package/src/generators/application/files/base-rsbuild/src/main.tsx__tmpl__ +32 -0
- package/src/generators/application/files/base-rsbuild/tsconfig.app.json__tmpl__ +31 -0
- package/src/generators/application/files/base-rspack/rspack.config.js__tmpl__ +53 -0
- package/src/generators/application/files/base-rspack/src/app/__fileName__.spec.tsx__tmpl__ +3 -3
- package/src/generators/application/files/base-rspack/src/main.tsx__tmpl__ +27 -5
- package/src/generators/application/files/base-rspack/tsconfig.app.json__tmpl__ +21 -4
- package/src/generators/application/files/base-vite/src/app/__fileName__.spec.tsx__tmpl__ +3 -3
- package/src/generators/application/files/base-vite/src/main.tsx__tmpl__ +31 -6
- package/src/generators/application/files/base-vite/tsconfig.app.json__tmpl__ +20 -3
- package/src/generators/application/files/base-webpack/src/app/__fileName__.spec.tsx__tmpl__ +3 -3
- package/src/generators/application/files/base-webpack/src/main.tsx__tmpl__ +22 -2
- package/src/generators/application/files/base-webpack/tsconfig.app.json__tmpl__ +21 -4
- package/src/generators/application/files/base-webpack/webpack.config.js__tmpl__ +4 -4
- package/src/generators/application/files/react-router-ssr/common/app/app-nav.tsx__tmpl__ +14 -0
- package/src/generators/application/files/react-router-ssr/common/app/entry.client.tsx__tmpl__ +18 -0
- package/src/generators/application/files/react-router-ssr/common/app/entry.server.tsx__tmpl__ +74 -0
- package/src/generators/application/files/react-router-ssr/common/app/root.tsx__tmpl__ +51 -0
- package/src/generators/application/files/react-router-ssr/common/app/routes/about.tsx__tmpl__ +7 -0
- package/src/generators/application/files/react-router-ssr/common/app/routes.tsx__tmpl__ +6 -0
- package/src/generators/application/files/react-router-ssr/common/public/favicon.ico +0 -0
- package/src/generators/application/files/react-router-ssr/common/react-router.config.ts__tmpl__ +5 -0
- package/src/generators/application/files/react-router-ssr/common/tests/routes/_index.spec.tsx__tmpl__ +16 -0
- package/src/generators/application/files/react-router-ssr/common/tsconfig.app.json__tmpl__ +23 -0
- package/src/generators/application/files/react-router-ssr/common/tsconfig.json__tmpl__ +27 -0
- package/src/generators/application/files/react-router-ssr/non-root/.gitignore__tmpl__ +5 -0
- package/src/generators/application/files/react-router-ssr/non-root/package.json__tmpl__ +21 -0
- package/src/generators/application/files/react-router-ssr/nx-welcome/claimed/app/nx-welcome.tsx__tmpl__ +866 -0
- package/src/generators/application/files/react-router-ssr/nx-welcome/not-configured/app/nx-welcome.tsx__tmpl__ +866 -0
- package/src/generators/application/files/react-router-ssr/nx-welcome/unclaimed/app/nx-welcome.tsx__tmpl__ +864 -0
- package/src/generators/application/files/react-router-ssr/ts-solution/package.json__tmpl__ +21 -0
- package/src/generators/application/files/react-router-ssr/ts-solution/tsconfig.app.json__tmpl__ +39 -0
- package/src/generators/application/files/style-css-module/src/app/__fileName__.tsx__tmpl__ +28 -18
- package/src/generators/application/files/style-global-css/src/app/__fileName__.tsx__tmpl__ +29 -20
- package/src/generators/application/files/style-none/src/app/__fileName__.tsx__tmpl__ +26 -16
- package/src/generators/application/files/style-styled-jsx/src/app/__fileName__.tsx__tmpl__ +31 -22
- package/src/generators/application/files/style-styled-module/src/app/__fileName__.tsx__tmpl__ +30 -21
- package/src/generators/application/files/style-tailwind/src/app/__fileName__.tsx__tmpl__ +29 -19
- package/src/generators/application/lib/add-e2e.d.ts +1 -1
- package/src/generators/application/lib/add-e2e.js +74 -65
- package/src/generators/application/lib/add-jest.js +27 -2
- package/src/generators/application/lib/add-linting.d.ts +4 -0
- package/src/generators/application/lib/add-linting.js +86 -0
- package/src/generators/application/lib/add-project.js +112 -6
- package/src/generators/application/lib/add-routing.js +1 -1
- package/src/generators/application/lib/bundlers/add-rsbuild.d.ts +4 -0
- package/src/generators/application/lib/bundlers/add-rsbuild.js +63 -0
- package/src/generators/application/lib/bundlers/add-rspack.d.ts +4 -0
- package/src/generators/application/lib/bundlers/add-rspack.js +37 -0
- package/src/generators/application/lib/bundlers/add-vite.d.ts +4 -0
- package/src/generators/application/lib/bundlers/add-vite.js +76 -0
- package/src/generators/application/lib/bundlers/add-webpack.d.ts +3 -0
- package/src/generators/application/lib/bundlers/add-webpack.js +18 -0
- package/src/generators/application/lib/create-application-files.d.ts +61 -0
- package/src/generators/application/lib/create-application-files.js +102 -19
- package/src/generators/application/lib/get-app-tests.js +10 -11
- package/src/generators/application/lib/install-common-dependencies.d.ts +1 -1
- package/src/generators/application/lib/install-common-dependencies.js +18 -4
- package/src/generators/application/lib/normalize-options.d.ts +1 -3
- package/src/generators/application/lib/normalize-options.js +17 -19
- package/src/generators/application/lib/update-jest-config.js +5 -0
- package/src/generators/application/schema.d.ts +12 -6
- package/src/generators/application/schema.json +44 -42
- package/src/generators/component/component.d.ts +0 -1
- package/src/generators/component/component.js +19 -37
- package/src/generators/component/files/__fileName__.__ext__ +83 -0
- package/src/generators/component/lib/normalize-options.js +13 -15
- package/src/generators/component/schema.d.ts +13 -25
- package/src/generators/component/schema.json +13 -49
- package/src/generators/component-story/component-story.js +1 -2
- package/src/generators/component-story/files/jsx/__componentFileName__.stories.jsx__tmpl__ +5 -5
- package/src/generators/component-story/files/tsx/__componentFileName__.stories.tsx__tmpl__ +3 -4
- package/src/generators/component-test/component-test.js +1 -1
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +0 -2
- package/src/generators/cypress-component-configuration/lib/add-files.d.ts +1 -1
- package/src/generators/cypress-component-configuration/lib/add-files.js +7 -4
- package/src/generators/federate-module/federate-module.js +12 -22
- package/src/generators/federate-module/schema.d.ts +0 -1
- package/src/generators/federate-module/schema.json +13 -12
- package/src/generators/hook/files/{__fileName__.ts__tmpl__ → __fileName__.__ext__} +3 -1
- package/src/generators/hook/hook.d.ts +0 -1
- package/src/generators/hook/hook.js +35 -83
- package/src/generators/hook/schema.d.ts +4 -17
- package/src/generators/hook/schema.json +19 -46
- package/src/generators/host/files/common/src/app/__fileName__.js__tmpl__ +28 -21
- package/src/generators/host/files/common/src/main.js__tmpl__ +12 -9
- package/src/generators/host/files/common-ts/src/app/__fileName__.tsx__tmpl__ +28 -28
- package/src/generators/host/files/common-ts/src/main.ts__tmpl__ +12 -9
- package/src/generators/host/files/rspack-common/src/app/__fileName__.jsx__tmpl__ +22 -13
- package/src/generators/host/files/rspack-common/src/main.jsx__tmpl__ +12 -9
- package/src/generators/host/files/rspack-module-federation/module-federation.config.js__tmpl__ +8 -5
- package/src/generators/host/files/rspack-module-federation/rspack.config.js__tmpl__ +37 -13
- package/src/generators/host/files/rspack-module-federation/rspack.config.prod.js__tmpl__ +60 -30
- package/src/generators/host/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +16 -5
- package/src/generators/host/files/rspack-module-federation-ssr/rspack.config.js__tmpl__ +66 -0
- package/src/generators/host/files/rspack-module-federation-ssr/server.ts__tmpl__ +1 -1
- package/src/generators/host/files/rspack-module-federation-ssr/src/main.server.tsx__tmpl__ +49 -0
- package/src/generators/host/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +16 -7
- package/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +66 -0
- package/src/generators/host/files/rspack-module-federation-ssr-ts/server.ts__tmpl__ +1 -1
- package/src/generators/host/files/rspack-module-federation-ssr-ts/src/main.server.tsx__tmpl__ +49 -0
- package/src/generators/host/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +22 -19
- package/src/generators/host/files/rspack-module-federation-ts/rspack.config.prod.ts__tmpl__ +61 -30
- package/src/generators/host/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +37 -13
- package/src/generators/host/files/webpack-module-federation/module-federation.config.js__tmpl__ +8 -5
- package/src/generators/host/files/webpack-module-federation/webpack.config.js__tmpl__ +1 -1
- package/src/generators/host/files/webpack-module-federation/webpack.config.prod.js__tmpl__ +24 -22
- package/src/generators/host/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ +10 -7
- package/src/generators/host/files/webpack-module-federation-ssr/webpack.server.config.js__tmpl__ +2 -2
- package/src/generators/host/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +10 -7
- package/src/generators/host/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +2 -2
- package/src/generators/host/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +22 -19
- package/src/generators/host/files/webpack-module-federation-ts/webpack.config.prod.ts__tmpl__ +25 -23
- package/src/generators/host/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +4 -3
- package/src/generators/host/host.d.ts +0 -1
- package/src/generators/host/host.js +31 -27
- package/src/generators/host/lib/add-module-federation-files.js +29 -13
- package/src/generators/host/lib/normalize-host-name.d.ts +2 -0
- package/src/generators/host/lib/normalize-host-name.js +12 -0
- package/src/generators/host/lib/normalize-remote.js +10 -6
- package/src/generators/host/lib/setup-ssr-for-host.d.ts +3 -3
- package/src/generators/host/lib/setup-ssr-for-host.js +46 -22
- package/src/generators/host/lib/update-module-federation-tsconfig.d.ts +3 -0
- package/src/generators/host/lib/update-module-federation-tsconfig.js +39 -0
- package/src/generators/host/schema.d.ts +2 -5
- package/src/generators/host/schema.json +16 -27
- package/src/generators/init/init.d.ts +1 -1
- package/src/generators/init/init.js +31 -6
- package/src/generators/init/schema.d.ts +2 -0
- package/src/generators/library/files/common/tsconfig.lib.json__tmpl__ +1 -1
- package/src/generators/library/files/vite/tsconfig.lib.json__tmpl__ +1 -1
- package/src/generators/library/lib/add-linting.js +1 -1
- package/src/generators/library/lib/add-rollup-build-target.d.ts +3 -1
- package/src/generators/library/lib/add-rollup-build-target.js +34 -32
- package/src/generators/library/lib/create-files.d.ts +1 -1
- package/src/generators/library/lib/create-files.js +23 -2
- package/src/generators/library/lib/determine-entry-fields.d.ts +3 -0
- package/src/generators/library/lib/determine-entry-fields.js +22 -0
- package/src/generators/library/lib/install-common-dependencies.d.ts +1 -1
- package/src/generators/library/lib/install-common-dependencies.js +5 -3
- package/src/generators/library/lib/normalize-options.js +11 -6
- package/src/generators/library/library.js +80 -35
- package/src/generators/library/schema.d.ts +5 -5
- package/src/generators/library/schema.json +38 -36
- package/src/generators/redux/files/js/__fileName__.__ext__ +114 -0
- package/src/generators/redux/files/{__fileName__.slice.spec.ts__tmpl__ → js/__fileName__.spec.__ext__} +1 -1
- package/src/generators/redux/files/ts/__fileName__.spec.__ext__ +56 -0
- package/src/generators/redux/redux.d.ts +0 -1
- package/src/generators/redux/redux.js +27 -36
- package/src/generators/redux/schema.d.ts +12 -8
- package/src/generators/redux/schema.json +21 -23
- package/src/generators/remote/files/rspack-module-federation/module-federation.config.js__tmpl__ +10 -7
- package/src/generators/remote/files/rspack-module-federation/rspack.config.js__tmpl__ +40 -13
- package/src/generators/remote/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +13 -4
- package/src/generators/remote/files/rspack-module-federation-ssr/rspack.config.js__tmpl__ +69 -0
- package/src/generators/remote/files/rspack-module-federation-ssr/server.ts__tmpl__ +2 -2
- package/src/generators/remote/files/rspack-module-federation-ssr/src/main.server.tsx__tmpl__ +45 -0
- package/src/generators/remote/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +13 -4
- package/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +69 -0
- package/src/generators/remote/files/rspack-module-federation-ssr-ts/server.ts__tmpl__ +2 -2
- package/src/generators/remote/files/rspack-module-federation-ssr-ts/src/main.server.tsx__tmpl__ +45 -0
- package/src/generators/remote/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +11 -8
- package/src/generators/remote/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +40 -13
- package/src/generators/remote/files/webpack-module-federation/module-federation.config.js__tmpl__ +10 -7
- package/src/generators/remote/files/webpack-module-federation/webpack.config.js__tmpl__ +1 -1
- package/src/generators/remote/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ +7 -4
- package/src/generators/remote/files/webpack-module-federation-ssr/webpack.server.config.js__tmpl__ +2 -2
- package/src/generators/remote/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +8 -5
- package/src/generators/remote/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +2 -2
- package/src/generators/remote/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +11 -8
- package/src/generators/remote/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +2 -2
- package/src/generators/remote/lib/setup-ssr-for-remote.d.ts +1 -1
- package/src/generators/remote/lib/setup-ssr-for-remote.js +37 -15
- package/src/generators/remote/lib/setup-tspath-for-remote.js +1 -3
- package/src/generators/remote/lib/update-host-with-remote.js +2 -2
- package/src/generators/remote/remote.d.ts +0 -1
- package/src/generators/remote/remote.js +57 -33
- package/src/generators/remote/schema.d.ts +2 -5
- package/src/generators/remote/schema.json +16 -27
- package/src/generators/setup-tailwind/lib/update-project.js +1 -2
- package/src/generators/stories/schema.json +0 -10
- package/src/generators/stories/stories.d.ts +1 -3
- package/src/generators/stories/stories.js +9 -20
- package/src/generators/storybook-configuration/configuration.js +2 -11
- package/src/generators/storybook-configuration/schema.d.ts +0 -3
- package/src/generators/storybook-configuration/schema.json +0 -15
- package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.js +11 -6
- package/src/migrations/update-20-2-0/migrate-mf-imports-to-new-package.d.ts +2 -0
- package/src/migrations/update-20-2-0/migrate-mf-imports-to-new-package.js +66 -0
- package/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.d.ts +2 -0
- package/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.js +41 -0
- package/src/migrations/update-20-3-0/ensure-nx-module-federation-package.d.ts +2 -0
- package/src/migrations/update-20-3-0/ensure-nx-module-federation-package.js +18 -0
- package/src/migrations/update-21-0-0/update-babel-loose.d.ts +2 -0
- package/src/migrations/update-21-0-0/update-babel-loose.js +30 -0
- package/src/plugins/router-plugin.d.ts +10 -0
- package/src/plugins/router-plugin.js +221 -0
- package/src/rules/update-module-federation-project.d.ts +2 -1
- package/src/rules/update-module-federation-project.js +37 -48
- package/src/utils/add-mf-env-to-inputs.d.ts +1 -1
- package/src/utils/add-mf-env-to-inputs.js +8 -11
- package/src/utils/assertion.d.ts +2 -0
- package/src/utils/assertion.js +6 -0
- package/src/utils/ast-utils.d.ts +1 -1
- package/src/utils/ast-utils.js +2 -2
- package/src/utils/create-ts-config.js +57 -7
- package/src/utils/ct-utils.d.ts +1 -1
- package/src/utils/ct-utils.js +2 -7
- package/src/utils/has-rsbuild-plugin.d.ts +2 -0
- package/src/utils/has-rsbuild-plugin.js +10 -0
- package/src/utils/has-rspack-plugin.d.ts +2 -0
- package/src/utils/has-rspack-plugin.js +10 -0
- package/src/utils/testing-generators.js +2 -4
- package/src/utils/version-utils.d.ts +14 -0
- package/src/utils/version-utils.js +56 -0
- package/src/utils/versions.d.ts +25 -17
- package/src/utils/versions.js +28 -19
- package/src/generators/component/files/__fileName__.tsx__tmpl__ +0 -84
- package/src/generators/component-cypress-spec/component-cypress-spec.d.ts +0 -13
- package/src/generators/component-cypress-spec/component-cypress-spec.js +0 -104
- package/src/generators/component-cypress-spec/files/__componentName__.__fileExt__ +0 -13
- package/src/generators/component-cypress-spec/schema.json +0 -45
- package/src/generators/host/files/rspack-module-federation-ssr/rspack.server.config.js__tmpl__ +0 -16
- package/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.server.config.ts__tmpl__ +0 -16
- package/src/generators/library/files/common/package.json__tmpl__ +0 -4
- package/src/generators/library/files/vite/package.json__tmpl__ +0 -12
- package/src/generators/remote/files/rspack-module-federation-ssr/rspack.server.config.js__tmpl__ +0 -16
- package/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.server.config.ts__tmpl__ +0 -16
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +0 -2
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -9
- package/src/migrations/update-16-2-0-remove-package/update-16-2-0-remove-package.d.ts +0 -2
- package/src/migrations/update-16-2-0-remove-package/update-16-2-0-remove-package.js +0 -8
- package/src/migrations/update-16-3-0/remove-types-react-router-dom-package.d.ts +0 -2
- package/src/migrations/update-16-3-0/remove-types-react-router-dom-package.js +0 -8
- package/src/migrations/update-16-7-0/add-babel-core.d.ts +0 -2
- package/src/migrations/update-16-7-0/add-babel-core.js +0 -14
- package/src/migrations/update-16-7-0-add-typings/update-16-7-0-add-typings.d.ts +0 -2
- package/src/migrations/update-16-7-0-add-typings/update-16-7-0-add-typings.js +0 -57
- package/src/migrations/update-18-1-1/fix-target-defaults-inputs.d.ts +0 -2
- package/src/migrations/update-18-1-1/fix-target-defaults-inputs.js +0 -53
- package/src/module-federation/load-config.d.ts +0 -3
- package/src/module-federation/load-config.js +0 -15
- package/src/module-federation/models.d.ts +0 -24
- package/src/module-federation/models.js +0 -2
- package/src/module-federation/package-json.d.ts +0 -8
- package/src/module-federation/package-json.js +0 -12
- package/src/module-federation/utils.d.ts +0 -12
- package/src/module-federation/utils.js +0 -75
- package/src/module-federation/with-module-federation-ssr.d.ts +0 -2
- package/src/module-federation/with-module-federation-ssr.js +0 -50
- package/src/module-federation/with-module-federation.d.ts +0 -7
- package/src/module-federation/with-module-federation.js +0 -63
- package/src/utils/build-static.remotes.d.ts +0 -4
- package/src/utils/build-static.remotes.js +0 -65
- package/src/utils/format-file.d.ts +0 -1
- package/src/utils/format-file.js +0 -11
- /package/src/generators/component/files/{__fileName__.spec.tsx__tmpl__ → __fileName__.spec.__ext__} +0 -0
- /package/src/generators/hook/files/{__fileName__.spec.tsx__tmpl__ → __fileName__.spec.__specExt__} +0 -0
- /package/src/generators/redux/files/{__fileName__.slice.ts__tmpl__ → ts/__fileName__.__ext__} +0 -0
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.applicationGenerator = applicationGenerator;
|
|
4
4
|
exports.applicationGeneratorInternal = applicationGeneratorInternal;
|
|
5
|
-
const
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const js_1 = require("@nx/js");
|
|
7
|
+
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
8
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
9
|
+
const create_ts_config_1 = require("../../utils/create-ts-config");
|
|
10
|
+
const add_styled_dependencies_1 = require("../../rules/add-styled-dependencies");
|
|
11
|
+
const setup_tailwind_1 = require("../setup-tailwind/setup-tailwind");
|
|
12
|
+
const init_1 = require("../init/init");
|
|
6
13
|
const create_application_files_1 = require("./lib/create-application-files");
|
|
7
14
|
const update_jest_config_1 = require("./lib/update-jest-config");
|
|
8
15
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
@@ -10,85 +17,63 @@ const add_project_1 = require("./lib/add-project");
|
|
|
10
17
|
const add_jest_1 = require("./lib/add-jest");
|
|
11
18
|
const add_routing_1 = require("./lib/add-routing");
|
|
12
19
|
const set_defaults_1 = require("./lib/set-defaults");
|
|
13
|
-
const
|
|
14
|
-
const devkit_1 = require("@nx/devkit");
|
|
15
|
-
const init_1 = require("../init/init");
|
|
16
|
-
const eslint_1 = require("@nx/eslint");
|
|
17
|
-
const versions_1 = require("../../utils/versions");
|
|
18
|
-
const maybe_js_1 = require("../../utils/maybe-js");
|
|
19
|
-
const install_common_dependencies_1 = require("./lib/install-common-dependencies");
|
|
20
|
-
const create_ts_config_1 = require("../../utils/create-ts-config");
|
|
21
|
-
const add_swc_dependencies_1 = require("@nx/js/src/utils/swc/add-swc-dependencies");
|
|
22
|
-
const pc = require("picocolors");
|
|
23
|
-
const show_possible_warnings_1 = require("./lib/show-possible-warnings");
|
|
20
|
+
const add_linting_1 = require("./lib/add-linting");
|
|
24
21
|
const add_e2e_1 = require("./lib/add-e2e");
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
project: options.projectName,
|
|
36
|
-
tsConfigPaths: [
|
|
37
|
-
(0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
|
|
38
|
-
],
|
|
39
|
-
unitTestRunner: options.unitTestRunner,
|
|
40
|
-
skipFormat: true,
|
|
41
|
-
rootProject: options.rootProject,
|
|
42
|
-
skipPackageJson: options.skipPackageJson,
|
|
43
|
-
addPlugin: options.addPlugin,
|
|
44
|
-
});
|
|
45
|
-
tasks.push(lintTask);
|
|
46
|
-
if ((0, eslint_file_1.isEslintConfigSupported)(host)) {
|
|
47
|
-
if ((0, flat_config_1.useFlatConfig)(host)) {
|
|
48
|
-
(0, eslint_file_1.addPredefinedConfigToFlatLintConfig)(host, options.appProjectRoot, 'flat/react');
|
|
49
|
-
// Add an empty rules object to users know how to add/override rules
|
|
50
|
-
(0, eslint_file_1.addOverrideToLintConfig)(host, options.appProjectRoot, {
|
|
51
|
-
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
|
|
52
|
-
rules: {},
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
const addExtendsTask = (0, eslint_file_1.addExtendsToLintConfig)(host, options.appProjectRoot, { name: 'plugin:@nx/react', needCompatFixup: true });
|
|
57
|
-
tasks.push(addExtendsTask);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (!options.skipPackageJson) {
|
|
61
|
-
const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies, lint_1.extraEslintDependencies.devDependencies);
|
|
62
|
-
const addSwcTask = (0, add_swc_dependencies_1.addSwcDependencies)(host);
|
|
63
|
-
tasks.push(installTask, addSwcTask);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
67
|
-
}
|
|
68
|
-
async function applicationGenerator(host, schema) {
|
|
69
|
-
return await applicationGeneratorInternal(host, {
|
|
22
|
+
const show_possible_warnings_1 = require("./lib/show-possible-warnings");
|
|
23
|
+
const install_common_dependencies_1 = require("./lib/install-common-dependencies");
|
|
24
|
+
const add_webpack_1 = require("./lib/bundlers/add-webpack");
|
|
25
|
+
const add_rspack_1 = require("./lib/bundlers/add-rspack");
|
|
26
|
+
const add_rsbuild_1 = require("./lib/bundlers/add-rsbuild");
|
|
27
|
+
const add_vite_1 = require("./lib/bundlers/add-vite");
|
|
28
|
+
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
29
|
+
const prompt_1 = require("@nx/devkit/src/generators/prompt");
|
|
30
|
+
async function applicationGenerator(tree, schema) {
|
|
31
|
+
return await applicationGeneratorInternal(tree, {
|
|
70
32
|
addPlugin: false,
|
|
71
|
-
|
|
33
|
+
useProjectJson: true,
|
|
72
34
|
...schema,
|
|
73
35
|
});
|
|
74
36
|
}
|
|
75
|
-
async function applicationGeneratorInternal(
|
|
37
|
+
async function applicationGeneratorInternal(tree, schema) {
|
|
76
38
|
const tasks = [];
|
|
77
|
-
const
|
|
78
|
-
(0, show_possible_warnings_1.showPossibleWarnings)(host, options);
|
|
79
|
-
const jsInitTask = await (0, js_1.initGenerator)(host, {
|
|
39
|
+
const jsInitTask = await (0, js_1.initGenerator)(tree, {
|
|
80
40
|
...schema,
|
|
81
41
|
tsConfigName: schema.rootProject ? 'tsconfig.json' : 'tsconfig.base.json',
|
|
82
42
|
skipFormat: true,
|
|
43
|
+
addTsPlugin: schema.useTsSolution,
|
|
44
|
+
formatter: schema.formatter,
|
|
45
|
+
platform: 'web',
|
|
83
46
|
});
|
|
84
47
|
tasks.push(jsInitTask);
|
|
85
|
-
const
|
|
48
|
+
const options = await (0, normalize_options_1.normalizeOptions)(tree, schema);
|
|
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;
|
|
69
|
+
(0, show_possible_warnings_1.showPossibleWarnings)(tree, options);
|
|
70
|
+
const initTask = await (0, init_1.default)(tree, {
|
|
86
71
|
...options,
|
|
87
72
|
skipFormat: true,
|
|
88
73
|
});
|
|
89
74
|
tasks.push(initTask);
|
|
90
75
|
if (!options.addPlugin) {
|
|
91
|
-
const nxJson = (0, devkit_1.readNxJson)(
|
|
76
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
92
77
|
nxJson.targetDefaults ??= {};
|
|
93
78
|
if (!Object.keys(nxJson.targetDefaults).includes('build')) {
|
|
94
79
|
nxJson.targetDefaults.build = {
|
|
@@ -99,157 +84,94 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
99
84
|
else if (!nxJson.targetDefaults.build.dependsOn) {
|
|
100
85
|
nxJson.targetDefaults.build.dependsOn = ['^build'];
|
|
101
86
|
}
|
|
102
|
-
(0, devkit_1.updateNxJson)(
|
|
87
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
103
88
|
}
|
|
104
89
|
if (options.bundler === 'webpack') {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (!options.skipPackageJson) {
|
|
113
|
-
const { ensureDependencies } = await Promise.resolve().then(() => require('@nx/webpack/src/utils/ensure-dependencies'));
|
|
114
|
-
tasks.push(ensureDependencies(host, { uiFramework: 'react' }));
|
|
115
|
-
}
|
|
90
|
+
await (0, add_webpack_1.initWebpack)(tree, options, tasks);
|
|
91
|
+
}
|
|
92
|
+
else if (options.bundler === 'rspack') {
|
|
93
|
+
await (0, add_rspack_1.initRspack)(tree, options, tasks);
|
|
94
|
+
}
|
|
95
|
+
else if (options.bundler === 'rsbuild') {
|
|
96
|
+
await (0, add_rsbuild_1.initRsbuild)(tree, options, tasks);
|
|
116
97
|
}
|
|
117
98
|
if (!options.rootProject) {
|
|
118
|
-
(0, create_ts_config_1.extractTsConfigBase)(
|
|
99
|
+
(0, create_ts_config_1.extractTsConfigBase)(tree);
|
|
100
|
+
}
|
|
101
|
+
await (0, create_application_files_1.createApplicationFiles)(tree, options);
|
|
102
|
+
(0, add_project_1.addProject)(tree, options);
|
|
103
|
+
// If we are using the new TS solution
|
|
104
|
+
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
105
|
+
if (options.isUsingTsSolutionConfig) {
|
|
106
|
+
await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
|
|
119
107
|
}
|
|
120
|
-
await (0, create_application_files_1.createApplicationFiles)(host, options);
|
|
121
|
-
(0, add_project_1.addProject)(host, options);
|
|
122
108
|
if (options.style === 'tailwind') {
|
|
123
|
-
const twTask = await (0, setup_tailwind_1.setupTailwindGenerator)(
|
|
109
|
+
const twTask = await (0, setup_tailwind_1.setupTailwindGenerator)(tree, {
|
|
124
110
|
project: options.projectName,
|
|
125
111
|
});
|
|
126
112
|
tasks.push(twTask);
|
|
127
113
|
}
|
|
114
|
+
const lintTask = await (0, add_linting_1.addLinting)(tree, options);
|
|
115
|
+
tasks.push(lintTask);
|
|
128
116
|
if (options.bundler === 'vite') {
|
|
129
|
-
|
|
130
|
-
// We recommend users use `import.meta.env.MODE` and other variables in their code to differentiate between production and development.
|
|
131
|
-
// See: https://vitejs.dev/guide/env-and-mode.html
|
|
132
|
-
if (host.exists((0, devkit_1.joinPathFragments)(options.appProjectRoot, 'src/environments'))) {
|
|
133
|
-
host.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, 'src/environments'));
|
|
134
|
-
}
|
|
135
|
-
const viteTask = await viteConfigurationGenerator(host, {
|
|
136
|
-
uiFramework: 'react',
|
|
137
|
-
project: options.projectName,
|
|
138
|
-
newProject: true,
|
|
139
|
-
includeVitest: options.unitTestRunner === 'vitest',
|
|
140
|
-
inSourceTests: options.inSourceTests,
|
|
141
|
-
compiler: options.compiler,
|
|
142
|
-
skipFormat: true,
|
|
143
|
-
addPlugin: options.addPlugin,
|
|
144
|
-
});
|
|
145
|
-
tasks.push(viteTask);
|
|
146
|
-
createOrEditViteConfig(host, {
|
|
147
|
-
project: options.projectName,
|
|
148
|
-
includeLib: false,
|
|
149
|
-
includeVitest: options.unitTestRunner === 'vitest',
|
|
150
|
-
inSourceTests: options.inSourceTests,
|
|
151
|
-
rollupOptionsExternal: [
|
|
152
|
-
"'react'",
|
|
153
|
-
"'react-dom'",
|
|
154
|
-
"'react/jsx-runtime'",
|
|
155
|
-
],
|
|
156
|
-
imports: [
|
|
157
|
-
options.compiler === 'swc'
|
|
158
|
-
? `import react from '@vitejs/plugin-react-swc'`
|
|
159
|
-
: `import react from '@vitejs/plugin-react'`,
|
|
160
|
-
],
|
|
161
|
-
plugins: ['react()'],
|
|
162
|
-
}, false);
|
|
117
|
+
await (0, add_vite_1.setupViteConfiguration)(tree, options, tasks);
|
|
163
118
|
}
|
|
164
|
-
else if (options.bundler === '
|
|
165
|
-
|
|
166
|
-
const rspackTask = await configurationGenerator(host, {
|
|
167
|
-
project: options.projectName,
|
|
168
|
-
main: (0, devkit_1.joinPathFragments)(options.appProjectRoot, (0, maybe_js_1.maybeJs)({
|
|
169
|
-
js: options.js,
|
|
170
|
-
useJsx: true,
|
|
171
|
-
}, `src/main.tsx`)),
|
|
172
|
-
tsConfig: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
|
|
173
|
-
target: 'web',
|
|
174
|
-
newProject: true,
|
|
175
|
-
framework: 'react',
|
|
176
|
-
});
|
|
177
|
-
tasks.push(rspackTask);
|
|
119
|
+
else if (options.bundler === 'rsbuild') {
|
|
120
|
+
await (0, add_rsbuild_1.setupRsbuildConfiguration)(tree, options, tasks);
|
|
178
121
|
}
|
|
179
122
|
if (options.bundler !== 'vite' && options.unitTestRunner === 'vitest') {
|
|
180
|
-
|
|
181
|
-
const vitestTask = await vitestGenerator(host, {
|
|
182
|
-
uiFramework: 'react',
|
|
183
|
-
coverageProvider: 'v8',
|
|
184
|
-
project: options.projectName,
|
|
185
|
-
inSourceTests: options.inSourceTests,
|
|
186
|
-
skipFormat: true,
|
|
187
|
-
addPlugin: options.addPlugin,
|
|
188
|
-
});
|
|
189
|
-
tasks.push(vitestTask);
|
|
190
|
-
createOrEditViteConfig(host, {
|
|
191
|
-
project: options.projectName,
|
|
192
|
-
includeLib: false,
|
|
193
|
-
includeVitest: true,
|
|
194
|
-
inSourceTests: options.inSourceTests,
|
|
195
|
-
rollupOptionsExternal: [
|
|
196
|
-
"'react'",
|
|
197
|
-
"'react-dom'",
|
|
198
|
-
"'react/jsx-runtime'",
|
|
199
|
-
],
|
|
200
|
-
imports: [
|
|
201
|
-
options.compiler === 'swc'
|
|
202
|
-
? `import react from '@vitejs/plugin-react-swc'`
|
|
203
|
-
: `import react from '@vitejs/plugin-react'`,
|
|
204
|
-
],
|
|
205
|
-
plugins: ['react()'],
|
|
206
|
-
}, true);
|
|
123
|
+
await (0, add_vite_1.setupVitestConfiguration)(tree, options, tasks);
|
|
207
124
|
}
|
|
208
125
|
if ((options.bundler === 'vite' || options.unitTestRunner === 'vitest') &&
|
|
209
126
|
options.inSourceTests) {
|
|
210
|
-
|
|
127
|
+
tree.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, `src/app/${options.fileName}.spec.tsx`));
|
|
211
128
|
}
|
|
212
|
-
const
|
|
213
|
-
tasks.push(lintTask);
|
|
214
|
-
const e2eTask = await (0, add_e2e_1.addE2e)(host, options);
|
|
129
|
+
const e2eTask = await (0, add_e2e_1.addE2e)(tree, options);
|
|
215
130
|
tasks.push(e2eTask);
|
|
216
131
|
if (options.unitTestRunner === 'jest') {
|
|
217
|
-
const jestTask = await (0, add_jest_1.addJest)(
|
|
132
|
+
const jestTask = await (0, add_jest_1.addJest)(tree, options);
|
|
218
133
|
tasks.push(jestTask);
|
|
219
134
|
}
|
|
220
135
|
// Handle tsconfig.spec.json for jest or vitest
|
|
221
|
-
(0, update_jest_config_1.updateSpecConfig)(
|
|
222
|
-
const
|
|
223
|
-
tasks.push(
|
|
224
|
-
const styledTask = (0, add_styled_dependencies_1.addStyledModuleDependencies)(
|
|
136
|
+
(0, update_jest_config_1.updateSpecConfig)(tree, options);
|
|
137
|
+
const commonDependencyTask = await (0, install_common_dependencies_1.installCommonDependencies)(tree, options);
|
|
138
|
+
tasks.push(commonDependencyTask);
|
|
139
|
+
const styledTask = (0, add_styled_dependencies_1.addStyledModuleDependencies)(tree, options);
|
|
225
140
|
tasks.push(styledTask);
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
141
|
+
if (!options.useReactRouter) {
|
|
142
|
+
const routingTask = (0, add_routing_1.addRouting)(tree, options);
|
|
143
|
+
tasks.push(routingTask);
|
|
144
|
+
}
|
|
145
|
+
(0, set_defaults_1.setDefaults)(tree, options);
|
|
229
146
|
if (options.bundler === 'rspack' && options.style === 'styled-jsx') {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
147
|
+
(0, add_rspack_1.handleStyledJsxForRspack)(tasks, tree, options);
|
|
148
|
+
}
|
|
149
|
+
if (options.useReactRouter) {
|
|
150
|
+
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.json'), (json) => {
|
|
151
|
+
const types = new Set(json.compilerOptions?.types || []);
|
|
152
|
+
types.add('@react-router/node');
|
|
153
|
+
return {
|
|
154
|
+
...json,
|
|
155
|
+
compilerOptions: {
|
|
156
|
+
...json.compilerOptions,
|
|
157
|
+
jsx: 'react-jsx',
|
|
158
|
+
moduleResolution: 'bundler',
|
|
159
|
+
types: Array.from(types),
|
|
243
160
|
},
|
|
244
|
-
|
|
245
|
-
],
|
|
246
|
-
});
|
|
247
|
-
return config;
|
|
161
|
+
};
|
|
248
162
|
});
|
|
249
|
-
`);
|
|
250
163
|
}
|
|
164
|
+
// Only for the new TS solution
|
|
165
|
+
(0, ts_solution_setup_1.updateTsconfigFiles)(tree, options.appProjectRoot, 'tsconfig.app.json', {
|
|
166
|
+
jsx: 'react-jsx',
|
|
167
|
+
module: 'esnext',
|
|
168
|
+
moduleResolution: 'bundler',
|
|
169
|
+
}, options.linter === 'eslint'
|
|
170
|
+
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
171
|
+
: undefined, options.useReactRouter ? 'app' : 'src');
|
|
172
|
+
(0, sort_fields_1.sortPackageJsonFields)(tree, options.appProjectRoot);
|
|
251
173
|
if (!options.skipFormat) {
|
|
252
|
-
await (0, devkit_1.formatFiles)(
|
|
174
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
253
175
|
}
|
|
254
176
|
tasks.push(() => {
|
|
255
177
|
(0, log_show_project_command_1.logShowProjectCommand)(options.projectName);
|
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title><%= className %></title>
|
|
6
|
+
<base href="/" />
|
|
7
|
+
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
9
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<%_ if (strict) { _%>import { StrictMode } from 'react';<%_ } _%>
|
|
2
|
+
import * as ReactDOM from 'react-dom/client';
|
|
3
|
+
<%_ if (routing) { _%>import { BrowserRouter } from 'react-router-dom';<%_ } _%>
|
|
4
|
+
import App from './app/<%= fileName %>';
|
|
5
|
+
<%_ if(hasStyleFile) { _%>
|
|
6
|
+
import './styles.<%= style %>'
|
|
7
|
+
<%_ } _%>
|
|
8
|
+
|
|
9
|
+
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
|
|
10
|
+
<%_ if(strict && !routing) { _%>
|
|
11
|
+
root.render(
|
|
12
|
+
<StrictMode>
|
|
13
|
+
<App/>
|
|
14
|
+
</StrictMode>
|
|
15
|
+
)
|
|
16
|
+
<%_ } _%>
|
|
17
|
+
<%_ if(!strict && routing) { _%>
|
|
18
|
+
root.render(
|
|
19
|
+
<BrowserRouter>
|
|
20
|
+
<App/>
|
|
21
|
+
</BrowserRouter>
|
|
22
|
+
)
|
|
23
|
+
<%_ } _%>
|
|
24
|
+
<%_ if(strict && routing) { _%>
|
|
25
|
+
root.render(
|
|
26
|
+
<StrictMode>
|
|
27
|
+
<BrowserRouter>
|
|
28
|
+
<App/>
|
|
29
|
+
</BrowserRouter>
|
|
30
|
+
</StrictMode>
|
|
31
|
+
)
|
|
32
|
+
<%_ } _%>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<%_ if (isUsingTsSolutionSetup) { _%>{
|
|
2
|
+
"extends": "<%= offsetFromRoot%>tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "dist",
|
|
5
|
+
"tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
|
|
6
|
+
"jsx": "react-jsx",
|
|
7
|
+
"lib": ["dom"],
|
|
8
|
+
"types": [
|
|
9
|
+
"node",
|
|
10
|
+
<%_ if (style === 'styled-jsx') { _%>"@nx/react/typings/styled-jsx.d.ts",<%_ } _%>
|
|
11
|
+
"@nx/react/typings/cssmodule.d.ts",
|
|
12
|
+
"@nx/react/typings/image.d.ts"
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
"exclude": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.spec.tsx", "src/**/*.test.tsx", "src/**/*.spec.js", "src/**/*.test.js", "src/**/*.spec.jsx", "src/**/*.test.jsx"],
|
|
16
|
+
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
17
|
+
}<% } else { %>{
|
|
18
|
+
"extends": "./tsconfig.json",
|
|
19
|
+
"compilerOptions": {
|
|
20
|
+
"outDir": "<%= offsetFromRoot %>dist/out-tsc",
|
|
21
|
+
"types": [
|
|
22
|
+
"node",
|
|
23
|
+
<%_ if (style === 'styled-jsx') { _%>"@nx/react/typings/styled-jsx.d.ts",<%_ } _%>
|
|
24
|
+
"@nx/react/typings/cssmodule.d.ts",
|
|
25
|
+
"@nx/react/typings/image.d.ts"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"exclude": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.spec.tsx", "src/**/*.test.tsx", "src/**/*.spec.js", "src/**/*.test.js", "src/**/*.spec.jsx", "src/**/*.test.jsx"],
|
|
29
|
+
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
30
|
+
}
|
|
31
|
+
<% } %>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<%_ if (rspackPluginOptions) { _%>
|
|
2
|
+
const { NxAppRspackPlugin } = require('@nx/rspack/app-plugin');
|
|
3
|
+
const { NxReactRspackPlugin } = require('@nx/rspack/react-plugin');
|
|
4
|
+
const { join } = require('path');
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
output: {
|
|
8
|
+
path: join(__dirname, '<%= rspackPluginOptions.outputPath %>'),
|
|
9
|
+
},
|
|
10
|
+
devServer: {
|
|
11
|
+
port: 4200,
|
|
12
|
+
historyApiFallback: {
|
|
13
|
+
index: '/index.html',
|
|
14
|
+
disableDotRule: true,
|
|
15
|
+
htmlAcceptHeaders: ['text/html', 'application/xhtml+xml'],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
plugins: [
|
|
19
|
+
new NxAppRspackPlugin({
|
|
20
|
+
tsConfig: '<%= rspackPluginOptions.tsConfig %>',
|
|
21
|
+
main: '<%= rspackPluginOptions.main %>',
|
|
22
|
+
index: '<%= rspackPluginOptions.index %>',
|
|
23
|
+
baseHref: '<%= rspackPluginOptions.baseHref %>',
|
|
24
|
+
assets: <%- JSON.stringify(rspackPluginOptions.assets) %>,
|
|
25
|
+
styles: <%- JSON.stringify(rspackPluginOptions.styles) %>,
|
|
26
|
+
outputHashing: process.env['NODE_ENV'] === 'production' ? 'all' : 'none',
|
|
27
|
+
optimization: process.env['NODE_ENV'] === 'production',
|
|
28
|
+
}),
|
|
29
|
+
new NxReactRspackPlugin({
|
|
30
|
+
// Uncomment this line if you don't want to use SVGR
|
|
31
|
+
// See: https://react-svgr.com/
|
|
32
|
+
// svgr: false
|
|
33
|
+
}),
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
<%_ } else { _%>
|
|
37
|
+
const { composePlugins, withNx, withReact } = require('@nx/rspack');
|
|
38
|
+
|
|
39
|
+
// Nx plugins for rspack.
|
|
40
|
+
module.exports = composePlugins(
|
|
41
|
+
withNx(),
|
|
42
|
+
withReact({
|
|
43
|
+
// Uncomment this line if you don't want to use SVGR
|
|
44
|
+
// See: https://react-svgr.com/
|
|
45
|
+
// svgr: false
|
|
46
|
+
}),
|
|
47
|
+
(config) => {
|
|
48
|
+
// Update the rspack config as needed here.
|
|
49
|
+
// e.g. `config.plugins.push(new MyPlugin())`
|
|
50
|
+
return config;
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
<%_ } _%>
|
|
@@ -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,32 @@
|
|
|
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';<% } %>
|
|
4
|
-
|
|
3
|
+
<%_ if (routing) { _%>import { BrowserRouter } from 'react-router-dom';<%_ } _%>
|
|
5
4
|
import App from './app/<%= fileName %>';
|
|
5
|
+
<%_ if(hasStyleFile) { _%>
|
|
6
|
+
import './styles.<%= style %>'
|
|
7
|
+
<%_ } _%>
|
|
6
8
|
|
|
7
9
|
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
|
|
10
|
+
<%_ if(strict && !routing) { _%>
|
|
11
|
+
root.render(
|
|
12
|
+
<StrictMode>
|
|
13
|
+
<App/>
|
|
14
|
+
</StrictMode>
|
|
15
|
+
)
|
|
16
|
+
<%_ } _%>
|
|
17
|
+
<%_ if(!strict && routing) { _%>
|
|
18
|
+
root.render(
|
|
19
|
+
<BrowserRouter>
|
|
20
|
+
<App/>
|
|
21
|
+
</BrowserRouter>
|
|
22
|
+
)
|
|
23
|
+
<%_ } _%>
|
|
24
|
+
<%_ if(strict && routing) { _%>
|
|
8
25
|
root.render(
|
|
9
|
-
|
|
10
|
-
|
|
26
|
+
<StrictMode>
|
|
27
|
+
<BrowserRouter>
|
|
28
|
+
<App/>
|
|
29
|
+
</BrowserRouter>
|
|
30
|
+
</StrictMode>
|
|
31
|
+
)
|
|
32
|
+
<%_ } _%>
|
|
@@ -1,14 +1,31 @@
|
|
|
1
|
-
{
|
|
1
|
+
<%_ if (isUsingTsSolutionSetup) { _%>{
|
|
2
|
+
"extends": "<%= offsetFromRoot%>tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "dist",
|
|
5
|
+
"tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
|
|
6
|
+
"jsx": "react-jsx",
|
|
7
|
+
"lib": ["dom"],
|
|
8
|
+
"types": [
|
|
9
|
+
"node",
|
|
10
|
+
<%_ if (style === 'styled-jsx') { _%>"@nx/react/typings/styled-jsx.d.ts",<%_ } _%>
|
|
11
|
+
"@nx/react/typings/cssmodule.d.ts",
|
|
12
|
+
"@nx/react/typings/image.d.ts"
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
"exclude": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.spec.tsx", "src/**/*.test.tsx", "src/**/*.spec.js", "src/**/*.test.js", "src/**/*.spec.jsx", "src/**/*.test.jsx"],
|
|
16
|
+
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
17
|
+
}<% } else { %>{
|
|
2
18
|
"extends": "./tsconfig.json",
|
|
3
19
|
"compilerOptions": {
|
|
4
20
|
"outDir": "<%= offsetFromRoot %>dist/out-tsc",
|
|
5
21
|
"types": [
|
|
6
22
|
"node",
|
|
7
|
-
<% if (style === 'styled-jsx') { %>"@nx/react/typings/styled-jsx.d.ts",<% } %>
|
|
23
|
+
<%_ if (style === 'styled-jsx') { _%>"@nx/react/typings/styled-jsx.d.ts",<%_ } _%>
|
|
8
24
|
"@nx/react/typings/cssmodule.d.ts",
|
|
9
25
|
"@nx/react/typings/image.d.ts"
|
|
10
|
-
|
|
26
|
+
]
|
|
11
27
|
},
|
|
12
|
-
"exclude": ["
|
|
28
|
+
"exclude": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.spec.tsx", "src/**/*.test.tsx", "src/**/*.spec.js", "src/**/*.test.js", "src/**/*.spec.jsx", "src/**/*.test.jsx"],
|
|
13
29
|
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
14
30
|
}
|
|
31
|
+
<% } %>
|
|
@@ -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
|
});
|