@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
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultTemplateVariables = getDefaultTemplateVariables;
|
|
4
|
+
exports.createNxRspackPluginOptions = createNxRspackPluginOptions;
|
|
3
5
|
exports.createApplicationFiles = createApplicationFiles;
|
|
4
6
|
const devkit_1 = require("@nx/devkit");
|
|
5
7
|
const js_1 = require("@nx/js");
|
|
@@ -10,6 +12,55 @@ const maybe_js_1 = require("../../../utils/maybe-js");
|
|
|
10
12
|
const has_webpack_plugin_1 = require("../../../utils/has-webpack-plugin");
|
|
11
13
|
const get_app_tests_1 = require("./get-app-tests");
|
|
12
14
|
const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
|
|
15
|
+
const has_rspack_plugin_1 = require("../../../utils/has-rspack-plugin");
|
|
16
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
17
|
+
const versions_1 = require("../../../utils/versions");
|
|
18
|
+
function getDefaultTemplateVariables(host, options) {
|
|
19
|
+
const hasStyleFile = ['scss', 'css', 'less'].includes(options.style);
|
|
20
|
+
const appTests = (0, get_app_tests_1.getAppTests)(options);
|
|
21
|
+
return {
|
|
22
|
+
...options.names,
|
|
23
|
+
...options,
|
|
24
|
+
typesNodeVersion: versions_1.typesNodeVersion,
|
|
25
|
+
typesReactDomVersion: versions_1.typesReactDomVersion,
|
|
26
|
+
reactRouterVersion: versions_1.reactRouterVersion,
|
|
27
|
+
typesReactVersion: versions_1.typesReactVersion,
|
|
28
|
+
reactDomVersion: versions_1.reactDomVersion,
|
|
29
|
+
reactVersion: versions_1.reactVersion,
|
|
30
|
+
reactRouterIsBotVersion: versions_1.reactRouterIsBotVersion,
|
|
31
|
+
js: !!options.js, // Ensure this is defined in template
|
|
32
|
+
tmpl: '',
|
|
33
|
+
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.appProjectRoot),
|
|
34
|
+
appTests,
|
|
35
|
+
inSourceVitestTests: (0, get_in_source_vitest_tests_template_1.getInSourceVitestTestsTemplate)(appTests),
|
|
36
|
+
style: options.style === 'tailwind' ? 'css' : options.style,
|
|
37
|
+
hasStyleFile,
|
|
38
|
+
isUsingTsSolutionSetup: (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function createNxRspackPluginOptions(options, rootOffset, tsx = true) {
|
|
42
|
+
return {
|
|
43
|
+
target: 'web',
|
|
44
|
+
outputPath: options.isUsingTsSolutionConfig
|
|
45
|
+
? 'dist'
|
|
46
|
+
: (0, devkit_1.joinPathFragments)(rootOffset, 'dist', options.appProjectRoot != '.'
|
|
47
|
+
? options.appProjectRoot
|
|
48
|
+
: options.projectName),
|
|
49
|
+
index: './src/index.html',
|
|
50
|
+
baseHref: '/',
|
|
51
|
+
main: (0, maybe_js_1.maybeJs)({
|
|
52
|
+
js: options.js,
|
|
53
|
+
useJsx: true,
|
|
54
|
+
}, `./src/main.${tsx ? 'tsx' : 'ts'}`),
|
|
55
|
+
tsConfig: './tsconfig.app.json',
|
|
56
|
+
assets: ['./src/favicon.ico', './src/assets'],
|
|
57
|
+
styles: options.styledModule || !options.hasStyles
|
|
58
|
+
? []
|
|
59
|
+
: [
|
|
60
|
+
`./src/styles.${options.style !== 'tailwind' ? options.style : 'css'}`,
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
13
64
|
async function createApplicationFiles(host, options) {
|
|
14
65
|
let styleSolutionSpecificAppFiles;
|
|
15
66
|
if (options.styledModule && options.style !== 'styled-jsx') {
|
|
@@ -34,24 +85,18 @@ async function createApplicationFiles(host, options) {
|
|
|
34
85
|
const connectCloudUrl = onBoardingStatus === 'unclaimed' &&
|
|
35
86
|
(await (0, onboarding_1.getNxCloudAppOnBoardingUrl)(options.nxCloudToken));
|
|
36
87
|
const relativePathToRootTsConfig = (0, js_1.getRelativePathToRootTsConfig)(host, options.appProjectRoot);
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
...(0, devkit_1.names)(options.name),
|
|
40
|
-
...options,
|
|
41
|
-
js: !!options.js, // Ensure this is defined in template
|
|
42
|
-
tmpl: '',
|
|
43
|
-
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.appProjectRoot),
|
|
44
|
-
appTests,
|
|
45
|
-
inSourceVitestTests: (0, get_in_source_vitest_tests_template_1.getInSourceVitestTestsTemplate)(appTests),
|
|
46
|
-
};
|
|
47
|
-
if (options.bundler === 'vite') {
|
|
88
|
+
const templateVariables = getDefaultTemplateVariables(host, options);
|
|
89
|
+
if (options.bundler === 'vite' && !options.useReactRouter) {
|
|
48
90
|
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/base-vite'), options.appProjectRoot, templateVariables);
|
|
49
91
|
}
|
|
92
|
+
else if (options.bundler === 'vite' && options.useReactRouter) {
|
|
93
|
+
generateReactRouterFiles(host, options, templateVariables);
|
|
94
|
+
}
|
|
50
95
|
else if (options.bundler === 'webpack') {
|
|
51
96
|
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/base-webpack'), options.appProjectRoot, {
|
|
52
97
|
...templateVariables,
|
|
53
98
|
webpackPluginOptions: (0, has_webpack_plugin_1.hasWebpackPlugin)(host)
|
|
54
|
-
? createNxWebpackPluginOptions(options)
|
|
99
|
+
? createNxWebpackPluginOptions(options, templateVariables.offsetFromRoot)
|
|
55
100
|
: null,
|
|
56
101
|
});
|
|
57
102
|
if (options.compiler === 'babel') {
|
|
@@ -111,7 +156,17 @@ async function createApplicationFiles(host, options) {
|
|
|
111
156
|
}
|
|
112
157
|
}
|
|
113
158
|
else if (options.bundler === 'rspack') {
|
|
114
|
-
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/base-rspack'), options.appProjectRoot,
|
|
159
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/base-rspack'), options.appProjectRoot, {
|
|
160
|
+
...templateVariables,
|
|
161
|
+
rspackPluginOptions: (0, has_rspack_plugin_1.hasRspackPlugin)(host)
|
|
162
|
+
? createNxRspackPluginOptions(options, templateVariables.offsetFromRoot)
|
|
163
|
+
: null,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
else if (options.bundler === 'rsbuild') {
|
|
167
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/base-rsbuild'), options.appProjectRoot, {
|
|
168
|
+
...templateVariables,
|
|
169
|
+
});
|
|
115
170
|
}
|
|
116
171
|
if (options.unitTestRunner === 'none' ||
|
|
117
172
|
(options.unitTestRunner === 'vitest' && options.inSourceTests == true)) {
|
|
@@ -121,9 +176,12 @@ async function createApplicationFiles(host, options) {
|
|
|
121
176
|
const tutorialUrl = options.rootProject
|
|
122
177
|
? 'https://nx.dev/getting-started/tutorials/react-standalone-tutorial'
|
|
123
178
|
: 'https://nx.dev/react-tutorial/1-code-generation?utm_source=nx-project';
|
|
124
|
-
|
|
179
|
+
const path = options.useReactRouter
|
|
180
|
+
? '../files/react-router-ssr/nx-welcome'
|
|
181
|
+
: '../files/nx-welcome';
|
|
182
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, path, onBoardingStatus), options.appProjectRoot, { ...templateVariables, connectCloudUrl, tutorialUrl });
|
|
125
183
|
}
|
|
126
|
-
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, styleSolutionSpecificAppFiles), options.appProjectRoot, templateVariables);
|
|
184
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, styleSolutionSpecificAppFiles, options.useReactRouter ? 'src' : ''), options.appProjectRoot, templateVariables);
|
|
127
185
|
if (options.js) {
|
|
128
186
|
(0, devkit_1.toJS)(host, {
|
|
129
187
|
useJsx: options.bundler === 'vite' || options.bundler === 'rspack',
|
|
@@ -131,13 +189,15 @@ async function createApplicationFiles(host, options) {
|
|
|
131
189
|
}
|
|
132
190
|
(0, create_ts_config_1.createTsConfig)(host, options.appProjectRoot, 'app', options, relativePathToRootTsConfig);
|
|
133
191
|
}
|
|
134
|
-
function createNxWebpackPluginOptions(options) {
|
|
192
|
+
function createNxWebpackPluginOptions(options, rootOffset) {
|
|
135
193
|
return {
|
|
136
194
|
target: 'web',
|
|
137
195
|
compiler: options.compiler ?? 'babel',
|
|
138
|
-
outputPath:
|
|
139
|
-
?
|
|
140
|
-
:
|
|
196
|
+
outputPath: options.isUsingTsSolutionConfig
|
|
197
|
+
? 'dist'
|
|
198
|
+
: (0, devkit_1.joinPathFragments)(rootOffset, 'dist', options.appProjectRoot != '.'
|
|
199
|
+
? options.appProjectRoot
|
|
200
|
+
: options.projectName),
|
|
141
201
|
index: './src/index.html',
|
|
142
202
|
baseHref: '/',
|
|
143
203
|
main: (0, maybe_js_1.maybeJs)({
|
|
@@ -153,3 +213,26 @@ function createNxWebpackPluginOptions(options) {
|
|
|
153
213
|
],
|
|
154
214
|
};
|
|
155
215
|
}
|
|
216
|
+
function generateReactRouterFiles(tree, options, templateVariables) {
|
|
217
|
+
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, '../files/react-router-ssr/common'), options.appProjectRoot, templateVariables);
|
|
218
|
+
if (options.rootProject) {
|
|
219
|
+
const gitignore = tree.read('.gitignore', 'utf-8');
|
|
220
|
+
tree.write('.gitignore', `${gitignore}\n.cache\nbuild\npublic/build\n.env\n\.react-router\n`);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/react-router-ssr/non-root'), options.appProjectRoot, templateVariables);
|
|
224
|
+
}
|
|
225
|
+
if (options.isUsingTsSolutionConfig) {
|
|
226
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/react-router-ssr/ts-solution'), options.appProjectRoot, templateVariables);
|
|
227
|
+
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), (json) => {
|
|
228
|
+
if (options.projectName !== options.importPath) {
|
|
229
|
+
json.nx = { name: options.projectName };
|
|
230
|
+
}
|
|
231
|
+
if (options.parsedTags?.length) {
|
|
232
|
+
json.nx ??= {};
|
|
233
|
+
json.nx.tags = options.parsedTags;
|
|
234
|
+
}
|
|
235
|
+
return json;
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
11
|
-
});
|
|
9
|
+
expect(baseElement).toBeTruthy();
|
|
10
|
+
});
|
|
12
11
|
|
|
13
|
-
it('should have a greeting as the title', () => {
|
|
14
|
-
|
|
15
|
-
? 'const {
|
|
16
|
-
: 'const {
|
|
17
|
-
|
|
18
|
-
});
|
|
12
|
+
it('should have a greeting as the title', () => {
|
|
13
|
+
${options.routing
|
|
14
|
+
? 'const { getAllByText } = render(<BrowserRouter><App /></BrowserRouter>);'
|
|
15
|
+
: 'const { getAllByText } = render(<App />);'}
|
|
16
|
+
expect(getAllByText(new RegExp('Welcome ${options.projectName}', 'gi')).length > 0).toBeTruthy();
|
|
17
|
+
});
|
|
19
18
|
`;
|
|
20
19
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import { NormalizedSchema } from '../schema';
|
|
3
|
-
export declare function installCommonDependencies(host: Tree, options: NormalizedSchema): import("@nx/devkit").GeneratorCallback
|
|
3
|
+
export declare function installCommonDependencies(host: Tree, options: NormalizedSchema): Promise<import("@nx/devkit").GeneratorCallback>;
|
|
@@ -3,19 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.installCommonDependencies = installCommonDependencies;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const versions_1 = require("../../../utils/versions");
|
|
6
|
-
|
|
6
|
+
const version_utils_1 = require("../../../utils/version-utils");
|
|
7
|
+
async function installCommonDependencies(host, options) {
|
|
7
8
|
if (options.skipPackageJson) {
|
|
8
9
|
return () => { };
|
|
9
10
|
}
|
|
11
|
+
const reactDeps = await (0, version_utils_1.getReactDependenciesVersionsToInstall)(host);
|
|
10
12
|
const dependencies = {};
|
|
11
13
|
const devDependencies = {
|
|
14
|
+
'@types/react': reactDeps['@types/react'],
|
|
15
|
+
'@types/react-dom': reactDeps['@types/react-dom'],
|
|
12
16
|
'@types/node': versions_1.typesNodeVersion,
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
...(options.useReactRouter
|
|
18
|
+
? {
|
|
19
|
+
'@react-router/dev': versions_1.reactRouterVersion,
|
|
20
|
+
}
|
|
21
|
+
: {}),
|
|
15
22
|
};
|
|
16
23
|
if (options.bundler !== 'vite') {
|
|
17
24
|
dependencies['tslib'] = versions_1.tsLibVersion;
|
|
18
25
|
}
|
|
26
|
+
if (options.useReactRouter) {
|
|
27
|
+
dependencies['react-router'] = versions_1.reactRouterVersion;
|
|
28
|
+
dependencies['@react-router/node'] = versions_1.reactRouterVersion;
|
|
29
|
+
dependencies['@react-router/serve'] = versions_1.reactRouterVersion;
|
|
30
|
+
dependencies['isbot'] = versions_1.reactRouterIsBotVersion;
|
|
31
|
+
}
|
|
19
32
|
// Vite requires style preprocessors to be installed manually.
|
|
20
33
|
// `@nx/webpack` installs them automatically for now.
|
|
21
34
|
if (options.bundler === 'vite' || options.unitTestRunner === 'vitest') {
|
|
@@ -41,6 +54,7 @@ function installCommonDependencies(host, options) {
|
|
|
41
54
|
}
|
|
42
55
|
if (options.unitTestRunner && options.unitTestRunner !== 'none') {
|
|
43
56
|
devDependencies['@testing-library/react'] = versions_1.testingLibraryReactVersion;
|
|
57
|
+
devDependencies['@testing-library/dom'] = versions_1.testingLibraryDomVersion;
|
|
44
58
|
}
|
|
45
|
-
return (0, devkit_1.addDependenciesToPackageJson)(host,
|
|
59
|
+
return (0, devkit_1.addDependenciesToPackageJson)(host, dependencies, devDependencies);
|
|
46
60
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import { NormalizedSchema, Schema } from '../schema';
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function normalizeProjectName(options: Schema): string;
|
|
5
|
-
export declare function normalizeOptions<T extends Schema = Schema>(host: Tree, options: Schema, callingGenerator?: string): Promise<NormalizedSchema<T>>;
|
|
3
|
+
export declare function normalizeOptions<T extends Schema = Schema>(host: Tree, options: Schema): Promise<NormalizedSchema<T>>;
|
|
@@ -1,60 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeDirectory = normalizeDirectory;
|
|
4
|
-
exports.normalizeProjectName = normalizeProjectName;
|
|
5
3
|
exports.normalizeOptions = normalizeOptions;
|
|
6
4
|
const devkit_1 = require("@nx/devkit");
|
|
7
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
8
6
|
const assertion_1 = require("../../../utils/assertion");
|
|
9
7
|
const find_free_port_1 = require("./find-free-port");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
? `${(0, devkit_1.names)(projectDirectory).fileName}/${(0, devkit_1.names)(options.name).fileName}`
|
|
15
|
-
: (0, devkit_1.names)(options.name).fileName;
|
|
16
|
-
}
|
|
17
|
-
function normalizeProjectName(options) {
|
|
18
|
-
return normalizeDirectory(options).replace(new RegExp('/', 'g'), '-');
|
|
19
|
-
}
|
|
20
|
-
async function normalizeOptions(host, options, callingGenerator = '@nx/react:application') {
|
|
21
|
-
const { projectName: appProjectName, projectRoot: appProjectRoot, projectNameAndRootFormat, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
8
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
9
|
+
async function normalizeOptions(host, options) {
|
|
10
|
+
await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application');
|
|
11
|
+
const { projectName, names: projectNames, projectRoot: appProjectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
22
12
|
name: options.name,
|
|
23
13
|
projectType: 'application',
|
|
24
14
|
directory: options.directory,
|
|
25
|
-
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
26
15
|
rootProject: options.rootProject,
|
|
27
|
-
callingGenerator,
|
|
28
16
|
});
|
|
29
17
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
30
18
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
31
19
|
nxJson.useInferencePlugins !== false;
|
|
32
20
|
options.addPlugin ??= addPlugin;
|
|
33
21
|
options.rootProject = appProjectRoot === '.';
|
|
34
|
-
|
|
22
|
+
const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
23
|
+
const appProjectName = !isUsingTsSolutionConfig || options.name ? projectName : importPath;
|
|
35
24
|
const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
|
|
36
25
|
const e2eProjectRoot = options.rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
|
|
37
26
|
const parsedTags = options.tags
|
|
38
27
|
? options.tags.split(',').map((s) => s.trim())
|
|
39
28
|
: [];
|
|
40
|
-
const fileName =
|
|
29
|
+
const fileName = 'app';
|
|
41
30
|
const styledModule = /^(css|scss|less|tailwind|none)$/.test(options.style)
|
|
42
31
|
? null
|
|
43
32
|
: options.style;
|
|
44
33
|
(0, assertion_1.assertValidStyle)(options.style);
|
|
34
|
+
(0, assertion_1.assertValidReactRouter)(options.useReactRouter, options.bundler);
|
|
35
|
+
if (options.useReactRouter && !options.bundler) {
|
|
36
|
+
options.bundler = 'vite';
|
|
37
|
+
}
|
|
38
|
+
options.useReactRouter = options.routing ? options.useReactRouter : false;
|
|
45
39
|
const normalized = {
|
|
46
40
|
...options,
|
|
47
|
-
name: (0, devkit_1.names)(options.name).fileName,
|
|
48
41
|
projectName: appProjectName,
|
|
49
42
|
appProjectRoot,
|
|
43
|
+
importPath,
|
|
50
44
|
e2eProjectName,
|
|
51
45
|
e2eProjectRoot,
|
|
52
46
|
parsedTags,
|
|
53
47
|
fileName,
|
|
54
48
|
styledModule,
|
|
55
49
|
hasStyles: options.style !== 'none',
|
|
50
|
+
names: (0, devkit_1.names)(projectNames.projectSimpleName),
|
|
51
|
+
isUsingTsSolutionConfig,
|
|
52
|
+
useProjectJson: options.useProjectJson ?? !isUsingTsSolutionConfig,
|
|
56
53
|
};
|
|
57
54
|
normalized.routing = normalized.routing ?? false;
|
|
55
|
+
normalized.useReactRouter = normalized.useReactRouter ?? false;
|
|
58
56
|
normalized.strict = normalized.strict ?? true;
|
|
59
57
|
normalized.classComponent = normalized.classComponent ?? false;
|
|
60
58
|
normalized.compiler = normalized.compiler ?? 'babel';
|
|
@@ -17,6 +17,11 @@ function updateSpecConfig(host, options) {
|
|
|
17
17
|
types.push('@nx/react/typings/cssmodule.d.ts', '@nx/react/typings/image.d.ts');
|
|
18
18
|
compilerOptions.types = types;
|
|
19
19
|
json.compilerOptions = compilerOptions;
|
|
20
|
+
if (options.isUsingTsSolutionConfig) {
|
|
21
|
+
// add project reference to the runtime tsconfig.app.json file
|
|
22
|
+
json.references ??= [];
|
|
23
|
+
json.references.push({ path: './tsconfig.app.json' });
|
|
24
|
+
}
|
|
20
25
|
return json;
|
|
21
26
|
});
|
|
22
27
|
if (options.unitTestRunner !== 'jest') {
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { names } from '@nx/devkit';
|
|
2
2
|
import type { Linter, LinterType } from '@nx/eslint';
|
|
3
3
|
import type { SupportedStyles } from '../../../typings/style';
|
|
4
4
|
|
|
5
5
|
export interface Schema {
|
|
6
|
-
|
|
6
|
+
directory: string;
|
|
7
|
+
name?: string;
|
|
7
8
|
style: SupportedStyles;
|
|
8
9
|
skipFormat?: boolean;
|
|
9
|
-
directory?: string;
|
|
10
|
-
projectNameAndRootFormat?: ProjectNameAndRootFormat;
|
|
11
10
|
tags?: string;
|
|
12
11
|
unitTestRunner?: 'jest' | 'vitest' | 'none';
|
|
13
12
|
inSourceTests?: boolean;
|
|
14
13
|
e2eTestRunner: 'cypress' | 'playwright' | 'none';
|
|
15
14
|
linter: Linter | LinterType;
|
|
16
|
-
pascalCaseFiles?: boolean;
|
|
17
15
|
classComponent?: boolean;
|
|
18
16
|
routing?: boolean;
|
|
17
|
+
useReactRouter?: boolean;
|
|
19
18
|
skipNxJson?: boolean;
|
|
20
19
|
js?: boolean;
|
|
21
20
|
globalCss?: boolean;
|
|
@@ -26,10 +25,14 @@ export interface Schema {
|
|
|
26
25
|
devServerPort?: number;
|
|
27
26
|
skipPackageJson?: boolean;
|
|
28
27
|
rootProject?: boolean;
|
|
29
|
-
bundler?: 'webpack' | 'vite' | 'rspack';
|
|
28
|
+
bundler?: 'webpack' | 'vite' | 'rspack' | 'rsbuild';
|
|
30
29
|
minimal?: boolean;
|
|
30
|
+
// Internal options
|
|
31
31
|
addPlugin?: boolean;
|
|
32
32
|
nxCloudToken?: string;
|
|
33
|
+
useTsSolution?: boolean;
|
|
34
|
+
formatter?: 'prettier' | 'none';
|
|
35
|
+
useProjectJson?: boolean;
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
export interface NormalizedSchema<T extends Schema = Schema> extends T {
|
|
@@ -37,10 +40,13 @@ export interface NormalizedSchema<T extends Schema = Schema> extends T {
|
|
|
37
40
|
appProjectRoot: string;
|
|
38
41
|
e2eProjectName: string;
|
|
39
42
|
e2eProjectRoot: string;
|
|
43
|
+
importPath: string;
|
|
40
44
|
parsedTags: string[];
|
|
41
45
|
fileName: string;
|
|
42
46
|
styledModule: null | SupportedStyles;
|
|
43
47
|
hasStyles: boolean;
|
|
44
48
|
unitTestRunner: 'jest' | 'vitest' | 'none';
|
|
45
49
|
addPlugin?: boolean;
|
|
50
|
+
names: ReturnType<typeof names>;
|
|
51
|
+
isUsingTsSolutionConfig?: boolean;
|
|
46
52
|
}
|
|
@@ -6,41 +6,36 @@
|
|
|
6
6
|
"description": "Create a React application for Nx.",
|
|
7
7
|
"examples": [
|
|
8
8
|
{
|
|
9
|
-
"command": "nx g app myapp
|
|
9
|
+
"command": "nx g app apps/myorg/myapp",
|
|
10
10
|
"description": "Generate `apps/myorg/myapp` and `apps/myorg/myapp-e2e`"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
|
-
"command": "nx g app myapp --classComponent",
|
|
13
|
+
"command": "nx g app apps/myapp --classComponent",
|
|
14
14
|
"description": "Use class components instead of functional components"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
|
-
"command": "nx g app myapp --routing",
|
|
17
|
+
"command": "nx g app apps/myapp --routing",
|
|
18
18
|
"description": "Set up React Router"
|
|
19
19
|
}
|
|
20
20
|
],
|
|
21
21
|
"type": "object",
|
|
22
22
|
"properties": {
|
|
23
|
-
"
|
|
24
|
-
"description": "The
|
|
23
|
+
"directory": {
|
|
24
|
+
"description": "The directory of the new application.",
|
|
25
25
|
"type": "string",
|
|
26
|
+
"alias": "dir",
|
|
26
27
|
"$default": {
|
|
27
28
|
"$source": "argv",
|
|
28
29
|
"index": 0
|
|
29
30
|
},
|
|
30
|
-
"x-prompt": "
|
|
31
|
-
"pattern": "^[a-zA-Z][^:]*$"
|
|
31
|
+
"x-prompt": "Which directory do you want to create the application in?"
|
|
32
32
|
},
|
|
33
|
-
"
|
|
34
|
-
"description": "The
|
|
33
|
+
"name": {
|
|
34
|
+
"description": "The name of the application.",
|
|
35
35
|
"type": "string",
|
|
36
|
-
"
|
|
36
|
+
"pattern": "^[a-zA-Z][^:]*$",
|
|
37
37
|
"x-priority": "important"
|
|
38
38
|
},
|
|
39
|
-
"projectNameAndRootFormat": {
|
|
40
|
-
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
|
|
41
|
-
"type": "string",
|
|
42
|
-
"enum": ["as-provided", "derived"]
|
|
43
|
-
},
|
|
44
39
|
"style": {
|
|
45
40
|
"description": "The file extension to be used for style files.",
|
|
46
41
|
"type": "string",
|
|
@@ -56,15 +51,15 @@
|
|
|
56
51
|
},
|
|
57
52
|
{
|
|
58
53
|
"value": "scss",
|
|
59
|
-
"label": "SASS(.scss) [ https://sass-lang.com
|
|
54
|
+
"label": "SASS(.scss) [ https://sass-lang.com ]"
|
|
60
55
|
},
|
|
61
56
|
{
|
|
62
57
|
"value": "less",
|
|
63
|
-
"label": "LESS [ https://lesscss.org
|
|
58
|
+
"label": "LESS [ https://lesscss.org ]"
|
|
64
59
|
},
|
|
65
60
|
{
|
|
66
61
|
"value": "tailwind",
|
|
67
|
-
"label": "tailwind
|
|
62
|
+
"label": "tailwind [ https://tailwindcss.com/ ]"
|
|
68
63
|
},
|
|
69
64
|
{
|
|
70
65
|
"value": "styled-components",
|
|
@@ -85,16 +80,15 @@
|
|
|
85
80
|
]
|
|
86
81
|
}
|
|
87
82
|
},
|
|
88
|
-
"linter": {
|
|
89
|
-
"description": "The tool to use for running lint checks.",
|
|
90
|
-
"type": "string",
|
|
91
|
-
"enum": ["eslint", "none"],
|
|
92
|
-
"default": "eslint"
|
|
93
|
-
},
|
|
94
83
|
"routing": {
|
|
95
84
|
"type": "boolean",
|
|
96
85
|
"description": "Generate application with routes.",
|
|
97
|
-
"x-prompt": "Would you like to add
|
|
86
|
+
"x-prompt": "Would you like to add routing to this application?",
|
|
87
|
+
"default": false
|
|
88
|
+
},
|
|
89
|
+
"useReactRouter": {
|
|
90
|
+
"description": "Use React Router for routing.",
|
|
91
|
+
"type": "boolean",
|
|
98
92
|
"default": false
|
|
99
93
|
},
|
|
100
94
|
"skipFormat": {
|
|
@@ -109,11 +103,29 @@
|
|
|
109
103
|
"default": false,
|
|
110
104
|
"x-priority": "internal"
|
|
111
105
|
},
|
|
106
|
+
"bundler": {
|
|
107
|
+
"description": "The bundler to use.",
|
|
108
|
+
"type": "string",
|
|
109
|
+
"enum": ["vite", "rsbuild", "rspack", "webpack"],
|
|
110
|
+
"x-prompt": "Which bundler do you want to use to build the application?",
|
|
111
|
+
"default": "vite",
|
|
112
|
+
"x-priority": "important"
|
|
113
|
+
},
|
|
114
|
+
"linter": {
|
|
115
|
+
"description": "The tool to use for running lint checks.",
|
|
116
|
+
"type": "string",
|
|
117
|
+
"enum": ["eslint", "none"],
|
|
118
|
+
"default": "none",
|
|
119
|
+
"x-prompt": "Which linter would you like to use?",
|
|
120
|
+
"x-priority": "important"
|
|
121
|
+
},
|
|
112
122
|
"unitTestRunner": {
|
|
113
123
|
"type": "string",
|
|
114
|
-
"enum": ["
|
|
124
|
+
"enum": ["vitest", "jest", "none"],
|
|
115
125
|
"description": "Test runner to use for unit tests.",
|
|
116
|
-
"default": "
|
|
126
|
+
"default": "none",
|
|
127
|
+
"x-prompt": "What unit test runner should be used?",
|
|
128
|
+
"x-priority": "important"
|
|
117
129
|
},
|
|
118
130
|
"inSourceTests": {
|
|
119
131
|
"type": "boolean",
|
|
@@ -132,12 +144,6 @@
|
|
|
132
144
|
"description": "Add tags to the application (used for linting).",
|
|
133
145
|
"alias": "t"
|
|
134
146
|
},
|
|
135
|
-
"pascalCaseFiles": {
|
|
136
|
-
"type": "boolean",
|
|
137
|
-
"description": "Use pascal case component file name (e.g. `App.tsx`).",
|
|
138
|
-
"alias": "P",
|
|
139
|
-
"default": false
|
|
140
|
-
},
|
|
141
147
|
"classComponent": {
|
|
142
148
|
"type": "boolean",
|
|
143
149
|
"description": "Use class components instead of functional component.",
|
|
@@ -182,20 +188,16 @@
|
|
|
182
188
|
"default": false,
|
|
183
189
|
"hidden": true
|
|
184
190
|
},
|
|
185
|
-
"bundler": {
|
|
186
|
-
"description": "The bundler to use.",
|
|
187
|
-
"type": "string",
|
|
188
|
-
"enum": ["vite", "webpack", "rspack"],
|
|
189
|
-
"x-prompt": "Which bundler do you want to use to build the application?",
|
|
190
|
-
"default": "vite",
|
|
191
|
-
"x-priority": "important"
|
|
192
|
-
},
|
|
193
191
|
"minimal": {
|
|
194
192
|
"description": "Generate a React app with a minimal setup, no separate test files.",
|
|
195
193
|
"type": "boolean",
|
|
196
194
|
"default": false
|
|
195
|
+
},
|
|
196
|
+
"useProjectJson": {
|
|
197
|
+
"type": "boolean",
|
|
198
|
+
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
197
199
|
}
|
|
198
200
|
},
|
|
199
|
-
"required": ["
|
|
201
|
+
"required": ["directory"],
|
|
200
202
|
"examplesFile": "../../../docs/application-examples.md"
|
|
201
203
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
2
|
import { Schema } from './schema';
|
|
3
3
|
export declare function componentGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
4
|
-
export declare function componentGeneratorInternal(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
5
4
|
export default componentGenerator;
|