@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,4 +1,3 @@
|
|
|
1
|
-
import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
|
2
1
|
import type { Linter, LinterType } from '@nx/eslint';
|
|
3
2
|
import type { SupportedStyles } from '../../../typings/style';
|
|
4
3
|
|
|
@@ -6,14 +5,12 @@ export interface Schema {
|
|
|
6
5
|
classComponent?: boolean;
|
|
7
6
|
compiler?: 'babel' | 'swc';
|
|
8
7
|
devServerPort?: number;
|
|
9
|
-
directory
|
|
10
|
-
projectNameAndRootFormat?: ProjectNameAndRootFormat;
|
|
8
|
+
directory: string;
|
|
11
9
|
e2eTestRunner: 'cypress' | 'playwright' | 'none';
|
|
12
10
|
globalCss?: boolean;
|
|
13
11
|
js?: boolean;
|
|
14
12
|
linter: Linter | LinterType;
|
|
15
|
-
name
|
|
16
|
-
pascalCaseFiles?: boolean;
|
|
13
|
+
name?: string;
|
|
17
14
|
remotes?: string[];
|
|
18
15
|
setParserOptionsProject?: boolean;
|
|
19
16
|
skipFormat?: boolean;
|
|
@@ -2,32 +2,26 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"$id": "GeneratorReactHost",
|
|
4
4
|
"cli": "nx",
|
|
5
|
-
"title": "Generate Module Federation Setup for React Host App",
|
|
6
|
-
"description": "Create Module Federation configuration files for given React Host Application.",
|
|
5
|
+
"title": "Generate Module Federation Setup for React Consumer (Host) App",
|
|
6
|
+
"description": "Create Module Federation configuration files for given React Consumer (Host) Application.",
|
|
7
7
|
"type": "object",
|
|
8
8
|
"properties": {
|
|
9
|
-
"
|
|
9
|
+
"directory": {
|
|
10
|
+
"description": "The directory of the new application.",
|
|
10
11
|
"type": "string",
|
|
11
|
-
"
|
|
12
|
+
"alias": "dir",
|
|
12
13
|
"$default": {
|
|
13
14
|
"$source": "argv",
|
|
14
15
|
"index": 0
|
|
15
16
|
},
|
|
16
|
-
"x-prompt": "
|
|
17
|
-
"pattern": "^[a-zA-Z][^:]*$",
|
|
18
|
-
"x-priority": "important"
|
|
17
|
+
"x-prompt": "Which directory do you want to create the application in?"
|
|
19
18
|
},
|
|
20
|
-
"
|
|
21
|
-
"description": "The directory of the new application.",
|
|
19
|
+
"name": {
|
|
22
20
|
"type": "string",
|
|
23
|
-
"
|
|
21
|
+
"description": "The name of the Consumer (host) application to generate the Module Federation configuration",
|
|
22
|
+
"pattern": "^[a-zA-Z][^:]*$",
|
|
24
23
|
"x-priority": "important"
|
|
25
24
|
},
|
|
26
|
-
"projectNameAndRootFormat": {
|
|
27
|
-
"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`).",
|
|
28
|
-
"type": "string",
|
|
29
|
-
"enum": ["as-provided", "derived"]
|
|
30
|
-
},
|
|
31
25
|
"style": {
|
|
32
26
|
"description": "The file extension to be used for style files.",
|
|
33
27
|
"type": "string",
|
|
@@ -80,7 +74,7 @@
|
|
|
80
74
|
},
|
|
81
75
|
"dynamic": {
|
|
82
76
|
"type": "boolean",
|
|
83
|
-
"description": "Should the host application use dynamic federation?",
|
|
77
|
+
"description": "Should the Consumer (host) application use dynamic federation?",
|
|
84
78
|
"default": false
|
|
85
79
|
},
|
|
86
80
|
"skipFormat": {
|
|
@@ -113,12 +107,6 @@
|
|
|
113
107
|
"description": "Add tags to the application (used for linting).",
|
|
114
108
|
"alias": "t"
|
|
115
109
|
},
|
|
116
|
-
"pascalCaseFiles": {
|
|
117
|
-
"type": "boolean",
|
|
118
|
-
"description": "Use pascal case component file name (e.g. App.tsx).",
|
|
119
|
-
"alias": "P",
|
|
120
|
-
"default": false
|
|
121
|
-
},
|
|
122
110
|
"classComponent": {
|
|
123
111
|
"type": "boolean",
|
|
124
112
|
"description": "Use class components instead of functional component.",
|
|
@@ -153,18 +141,19 @@
|
|
|
153
141
|
},
|
|
154
142
|
"remotes": {
|
|
155
143
|
"type": "array",
|
|
156
|
-
"description": "A list of remote application names that the host application should consume.",
|
|
144
|
+
"description": "A list of Producer (remote) application names that the Consumer (host) application should consume.",
|
|
157
145
|
"default": [],
|
|
158
|
-
"x-priority": "important"
|
|
146
|
+
"x-priority": "important",
|
|
147
|
+
"alias": "producers"
|
|
159
148
|
},
|
|
160
149
|
"devServerPort": {
|
|
161
150
|
"type": "number",
|
|
162
|
-
"description": "The port for the dev server of the remote app.",
|
|
151
|
+
"description": "The port for the dev server of the Producer (remote) app.",
|
|
163
152
|
"default": 4200,
|
|
164
153
|
"x-priority": "important"
|
|
165
154
|
},
|
|
166
155
|
"ssr": {
|
|
167
|
-
"description": "Whether to configure SSR for the host application",
|
|
156
|
+
"description": "Whether to configure SSR for the Consumer (host) application",
|
|
168
157
|
"type": "boolean",
|
|
169
158
|
"default": false
|
|
170
159
|
},
|
|
@@ -193,6 +182,6 @@
|
|
|
193
182
|
"x-priority": "important"
|
|
194
183
|
}
|
|
195
184
|
},
|
|
196
|
-
"required": ["
|
|
185
|
+
"required": ["directory"],
|
|
197
186
|
"additionalProperties": false
|
|
198
187
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type GeneratorCallback, type Tree } from '@nx/devkit';
|
|
2
2
|
import { InitSchema } from './schema';
|
|
3
|
-
export declare function reactInitGenerator(
|
|
3
|
+
export declare function reactInitGenerator(tree: Tree, schema: InitSchema): Promise<GeneratorCallback>;
|
|
4
4
|
export default reactInitGenerator;
|
|
@@ -3,19 +3,44 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.reactInitGenerator = reactInitGenerator;
|
|
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
|
+
const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
|
|
8
|
+
const router_plugin_1 = require("../../plugins/router-plugin");
|
|
9
|
+
async function reactInitGenerator(tree, schema) {
|
|
7
10
|
const tasks = [];
|
|
8
11
|
if (!schema.skipPackageJson) {
|
|
9
|
-
tasks.push((0, devkit_1.removeDependenciesFromPackageJson)(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
tasks.push((0, devkit_1.removeDependenciesFromPackageJson)(tree, ['@nx/react'], []));
|
|
13
|
+
const reactDeps = await (0, version_utils_1.getReactDependenciesVersionsToInstall)(tree);
|
|
14
|
+
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
15
|
+
react: reactDeps.react,
|
|
16
|
+
'react-dom': reactDeps['react-dom'],
|
|
13
17
|
}, {
|
|
14
18
|
'@nx/react': versions_1.nxVersion,
|
|
15
19
|
}, undefined, schema.keepExistingVersions));
|
|
16
20
|
}
|
|
21
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
22
|
+
schema.addPlugin ??=
|
|
23
|
+
process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
24
|
+
nxJson.useInferencePlugins !== false;
|
|
25
|
+
if (schema.addPlugin) {
|
|
26
|
+
await (0, add_plugin_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/react/router-plugin', router_plugin_1.createNodesV2, {
|
|
27
|
+
buildTargetName: ['build', 'react-router:build', 'react-router-build'],
|
|
28
|
+
devTargetName: ['dev', 'react-router:dev', 'react-router-dev'],
|
|
29
|
+
startTargetName: ['start', 'react-router-serve', 'react-router-start'],
|
|
30
|
+
watchDepsTargetName: [
|
|
31
|
+
'watch-deps',
|
|
32
|
+
'react-router:watch-deps',
|
|
33
|
+
'react-router-watch-deps',
|
|
34
|
+
],
|
|
35
|
+
buildDepsTargetName: [
|
|
36
|
+
'build-deps',
|
|
37
|
+
'react-router:build-deps',
|
|
38
|
+
'react-router-build-deps',
|
|
39
|
+
],
|
|
40
|
+
}, schema.updatePackageScripts);
|
|
41
|
+
}
|
|
17
42
|
if (!schema.skipFormat) {
|
|
18
|
-
await (0, devkit_1.formatFiles)(
|
|
43
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
19
44
|
}
|
|
20
45
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
21
46
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"outDir": "<%= offsetFromRoot %>dist/out-tsc",
|
|
5
5
|
"types": [
|
|
6
6
|
"node",
|
|
7
|
-
<% if (style === 'styled-jsx') { %>"@nx/react/typings/styled-jsx.d.ts",<% } %>
|
|
7
|
+
<%_ if (style === 'styled-jsx') { %>"@nx/react/typings/styled-jsx.d.ts",<% } _%>
|
|
8
8
|
"@nx/react/typings/cssmodule.d.ts",
|
|
9
9
|
"@nx/react/typings/image.d.ts"
|
|
10
10
|
]
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"outDir": "<%= offsetFromRoot %>dist/out-tsc",
|
|
5
5
|
"types": [
|
|
6
6
|
"node",
|
|
7
|
-
<% if (style === 'styled-jsx') { %>"@nx/react/typings/styled-jsx.d.ts",<% } %>
|
|
7
|
+
<%_ if (style === 'styled-jsx') { _%>"@nx/react/typings/styled-jsx.d.ts",<%_ } _%>
|
|
8
8
|
"@nx/react/typings/cssmodule.d.ts",
|
|
9
9
|
"@nx/react/typings/image.d.ts"
|
|
10
10
|
]
|
|
@@ -8,7 +8,7 @@ const lint_1 = require("../../../utils/lint");
|
|
|
8
8
|
const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
|
|
9
9
|
const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
|
|
10
10
|
async function addLinting(host, options) {
|
|
11
|
-
if (options.linter ===
|
|
11
|
+
if (options.linter === 'eslint') {
|
|
12
12
|
const tasks = [];
|
|
13
13
|
const lintTask = await (0, eslint_1.lintProjectGenerator)(host, {
|
|
14
14
|
linter: options.linter,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Tree } from 'nx/src/generators/tree';
|
|
2
2
|
import { GeneratorCallback } from '@nx/devkit';
|
|
3
3
|
import { NormalizedSchema } from '../schema';
|
|
4
|
-
export declare function addRollupBuildTarget(host: Tree, options: NormalizedSchema
|
|
4
|
+
export declare function addRollupBuildTarget(host: Tree, options: NormalizedSchema & {
|
|
5
|
+
format?: Array<'esm' | 'cjs'>;
|
|
6
|
+
}, external?: Set<String>): Promise<GeneratorCallback>;
|
|
@@ -4,7 +4,7 @@ exports.addRollupBuildTarget = addRollupBuildTarget;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const maybe_js_1 = require("../../../utils/maybe-js");
|
|
6
6
|
const versions_1 = require("../../../utils/versions");
|
|
7
|
-
async function addRollupBuildTarget(host, options) {
|
|
7
|
+
async function addRollupBuildTarget(host, options, external = new Set(['react', 'react-dom'])) {
|
|
8
8
|
const tasks = [];
|
|
9
9
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/rollup', versions_1.nxVersion);
|
|
10
10
|
tasks.push(await configurationGenerator(host, {
|
|
@@ -19,12 +19,11 @@ async function addRollupBuildTarget(host, options) {
|
|
|
19
19
|
'@svgr/rollup': versions_1.svgrRollupVersion,
|
|
20
20
|
}));
|
|
21
21
|
}
|
|
22
|
-
const external = ['react', 'react-dom'];
|
|
23
22
|
if (options.style === '@emotion/styled') {
|
|
24
|
-
external.
|
|
23
|
+
external.add('@emotion/react/jsx-runtime');
|
|
25
24
|
}
|
|
26
25
|
else {
|
|
27
|
-
external.
|
|
26
|
+
external.add('react/jsx-runtime');
|
|
28
27
|
}
|
|
29
28
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
30
29
|
const hasRollupPlugin = !!nxJson.plugins?.some((p) => typeof p === 'string'
|
|
@@ -32,33 +31,36 @@ async function addRollupBuildTarget(host, options) {
|
|
|
32
31
|
: p.plugin === '@nx/rollup/plugin');
|
|
33
32
|
if (hasRollupPlugin) {
|
|
34
33
|
// New behavior, using rollup config file and inferred target.
|
|
35
|
-
host.write((0, devkit_1.joinPathFragments)(options.projectRoot, 'rollup.config.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})
|
|
61
|
-
|
|
34
|
+
host.write((0, devkit_1.joinPathFragments)(options.projectRoot, 'rollup.config.cjs'), `const { withNx } = require('@nx/rollup/with-nx');
|
|
35
|
+
const url = require('@rollup/plugin-url');
|
|
36
|
+
const svg = require('@svgr/rollup');
|
|
37
|
+
|
|
38
|
+
module.exports = withNx(
|
|
39
|
+
{
|
|
40
|
+
main: '${(0, maybe_js_1.maybeJs)(options, './src/index.ts')}',
|
|
41
|
+
outputPath: '${options.isUsingTsSolutionConfig
|
|
42
|
+
? './dist'
|
|
43
|
+
: (0, devkit_1.joinPathFragments)((0, devkit_1.offsetFromRoot)(options.projectRoot), 'dist', options.projectRoot)}',
|
|
44
|
+
tsConfig: './tsconfig.lib.json',
|
|
45
|
+
compiler: '${options.compiler ?? 'babel'}',
|
|
46
|
+
external: ${JSON.stringify(Array.from(external))},
|
|
47
|
+
format: ${JSON.stringify(options.format ?? ['esm'])},
|
|
48
|
+
assets:[{ input: '.', output: '.', glob: 'README.md'}],
|
|
49
|
+
}, {
|
|
50
|
+
// Provide additional rollup configuration here. See: https://rollupjs.org/configuration-options
|
|
51
|
+
plugins: [
|
|
52
|
+
svg({
|
|
53
|
+
svgo: false,
|
|
54
|
+
titleProp: true,
|
|
55
|
+
ref: true,
|
|
56
|
+
}),
|
|
57
|
+
url({
|
|
58
|
+
limit: 10000, // 10kB
|
|
59
|
+
}),
|
|
60
|
+
],
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
`);
|
|
62
64
|
}
|
|
63
65
|
else {
|
|
64
66
|
// Legacy behavior, there is a target in project.json using rollup executor.
|
|
@@ -71,7 +73,7 @@ async function addRollupBuildTarget(host, options) {
|
|
|
71
73
|
tsConfig: `${options.projectRoot}/tsconfig.lib.json`,
|
|
72
74
|
project: `${options.projectRoot}/package.json`,
|
|
73
75
|
entryFile: (0, maybe_js_1.maybeJs)(options, `${options.projectRoot}/src/index.ts`),
|
|
74
|
-
external,
|
|
76
|
+
external: Array.from(external),
|
|
75
77
|
rollupConfig: `@nx/react/plugins/bundle-rollup`,
|
|
76
78
|
compiler: options.compiler ?? 'babel',
|
|
77
79
|
assets: [
|
|
@@ -42,8 +42,29 @@ function createFiles(host, options) {
|
|
|
42
42
|
].filter(Boolean),
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
if (
|
|
46
|
-
|
|
45
|
+
if ((options.publishable || options.buildable) &&
|
|
46
|
+
!options.isUsingTsSolutionConfig &&
|
|
47
|
+
options.useProjectJson) {
|
|
48
|
+
if (options.bundler === 'vite') {
|
|
49
|
+
(0, devkit_1.writeJson)(host, `${options.projectRoot}/package.json`, {
|
|
50
|
+
name: options.importPath,
|
|
51
|
+
version: '0.0.1',
|
|
52
|
+
main: './index.js',
|
|
53
|
+
types: './index.d.ts',
|
|
54
|
+
exports: {
|
|
55
|
+
'.': {
|
|
56
|
+
import: './index.mjs',
|
|
57
|
+
require: './index.js',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
(0, devkit_1.writeJson)(host, `${options.projectRoot}/package.json`, {
|
|
64
|
+
name: options.importPath,
|
|
65
|
+
version: '0.0.1',
|
|
66
|
+
});
|
|
67
|
+
}
|
|
47
68
|
}
|
|
48
69
|
if (options.js) {
|
|
49
70
|
(0, devkit_1.toJS)(host);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.determineEntryFields = determineEntryFields;
|
|
4
|
+
function determineEntryFields(options) {
|
|
5
|
+
if (options.bundler !== 'none') {
|
|
6
|
+
return {};
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
main: options.js ? './src/index.js' : './src/index.ts',
|
|
10
|
+
types: options.js ? './src/index.js' : './src/index.ts',
|
|
11
|
+
exports: {
|
|
12
|
+
'.': options.js
|
|
13
|
+
? './src/index.js'
|
|
14
|
+
: {
|
|
15
|
+
types: './src/index.ts',
|
|
16
|
+
import: './src/index.ts',
|
|
17
|
+
default: './src/index.ts',
|
|
18
|
+
},
|
|
19
|
+
'./package.json': './package.json',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
2
|
import { NormalizedSchema } from '../schema';
|
|
3
|
-
export declare function installCommonDependencies(host: Tree, options: NormalizedSchema): GeneratorCallback
|
|
3
|
+
export declare function installCommonDependencies(host: Tree, options: NormalizedSchema): Promise<GeneratorCallback>;
|
|
@@ -3,14 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.installCommonDependencies = installCommonDependencies;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const add_swc_dependencies_1 = require("@nx/js/src/utils/swc/add-swc-dependencies");
|
|
6
|
+
const version_utils_1 = require("../../../utils/version-utils");
|
|
6
7
|
const versions_1 = require("../../../utils/versions");
|
|
7
|
-
function installCommonDependencies(host, options) {
|
|
8
|
+
async function installCommonDependencies(host, options) {
|
|
8
9
|
const tasks = [];
|
|
10
|
+
const reactVersions = await (0, version_utils_1.getReactDependenciesVersionsToInstall)(host);
|
|
9
11
|
const dependencies = {};
|
|
10
12
|
const devDependencies = {
|
|
11
13
|
'@types/node': versions_1.typesNodeVersion,
|
|
12
|
-
'@types/react':
|
|
13
|
-
'@types/react-dom':
|
|
14
|
+
'@types/react': reactVersions['@types/react'],
|
|
15
|
+
'@types/react-dom': reactVersions['@types/react-dom'],
|
|
14
16
|
};
|
|
15
17
|
if (options.bundler !== 'vite') {
|
|
16
18
|
dependencies['tslib'] = versions_1.tsLibVersion;
|
|
@@ -4,14 +4,15 @@ exports.normalizeOptions = normalizeOptions;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
6
|
const assertion_1 = require("../../../utils/assertion");
|
|
7
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
8
|
async function normalizeOptions(host, options) {
|
|
9
|
+
const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
10
|
+
await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'library');
|
|
8
11
|
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
9
12
|
name: options.name,
|
|
10
13
|
projectType: 'library',
|
|
11
14
|
directory: options.directory,
|
|
12
15
|
importPath: options.importPath,
|
|
13
|
-
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
14
|
-
callingGenerator: '@nx/react:library',
|
|
15
16
|
});
|
|
16
17
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
17
18
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
@@ -40,29 +41,33 @@ async function normalizeOptions(host, options) {
|
|
|
40
41
|
bundler,
|
|
41
42
|
fileName,
|
|
42
43
|
routePath: `/${projectNames.projectSimpleName}`,
|
|
43
|
-
name: projectName,
|
|
44
|
+
name: isUsingTsSolutionConfig && !options.name ? importPath : projectName,
|
|
44
45
|
projectRoot,
|
|
45
46
|
parsedTags,
|
|
46
47
|
importPath,
|
|
48
|
+
useProjectJson: options.useProjectJson ?? !isUsingTsSolutionConfig,
|
|
47
49
|
};
|
|
48
50
|
// Libraries with a bundler or is publishable must also be buildable.
|
|
49
51
|
normalized.buildable = Boolean(normalized.bundler !== 'none' || options.buildable || options.publishable);
|
|
50
52
|
normalized.inSourceTests === normalized.minimal || normalized.inSourceTests;
|
|
51
53
|
if (options.appProject) {
|
|
52
54
|
const appProjectConfig = (0, devkit_1.getProjects)(host).get(options.appProject);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
const appProjectType = (0, ts_solution_setup_1.getProjectType)(host, appProjectConfig.root, appProjectConfig.projectType);
|
|
56
|
+
if (appProjectType !== 'application') {
|
|
57
|
+
throw new Error(`appProject expected type of "application" but got "${appProjectType}"`);
|
|
55
58
|
}
|
|
59
|
+
const appSourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(host, appProjectConfig.sourceRoot, appProjectConfig.root);
|
|
56
60
|
normalized.appMain =
|
|
57
61
|
appProjectConfig.targets.build?.options?.main ??
|
|
58
62
|
findMainEntry(host, appProjectConfig.root);
|
|
59
|
-
normalized.appSourceRoot = (0, devkit_1.normalizePath)(
|
|
63
|
+
normalized.appSourceRoot = (0, devkit_1.normalizePath)(appSourceRoot);
|
|
60
64
|
// TODO(jack): We should use appEntryFile instead of appProject so users can directly set it rather than us inferring it.
|
|
61
65
|
if (!normalized.appMain) {
|
|
62
66
|
throw new Error(`Could not locate project main for ${options.appProject}`);
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
(0, assertion_1.assertValidStyle)(normalized.style);
|
|
70
|
+
normalized.isUsingTsSolutionConfig = isUsingTsSolutionConfig;
|
|
66
71
|
return normalized;
|
|
67
72
|
}
|
|
68
73
|
function findMainEntry(tree, projectRoot) {
|