@nx/react 0.0.0-pr-22179-271588f
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 +22 -0
- package/README.md +68 -0
- package/ast-utils.d.ts +1 -0
- package/ast-utils.js +11 -0
- package/babel.d.ts +20 -0
- package/babel.js +50 -0
- package/executors.json +14 -0
- package/generators.json +112 -0
- package/index.d.ts +22 -0
- package/index.js +47 -0
- package/mf/dynamic-federation.d.ts +4 -0
- package/mf/dynamic-federation.js +75 -0
- package/mf/index.d.ts +1 -0
- package/mf/index.js +7 -0
- package/migrations.json +310 -0
- package/module-federation.d.ts +4 -0
- package/module-federation.js +12 -0
- package/package.json +49 -0
- package/plugins/bundle-rollup.d.ts +1 -0
- package/plugins/bundle-rollup.js +47 -0
- package/plugins/component-testing/index.d.ts +37 -0
- package/plugins/component-testing/index.js +222 -0
- package/plugins/component-testing/webpack-fallback.d.ts +5 -0
- package/plugins/component-testing/webpack-fallback.js +125 -0
- package/plugins/jest.d.ts +1 -0
- package/plugins/jest.js +59 -0
- package/plugins/nx-react-webpack-plugin/lib/apply-react-config.d.ts +4 -0
- package/plugins/nx-react-webpack-plugin/lib/apply-react-config.js +60 -0
- package/plugins/nx-react-webpack-plugin/nx-react-webpack-plugin.d.ts +8 -0
- package/plugins/nx-react-webpack-plugin/nx-react-webpack-plugin.js +13 -0
- package/plugins/storybook/index.d.ts +3 -0
- package/plugins/storybook/index.js +174 -0
- package/plugins/storybook/merge-plugins.d.ts +3 -0
- package/plugins/storybook/merge-plugins.js +17 -0
- package/plugins/webpack.d.ts +1 -0
- package/plugins/webpack.js +6 -0
- package/plugins/with-react.d.ts +10 -0
- package/plugins/with-react.js +22 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +25 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +211 -0
- package/src/executors/module-federation-dev-server/schema.json +114 -0
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +9 -0
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +106 -0
- package/src/executors/module-federation-ssr-dev-server/schema.json +48 -0
- package/src/generators/application/application.d.ts +5 -0
- package/src/generators/application/application.js +232 -0
- package/src/generators/application/files/base-rspack/src/app/__fileName__.spec.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-rspack/src/assets/.gitkeep +0 -0
- package/src/generators/application/files/base-rspack/src/favicon.ico +0 -0
- package/src/generators/application/files/base-rspack/src/index.html +14 -0
- package/src/generators/application/files/base-rspack/src/main.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-rspack/tsconfig.app.json__tmpl__ +14 -0
- package/src/generators/application/files/base-vite/index.html__tmpl__ +16 -0
- package/src/generators/application/files/base-vite/public/favicon.ico +0 -0
- package/src/generators/application/files/base-vite/src/app/__fileName__.spec.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-vite/src/assets/.gitkeep +0 -0
- package/src/generators/application/files/base-vite/src/environments/environment.prod.ts__tmpl__ +3 -0
- package/src/generators/application/files/base-vite/src/environments/environment.ts__tmpl__ +6 -0
- package/src/generators/application/files/base-vite/src/main.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-vite/tsconfig.app.json__tmpl__ +14 -0
- package/src/generators/application/files/base-webpack/src/app/__fileName__.spec.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-webpack/src/assets/.gitkeep +0 -0
- package/src/generators/application/files/base-webpack/src/favicon.ico +0 -0
- package/src/generators/application/files/base-webpack/src/index.html +12 -0
- package/src/generators/application/files/base-webpack/src/main.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-webpack/tsconfig.app.json__tmpl__ +14 -0
- package/src/generators/application/files/base-webpack/webpack.config.js__tmpl__ +50 -0
- package/src/generators/application/files/nx-welcome/src/app/nx-welcome.tsx +886 -0
- package/src/generators/application/files/style-css-module/src/app/__fileName__.module.__style__ +1 -0
- package/src/generators/application/files/style-css-module/src/app/__fileName__.tsx__tmpl__ +36 -0
- package/src/generators/application/files/style-css-module/src/styles.__style__ +1 -0
- package/src/generators/application/files/style-global-css/src/app/__fileName__.__style__ +1 -0
- package/src/generators/application/files/style-global-css/src/app/__fileName__.tsx__tmpl__ +35 -0
- package/src/generators/application/files/style-global-css/src/styles.__style__ +1 -0
- package/src/generators/application/files/style-none/src/app/__fileName__.tsx__tmpl__ +34 -0
- package/src/generators/application/files/style-styled-jsx/src/app/__fileName__.tsx__tmpl__ +37 -0
- package/src/generators/application/files/style-styled-module/src/app/__fileName__.tsx__tmpl__ +40 -0
- package/src/generators/application/files/style-tailwind/src/app/__fileName__.tsx__tmpl__ +33 -0
- package/src/generators/application/files/style-tailwind/src/styles.css +1 -0
- package/src/generators/application/lib/add-e2e.d.ts +3 -0
- package/src/generators/application/lib/add-e2e.js +79 -0
- package/src/generators/application/lib/add-jest.d.ts +3 -0
- package/src/generators/application/lib/add-jest.js +21 -0
- package/src/generators/application/lib/add-project.d.ts +3 -0
- package/src/generators/application/lib/add-project.js +96 -0
- package/src/generators/application/lib/add-routing.d.ts +3 -0
- package/src/generators/application/lib/add-routing.js +27 -0
- package/src/generators/application/lib/create-application-files.d.ts +3 -0
- package/src/generators/application/lib/create-application-files.js +143 -0
- package/src/generators/application/lib/find-free-port.d.ts +2 -0
- package/src/generators/application/lib/find-free-port.js +16 -0
- package/src/generators/application/lib/get-app-tests.d.ts +2 -0
- package/src/generators/application/lib/get-app-tests.js +21 -0
- package/src/generators/application/lib/install-common-dependencies.d.ts +3 -0
- package/src/generators/application/lib/install-common-dependencies.js +47 -0
- package/src/generators/application/lib/normalize-options.d.ts +5 -0
- package/src/generators/application/lib/normalize-options.js +72 -0
- package/src/generators/application/lib/set-defaults.d.ts +3 -0
- package/src/generators/application/lib/set-defaults.js +43 -0
- package/src/generators/application/lib/show-possible-warnings.d.ts +3 -0
- package/src/generators/application/lib/show-possible-warnings.js +11 -0
- package/src/generators/application/lib/update-jest-config.d.ts +3 -0
- package/src/generators/application/lib/update-jest-config.js +30 -0
- package/src/generators/application/schema.d.ts +45 -0
- package/src/generators/application/schema.json +201 -0
- package/src/generators/component/component.d.ts +5 -0
- package/src/generators/component/component.js +93 -0
- package/src/generators/component/files/__fileName__.__style__ +0 -0
- package/src/generators/component/files/__fileName__.module.__style__ +7 -0
- package/src/generators/component/files/__fileName__.spec.tsx__tmpl__ +7 -0
- package/src/generators/component/files/__fileName__.tsx__tmpl__ +88 -0
- package/src/generators/component/lib/get-component-tests.d.ts +2 -0
- package/src/generators/component/lib/get-component-tests.js +12 -0
- package/src/generators/component/lib/normalize-options.d.ts +3 -0
- package/src/generators/component/lib/normalize-options.js +50 -0
- package/src/generators/component/schema.d.ts +48 -0
- package/src/generators/component/schema.json +150 -0
- package/src/generators/component-cypress-spec/component-cypress-spec.d.ts +13 -0
- package/src/generators/component-cypress-spec/component-cypress-spec.js +100 -0
- package/src/generators/component-cypress-spec/files/__componentName__.__fileExt__ +13 -0
- package/src/generators/component-cypress-spec/schema.json +44 -0
- package/src/generators/component-story/component-story.d.ts +12 -0
- package/src/generators/component-story/component-story.js +72 -0
- package/src/generators/component-story/files/jsx/__componentFileName__.stories.jsx__tmpl__ +29 -0
- package/src/generators/component-story/files/tsx/__componentFileName__.stories.tsx__tmpl__ +36 -0
- package/src/generators/component-story/schema.json +42 -0
- package/src/generators/component-test/component-test.d.ts +4 -0
- package/src/generators/component-test/component-test.js +76 -0
- package/src/generators/component-test/files/__fileName__.cy__ext__ +21 -0
- package/src/generators/component-test/schema.d.ts +4 -0
- package/src/generators/component-test/schema.js +2 -0
- package/src/generators/component-test/schema.json +31 -0
- package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts +10 -0
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +51 -0
- package/src/generators/cypress-component-configuration/lib/add-files.d.ts +4 -0
- package/src/generators/cypress-component-configuration/lib/add-files.js +45 -0
- package/src/generators/cypress-component-configuration/schema.d.ts +8 -0
- package/src/generators/cypress-component-configuration/schema.json +54 -0
- package/src/generators/federate-module/federate-module.d.ts +4 -0
- package/src/generators/federate-module/federate-module.js +70 -0
- package/src/generators/federate-module/lib/utils.d.ts +23 -0
- package/src/generators/federate-module/lib/utils.js +100 -0
- package/src/generators/federate-module/schema.d.ts +13 -0
- package/src/generators/federate-module/schema.json +83 -0
- package/src/generators/hook/files/__fileName__.spec.tsx__tmpl__ +18 -0
- package/src/generators/hook/files/__fileName__.ts__tmpl__ +15 -0
- package/src/generators/hook/hook.d.ts +5 -0
- package/src/generators/hook/hook.js +131 -0
- package/src/generators/hook/schema.d.ts +24 -0
- package/src/generators/hook/schema.json +84 -0
- package/src/generators/host/files/common/src/app/__fileName__.js__tmpl__ +33 -0
- package/src/generators/host/files/common/src/main.js__tmpl__ +10 -0
- package/src/generators/host/files/common/tsconfig.lint.json__tmpl__ +19 -0
- package/src/generators/host/files/common-ts/src/app/__fileName__.tsx__tmpl__ +41 -0
- package/src/generators/host/files/common-ts/src/main.ts__tmpl__ +10 -0
- package/src/generators/host/files/module-federation/module-federation.config.js__tmpl__ +21 -0
- package/src/generators/host/files/module-federation/webpack.config.js__tmpl__ +12 -0
- package/src/generators/host/files/module-federation/webpack.config.prod.js__tmpl__ +32 -0
- package/src/generators/host/files/module-federation-ssr/module-federation.server.config.js__tmpl__ +16 -0
- package/src/generators/host/files/module-federation-ssr/server.ts__tmpl__ +28 -0
- package/src/generators/host/files/module-federation-ssr/tsconfig.server.json__tmpl__ +17 -0
- package/src/generators/host/files/module-federation-ssr/webpack.server.config.js__tmpl__ +12 -0
- package/src/generators/host/files/module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +13 -0
- package/src/generators/host/files/module-federation-ssr-ts/server.ts__tmpl__ +28 -0
- package/src/generators/host/files/module-federation-ssr-ts/tsconfig.server.json__tmpl__ +17 -0
- package/src/generators/host/files/module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +12 -0
- package/src/generators/host/files/module-federation-ts/module-federation.config.ts__tmpl__ +25 -0
- package/src/generators/host/files/module-federation-ts/webpack.config.prod.ts__tmpl__ +33 -0
- package/src/generators/host/files/module-federation-ts/webpack.config.ts__tmpl__ +12 -0
- package/src/generators/host/host.d.ts +5 -0
- package/src/generators/host/host.js +95 -0
- package/src/generators/host/lib/add-module-federation-files.d.ts +6 -0
- package/src/generators/host/lib/add-module-federation-files.js +52 -0
- package/src/generators/host/lib/normalize-remote.d.ts +4 -0
- package/src/generators/host/lib/normalize-remote.js +28 -0
- package/src/generators/host/lib/setup-ssr-for-host.d.ts +6 -0
- package/src/generators/host/lib/setup-ssr-for-host.js +33 -0
- package/src/generators/host/lib/update-module-federation-e2e-project.d.ts +3 -0
- package/src/generators/host/lib/update-module-federation-e2e-project.js +20 -0
- package/src/generators/host/schema.d.ts +37 -0
- package/src/generators/host/schema.json +184 -0
- package/src/generators/init/init.d.ts +4 -0
- package/src/generators/init/init.js +23 -0
- package/src/generators/init/schema.d.ts +5 -0
- package/src/generators/init/schema.json +27 -0
- package/src/generators/library/files/common/README.md +7 -0
- package/src/generators/library/files/common/package.json__tmpl__ +4 -0
- package/src/generators/library/files/common/src/index.ts__tmpl__ +0 -0
- package/src/generators/library/files/common/tsconfig.lib.json__tmpl__ +14 -0
- package/src/generators/library/files/vite/README.md +7 -0
- package/src/generators/library/files/vite/package.json__tmpl__ +12 -0
- package/src/generators/library/files/vite/tsconfig.lib.json__tmpl__ +14 -0
- package/src/generators/library/lib/add-linting.d.ts +3 -0
- package/src/generators/library/lib/add-linting.js +36 -0
- package/src/generators/library/lib/add-rollup-build-target.d.ts +4 -0
- package/src/generators/library/lib/add-rollup-build-target.js +59 -0
- package/src/generators/library/lib/create-files.d.ts +3 -0
- package/src/generators/library/lib/create-files.js +53 -0
- package/src/generators/library/lib/install-common-dependencies.d.ts +3 -0
- package/src/generators/library/lib/install-common-dependencies.js +47 -0
- package/src/generators/library/lib/normalize-options.d.ts +3 -0
- package/src/generators/library/lib/normalize-options.js +92 -0
- package/src/generators/library/lib/set-defaults.d.ts +3 -0
- package/src/generators/library/lib/set-defaults.js +23 -0
- package/src/generators/library/lib/update-app-routes.d.ts +3 -0
- package/src/generators/library/lib/update-app-routes.js +62 -0
- package/src/generators/library/library.d.ts +5 -0
- package/src/generators/library/library.js +193 -0
- package/src/generators/library/schema.d.ts +45 -0
- package/src/generators/library/schema.json +198 -0
- package/src/generators/redux/files/__fileName__.slice.spec.ts__tmpl__ +56 -0
- package/src/generators/redux/files/__fileName__.slice.ts__tmpl__ +129 -0
- package/src/generators/redux/redux.d.ts +5 -0
- package/src/generators/redux/redux.js +143 -0
- package/src/generators/redux/schema.d.ts +23 -0
- package/src/generators/redux/schema.json +51 -0
- package/src/generators/remote/files/common/src/main.js__tmpl__ +1 -0
- package/src/generators/remote/files/common/src/remote-entry.js__tmpl__ +1 -0
- package/src/generators/remote/files/common-ts/src/main.ts__tmpl__ +1 -0
- package/src/generators/remote/files/common-ts/src/remote-entry.ts__tmpl__ +1 -0
- package/src/generators/remote/files/module-federation/module-federation.config.js__tmpl__ +9 -0
- package/src/generators/remote/files/module-federation/webpack.config.js__tmpl__ +12 -0
- package/src/generators/remote/files/module-federation/webpack.config.prod.js__tmpl__ +1 -0
- package/src/generators/remote/files/module-federation-ssr/module-federation.server.config.js__tmpl__ +6 -0
- package/src/generators/remote/files/module-federation-ssr/server.ts__tmpl__ +45 -0
- package/src/generators/remote/files/module-federation-ssr/webpack.server.config.js__tmpl__ +12 -0
- package/src/generators/remote/files/module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +10 -0
- package/src/generators/remote/files/module-federation-ssr-ts/server.ts__tmpl__ +45 -0
- package/src/generators/remote/files/module-federation-ssr-ts/tsconfig.lint.json__tmpl__ +19 -0
- package/src/generators/remote/files/module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +12 -0
- package/src/generators/remote/files/module-federation-ts/module-federation.config.ts__tmpl__ +13 -0
- package/src/generators/remote/files/module-federation-ts/tsconfig.lint.json__tmpl__ +19 -0
- package/src/generators/remote/files/module-federation-ts/webpack.config.prod.ts__tmpl__ +1 -0
- package/src/generators/remote/files/module-federation-ts/webpack.config.ts__tmpl__ +12 -0
- package/src/generators/remote/lib/add-remote-to-dynamic-host.d.ts +2 -0
- package/src/generators/remote/lib/add-remote-to-dynamic-host.js +11 -0
- package/src/generators/remote/lib/setup-ssr-for-remote.d.ts +4 -0
- package/src/generators/remote/lib/setup-ssr-for-remote.js +40 -0
- package/src/generators/remote/lib/setup-tspath-for-remote.d.ts +3 -0
- package/src/generators/remote/lib/setup-tspath-for-remote.js +15 -0
- package/src/generators/remote/lib/update-host-with-remote.d.ts +2 -0
- package/src/generators/remote/lib/update-host-with-remote.js +64 -0
- package/src/generators/remote/remote.d.ts +7 -0
- package/src/generators/remote/remote.js +104 -0
- package/src/generators/remote/schema.d.ts +34 -0
- package/src/generators/remote/schema.json +183 -0
- package/src/generators/setup-ssr/files/server.ts__tmpl__ +28 -0
- package/src/generators/setup-ssr/files/src/main.server.tsx__tmpl__ +47 -0
- package/src/generators/setup-ssr/files/tsconfig.server.json__tmpl__ +17 -0
- package/src/generators/setup-ssr/schema.d.ts +7 -0
- package/src/generators/setup-ssr/schema.json +48 -0
- package/src/generators/setup-ssr/setup-ssr.d.ts +4 -0
- package/src/generators/setup-ssr/setup-ssr.js +183 -0
- package/src/generators/setup-tailwind/files/postcss.config.js__tmpl__ +15 -0
- package/src/generators/setup-tailwind/files/tailwind.config.js__tmpl__ +17 -0
- package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.d.ts +3 -0
- package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js +36 -0
- package/src/generators/setup-tailwind/lib/update-project.d.ts +3 -0
- package/src/generators/setup-tailwind/lib/update-project.js +13 -0
- package/src/generators/setup-tailwind/schema.d.ts +6 -0
- package/src/generators/setup-tailwind/schema.js +2 -0
- package/src/generators/setup-tailwind/schema.json +47 -0
- package/src/generators/setup-tailwind/setup-tailwind.d.ts +4 -0
- package/src/generators/setup-tailwind/setup-tailwind.js +35 -0
- package/src/generators/stories/schema.json +67 -0
- package/src/generators/stories/stories.d.ts +15 -0
- package/src/generators/stories/stories.js +130 -0
- package/src/generators/storybook-configuration/configuration.d.ts +6 -0
- package/src/generators/storybook-configuration/configuration.js +74 -0
- package/src/generators/storybook-configuration/schema.d.ts +16 -0
- package/src/generators/storybook-configuration/schema.json +95 -0
- package/src/migrations/update-15-3-0/install-webpack-rollup-dependencies.d.ts +3 -0
- package/src/migrations/update-15-3-0/install-webpack-rollup-dependencies.js +37 -0
- package/src/migrations/update-15-3-0/update-rollup-executor.d.ts +3 -0
- package/src/migrations/update-15-3-0/update-rollup-executor.js +15 -0
- package/src/migrations/update-15-6-3/webpack-config-setup.d.ts +2 -0
- package/src/migrations/update-15-6-3/webpack-config-setup.js +103 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +9 -0
- package/src/migrations/update-16-2-0-remove-package/update-16-2-0-remove-package.d.ts +2 -0
- package/src/migrations/update-16-2-0-remove-package/update-16-2-0-remove-package.js +8 -0
- package/src/migrations/update-16-3-0/remove-types-react-router-dom-package.d.ts +2 -0
- package/src/migrations/update-16-3-0/remove-types-react-router-dom-package.js +8 -0
- package/src/migrations/update-16-7-0/add-babel-core.d.ts +2 -0
- package/src/migrations/update-16-7-0/add-babel-core.js +14 -0
- package/src/migrations/update-16-7-0-add-typings/update-16-7-0-add-typings.d.ts +2 -0
- package/src/migrations/update-16-7-0-add-typings/update-16-7-0-add-typings.js +57 -0
- package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.d.ts +2 -0
- package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.js +26 -0
- package/src/module-federation/ast-utils.d.ts +8 -0
- package/src/module-federation/ast-utils.js +102 -0
- package/src/module-federation/load-config.d.ts +3 -0
- package/src/module-federation/load-config.js +16 -0
- package/src/module-federation/models.d.ts +24 -0
- package/src/module-federation/models.js +2 -0
- package/src/module-federation/package-json.d.ts +8 -0
- package/src/module-federation/package-json.js +13 -0
- package/src/module-federation/utils.d.ts +12 -0
- package/src/module-federation/utils.js +76 -0
- package/src/module-federation/with-module-federation-ssr.d.ts +2 -0
- package/src/module-federation/with-module-federation-ssr.js +34 -0
- package/src/module-federation/with-module-federation.d.ts +7 -0
- package/src/module-federation/with-module-federation.js +50 -0
- package/src/rules/add-styled-dependencies.d.ts +5 -0
- package/src/rules/add-styled-dependencies.js +17 -0
- package/src/rules/update-module-federation-project.d.ts +9 -0
- package/src/rules/update-module-federation-project.js +50 -0
- package/src/utils/add-mf-env-to-inputs.d.ts +2 -0
- package/src/utils/add-mf-env-to-inputs.js +24 -0
- package/src/utils/assertion.d.ts +1 -0
- package/src/utils/assertion.js +19 -0
- package/src/utils/ast-utils.d.ts +29 -0
- package/src/utils/ast-utils.js +522 -0
- package/src/utils/component-props.d.ts +15 -0
- package/src/utils/component-props.js +60 -0
- package/src/utils/create-ts-config.d.ts +9 -0
- package/src/utils/create-ts-config.js +65 -0
- package/src/utils/ct-utils.d.ts +14 -0
- package/src/utils/ct-utils.js +94 -0
- package/src/utils/dependencies.d.ts +7 -0
- package/src/utils/dependencies.js +2 -0
- package/src/utils/format-file.d.ts +1 -0
- package/src/utils/format-file.js +12 -0
- package/src/utils/get-in-source-vitest-tests-template.d.ts +1 -0
- package/src/utils/get-in-source-vitest-tests-template.js +21 -0
- package/src/utils/has-vite-plugin.d.ts +2 -0
- package/src/utils/has-vite-plugin.js +11 -0
- package/src/utils/has-webpack-plugin.d.ts +2 -0
- package/src/utils/has-webpack-plugin.js +11 -0
- package/src/utils/jest-utils.d.ts +1 -0
- package/src/utils/jest-utils.js +9 -0
- package/src/utils/lint.d.ts +36 -0
- package/src/utils/lint.js +24 -0
- package/src/utils/maybe-js.d.ts +3 -0
- package/src/utils/maybe-js.js +9 -0
- package/src/utils/styled.d.ts +3 -0
- package/src/utils/styled.js +62 -0
- package/src/utils/testing-generators.d.ts +3 -0
- package/src/utils/testing-generators.js +30 -0
- package/src/utils/versions.d.ts +46 -0
- package/src/utils/versions.js +54 -0
- package/tailwind.d.ts +6 -0
- package/tailwind.js +29 -0
- package/typings/cssmodule.d.ts +19 -0
- package/typings/image.d.ts +48 -0
- package/typings/style.d.ts +9 -0
- package/typings/styled-jsx.d.ts +8 -0
package/src/generators/application/files/style-css-module/src/app/__fileName__.module.__style__
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* Your styles goes here. */
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<% if (classComponent) { %>
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
<% } %>
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
|
+
import styles from './<%= fileName %>.module.<%= style %>';
|
|
6
|
+
<% if (!minimal) { %>
|
|
7
|
+
import NxWelcome from "./nx-welcome";
|
|
8
|
+
<% } %>
|
|
9
|
+
|
|
10
|
+
<% if (classComponent) { %>
|
|
11
|
+
export class App extends Component {
|
|
12
|
+
render() {
|
|
13
|
+
<% } else { %>
|
|
14
|
+
export function App() {
|
|
15
|
+
<% } %>
|
|
16
|
+
return (
|
|
17
|
+
<div>
|
|
18
|
+
<% if (!minimal) { %>
|
|
19
|
+
<NxWelcome title="<%= projectName %>"/>
|
|
20
|
+
<% } else { %>
|
|
21
|
+
<h1>
|
|
22
|
+
<span> Hello there, </span>
|
|
23
|
+
Welcome <%= projectName %> 👋
|
|
24
|
+
</h1>
|
|
25
|
+
<% } %>
|
|
26
|
+
</div>);
|
|
27
|
+
<% if (classComponent) { %>
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
<% } else { %>
|
|
31
|
+
}
|
|
32
|
+
<% } %>
|
|
33
|
+
|
|
34
|
+
export default App;
|
|
35
|
+
|
|
36
|
+
<% if (inSourceTests === true) { %> <%- inSourceVitestTests %> <% } %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* You can add global styles to this file, and also import other style files */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* Your styles goes here. */
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<% if (classComponent) { %>
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
<% } %>
|
|
4
|
+
import './<%= fileName %>.<%= style %>';
|
|
5
|
+
<% if (!minimal) { %>
|
|
6
|
+
import NxWelcome from "./nx-welcome";
|
|
7
|
+
<% } %>
|
|
8
|
+
|
|
9
|
+
<% if (classComponent) { %>
|
|
10
|
+
export class App extends Component {
|
|
11
|
+
render() {
|
|
12
|
+
<% } else { %>
|
|
13
|
+
export function App() {
|
|
14
|
+
<% } %>
|
|
15
|
+
return (
|
|
16
|
+
<div>
|
|
17
|
+
<% if (!minimal) { %>
|
|
18
|
+
<NxWelcome title="<%= projectName %>"/>
|
|
19
|
+
<% } else { %>
|
|
20
|
+
<h1>
|
|
21
|
+
<span> Hello there, </span>
|
|
22
|
+
Welcome <%= projectName %> 👋
|
|
23
|
+
</h1>
|
|
24
|
+
<% } %>
|
|
25
|
+
</div>);
|
|
26
|
+
<% if (classComponent) { %>
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
<% } else { %>
|
|
30
|
+
}
|
|
31
|
+
<% } %>
|
|
32
|
+
|
|
33
|
+
export default App;
|
|
34
|
+
|
|
35
|
+
<% if (inSourceTests === true) { %> <%- inSourceVitestTests %> <% } %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* You can add global styles to this file, and also import other style files */
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<% if (classComponent) { %>
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
<% } %>
|
|
4
|
+
<% if (!minimal) { %>
|
|
5
|
+
import NxWelcome from "./nx-welcome";
|
|
6
|
+
<% } %>
|
|
7
|
+
|
|
8
|
+
<% if (classComponent) { %>
|
|
9
|
+
export class App extends Component {
|
|
10
|
+
override render() {
|
|
11
|
+
<% } else { %>
|
|
12
|
+
export function App() {
|
|
13
|
+
<% } %>
|
|
14
|
+
return (
|
|
15
|
+
<div>
|
|
16
|
+
<% if (!minimal) { %>
|
|
17
|
+
<NxWelcome title="<%= projectName %>"/>
|
|
18
|
+
<% } else { %>
|
|
19
|
+
<h1>
|
|
20
|
+
<span> Hello there, </span>
|
|
21
|
+
Welcome <%= projectName %> 👋
|
|
22
|
+
</h1>
|
|
23
|
+
<% } %>
|
|
24
|
+
</div>);
|
|
25
|
+
<% if (classComponent) { %>
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
<% } else { %>
|
|
29
|
+
}
|
|
30
|
+
<% } %>
|
|
31
|
+
|
|
32
|
+
export default App;
|
|
33
|
+
|
|
34
|
+
<% if (inSourceTests === true) { %> <%- inSourceVitestTests %> <% } %>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<% if (classComponent) { %>
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
<% } %>
|
|
4
|
+
<% if (!minimal) { %>
|
|
5
|
+
import NxWelcome from "./nx-welcome";
|
|
6
|
+
<% } %>
|
|
7
|
+
|
|
8
|
+
<% if (classComponent) { %>
|
|
9
|
+
export class App extends Component {
|
|
10
|
+
render() {
|
|
11
|
+
<% } else { %>
|
|
12
|
+
export function App() {
|
|
13
|
+
<% } %>
|
|
14
|
+
return (
|
|
15
|
+
<div>
|
|
16
|
+
<style jsx>{`/** your style here **/`}</style>
|
|
17
|
+
<% if (!minimal) { %>
|
|
18
|
+
<NxWelcome title="<%= projectName %>"/>
|
|
19
|
+
<% } else { %>
|
|
20
|
+
<h1>
|
|
21
|
+
<span> Hello there, </span>
|
|
22
|
+
Welcome <%= projectName %> 👋
|
|
23
|
+
</h1>
|
|
24
|
+
<% } %>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
<% if (classComponent) { %>
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
<% } else { %>
|
|
32
|
+
}
|
|
33
|
+
<% } %>
|
|
34
|
+
|
|
35
|
+
export default App;
|
|
36
|
+
|
|
37
|
+
<% if (inSourceTests === true) { %> <%- inSourceVitestTests %> <% } %>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<% if (classComponent) { %>
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
<% } %>
|
|
4
|
+
import styled from '<%= styledModule %>';
|
|
5
|
+
<% if (!minimal) { %>
|
|
6
|
+
import NxWelcome from "./nx-welcome";
|
|
7
|
+
<% } %>
|
|
8
|
+
|
|
9
|
+
const StyledApp = styled.div`
|
|
10
|
+
// Your style here
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
<% if (classComponent) { %>
|
|
14
|
+
export class App extends Component {
|
|
15
|
+
render() {
|
|
16
|
+
<% } else { %>
|
|
17
|
+
export function App() {
|
|
18
|
+
<% } %>
|
|
19
|
+
return (
|
|
20
|
+
<StyledApp>
|
|
21
|
+
<% if (!minimal) { %>
|
|
22
|
+
<NxWelcome title="<%= projectName %>"/>
|
|
23
|
+
<% } else { %>
|
|
24
|
+
<h1>
|
|
25
|
+
<span> Hello there, </span>
|
|
26
|
+
Welcome <%= projectName %> 👋
|
|
27
|
+
</h1>
|
|
28
|
+
<% } %>
|
|
29
|
+
</StyledApp>
|
|
30
|
+
);
|
|
31
|
+
<% if (classComponent) { %>
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
<% } else { %>
|
|
35
|
+
}
|
|
36
|
+
<% } %>
|
|
37
|
+
|
|
38
|
+
export default App;
|
|
39
|
+
|
|
40
|
+
<% if (inSourceTests === true) { %> <%- inSourceVitestTests %> <% } %>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<% if (classComponent) { %>
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
<% } if (!minimal) { %>
|
|
4
|
+
import NxWelcome from "./nx-welcome";
|
|
5
|
+
<% } %>
|
|
6
|
+
|
|
7
|
+
<% if (classComponent) { %>
|
|
8
|
+
export class App extends Component {
|
|
9
|
+
render() {
|
|
10
|
+
<% } else { %>
|
|
11
|
+
export function App() {
|
|
12
|
+
<% } %>
|
|
13
|
+
return (
|
|
14
|
+
<div>
|
|
15
|
+
<% if (!minimal) { %>
|
|
16
|
+
<NxWelcome title="<%= projectName %>"/>
|
|
17
|
+
<% } else { %>
|
|
18
|
+
<h1>
|
|
19
|
+
<span> Hello there, </span>
|
|
20
|
+
Welcome <%= projectName %> 👋
|
|
21
|
+
</h1>
|
|
22
|
+
<% } %>
|
|
23
|
+
</div>);
|
|
24
|
+
<% if (classComponent) { %>
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
<% } else { %>
|
|
28
|
+
}
|
|
29
|
+
<% } %>
|
|
30
|
+
|
|
31
|
+
export default App;
|
|
32
|
+
|
|
33
|
+
<% if (inSourceTests === true) { %> <%- inSourceVitestTests %> <% } %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* You can add global styles to this file, and also import other style files */
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addE2e = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const web_1 = require("@nx/web");
|
|
6
|
+
const versions_1 = require("../../../utils/versions");
|
|
7
|
+
const has_webpack_plugin_1 = require("../../../utils/has-webpack-plugin");
|
|
8
|
+
const has_vite_plugin_1 = require("../../../utils/has-vite-plugin");
|
|
9
|
+
async function addE2e(tree, options) {
|
|
10
|
+
switch (options.e2eTestRunner) {
|
|
11
|
+
case 'cypress': {
|
|
12
|
+
const hasNxBuildPlugin = (options.bundler === 'webpack' && (0, has_webpack_plugin_1.hasWebpackPlugin)(tree)) ||
|
|
13
|
+
(options.bundler === 'vite' && (0, has_vite_plugin_1.hasVitePlugin)(tree));
|
|
14
|
+
if (!hasNxBuildPlugin) {
|
|
15
|
+
(0, web_1.webStaticServeGenerator)(tree, {
|
|
16
|
+
buildTarget: `${options.projectName}:build`,
|
|
17
|
+
targetName: 'serve-static',
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
21
|
+
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
22
|
+
projectType: 'application',
|
|
23
|
+
root: options.e2eProjectRoot,
|
|
24
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
25
|
+
targets: {},
|
|
26
|
+
implicitDependencies: [options.projectName],
|
|
27
|
+
tags: [],
|
|
28
|
+
});
|
|
29
|
+
return await configurationGenerator(tree, {
|
|
30
|
+
...options,
|
|
31
|
+
project: options.e2eProjectName,
|
|
32
|
+
directory: 'src',
|
|
33
|
+
// the name and root are already normalized, instruct the generator to use them as is
|
|
34
|
+
bundler: options.bundler === 'rspack' ? 'webpack' : options.bundler,
|
|
35
|
+
skipFormat: true,
|
|
36
|
+
devServerTarget: `${options.projectName}:serve`,
|
|
37
|
+
baseUrl: `http://localhost:${options.devServerPort ?? 4200}`,
|
|
38
|
+
jsx: true,
|
|
39
|
+
rootProject: options.rootProject,
|
|
40
|
+
webServerCommands: hasNxBuildPlugin
|
|
41
|
+
? {
|
|
42
|
+
default: `nx run ${options.projectName}:serve`,
|
|
43
|
+
production: `nx run ${options.projectName}:preview`,
|
|
44
|
+
}
|
|
45
|
+
: undefined,
|
|
46
|
+
ciWebServerCommand: hasNxBuildPlugin
|
|
47
|
+
? `nx run ${options.projectName}:serve-static`
|
|
48
|
+
: undefined,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
case 'playwright': {
|
|
52
|
+
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
|
|
53
|
+
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
54
|
+
projectType: 'application',
|
|
55
|
+
root: options.e2eProjectRoot,
|
|
56
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
57
|
+
targets: {},
|
|
58
|
+
implicitDependencies: [options.projectName],
|
|
59
|
+
});
|
|
60
|
+
return configurationGenerator(tree, {
|
|
61
|
+
project: options.e2eProjectName,
|
|
62
|
+
skipFormat: true,
|
|
63
|
+
skipPackageJson: options.skipPackageJson,
|
|
64
|
+
directory: 'src',
|
|
65
|
+
js: false,
|
|
66
|
+
linter: options.linter,
|
|
67
|
+
setParserOptionsProject: options.setParserOptionsProject,
|
|
68
|
+
webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx serve ${options.name}`,
|
|
69
|
+
webServerAddress: `http://localhost:${options.devServerPort ?? 4200}`,
|
|
70
|
+
rootProject: options.rootProject,
|
|
71
|
+
addPlugin: options.addPlugin,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
case 'none':
|
|
75
|
+
default:
|
|
76
|
+
return () => { };
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.addE2e = addE2e;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addJest = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const versions_1 = require("../../../utils/versions");
|
|
6
|
+
async function addJest(host, options) {
|
|
7
|
+
if (options.unitTestRunner === 'none') {
|
|
8
|
+
return () => { };
|
|
9
|
+
}
|
|
10
|
+
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/jest', versions_1.nxVersion);
|
|
11
|
+
return await configurationGenerator(host, {
|
|
12
|
+
...options,
|
|
13
|
+
project: options.projectName,
|
|
14
|
+
supportTsx: true,
|
|
15
|
+
skipSerializers: true,
|
|
16
|
+
setupFile: 'none',
|
|
17
|
+
compiler: options.compiler,
|
|
18
|
+
skipFormat: true,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.addJest = addJest;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addProject = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const has_webpack_plugin_1 = require("../../../utils/has-webpack-plugin");
|
|
6
|
+
const maybe_js_1 = require("../../../utils/maybe-js");
|
|
7
|
+
function addProject(host, options) {
|
|
8
|
+
const project = {
|
|
9
|
+
root: options.appProjectRoot,
|
|
10
|
+
sourceRoot: `${options.appProjectRoot}/src`,
|
|
11
|
+
projectType: 'application',
|
|
12
|
+
targets: {},
|
|
13
|
+
tags: options.parsedTags,
|
|
14
|
+
};
|
|
15
|
+
if (options.bundler === 'webpack') {
|
|
16
|
+
if (!(0, has_webpack_plugin_1.hasWebpackPlugin)(host) || !options.addPlugin) {
|
|
17
|
+
project.targets = {
|
|
18
|
+
build: createBuildTarget(options),
|
|
19
|
+
serve: createServeTarget(options),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
(0, devkit_1.addProjectConfiguration)(host, options.projectName, {
|
|
24
|
+
...project,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.addProject = addProject;
|
|
28
|
+
function createBuildTarget(options) {
|
|
29
|
+
return {
|
|
30
|
+
executor: '@nx/webpack:webpack',
|
|
31
|
+
outputs: ['{options.outputPath}'],
|
|
32
|
+
defaultConfiguration: 'production',
|
|
33
|
+
options: {
|
|
34
|
+
compiler: options.compiler ?? 'babel',
|
|
35
|
+
outputPath: (0, devkit_1.joinPathFragments)('dist', options.appProjectRoot != '.'
|
|
36
|
+
? options.appProjectRoot
|
|
37
|
+
: options.projectName),
|
|
38
|
+
index: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'src/index.html'),
|
|
39
|
+
baseHref: '/',
|
|
40
|
+
main: (0, devkit_1.joinPathFragments)(options.appProjectRoot, (0, maybe_js_1.maybeJs)(options, `src/main.tsx`)),
|
|
41
|
+
tsConfig: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
|
|
42
|
+
assets: [
|
|
43
|
+
(0, devkit_1.joinPathFragments)(options.appProjectRoot, 'src/favicon.ico'),
|
|
44
|
+
(0, devkit_1.joinPathFragments)(options.appProjectRoot, 'src/assets'),
|
|
45
|
+
],
|
|
46
|
+
styles: options.styledModule || !options.hasStyles
|
|
47
|
+
? []
|
|
48
|
+
: [
|
|
49
|
+
(0, devkit_1.joinPathFragments)(options.appProjectRoot, `src/styles.${options.style}`),
|
|
50
|
+
],
|
|
51
|
+
scripts: [],
|
|
52
|
+
webpackConfig: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'webpack.config.js'),
|
|
53
|
+
},
|
|
54
|
+
configurations: {
|
|
55
|
+
development: {
|
|
56
|
+
extractLicenses: false,
|
|
57
|
+
optimization: false,
|
|
58
|
+
sourceMap: true,
|
|
59
|
+
vendorChunk: true,
|
|
60
|
+
},
|
|
61
|
+
production: {
|
|
62
|
+
fileReplacements: [
|
|
63
|
+
{
|
|
64
|
+
replace: (0, devkit_1.joinPathFragments)(options.appProjectRoot, (0, maybe_js_1.maybeJs)(options, `src/environments/environment.ts`)),
|
|
65
|
+
with: (0, devkit_1.joinPathFragments)(options.appProjectRoot, (0, maybe_js_1.maybeJs)(options, `src/environments/environment.prod.ts`)),
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
optimization: true,
|
|
69
|
+
outputHashing: 'all',
|
|
70
|
+
sourceMap: false,
|
|
71
|
+
namedChunks: false,
|
|
72
|
+
extractLicenses: true,
|
|
73
|
+
vendorChunk: false,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function createServeTarget(options) {
|
|
79
|
+
return {
|
|
80
|
+
executor: '@nx/webpack:dev-server',
|
|
81
|
+
defaultConfiguration: 'development',
|
|
82
|
+
options: {
|
|
83
|
+
buildTarget: `${options.projectName}:build`,
|
|
84
|
+
hmr: true,
|
|
85
|
+
},
|
|
86
|
+
configurations: {
|
|
87
|
+
development: {
|
|
88
|
+
buildTarget: `${options.projectName}:build:development`,
|
|
89
|
+
},
|
|
90
|
+
production: {
|
|
91
|
+
buildTarget: `${options.projectName}:build:production`,
|
|
92
|
+
hmr: false,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addRouting = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
6
|
+
const ast_utils_1 = require("../../../utils/ast-utils");
|
|
7
|
+
const versions_1 = require("../../../utils/versions");
|
|
8
|
+
const maybe_js_1 = require("../../../utils/maybe-js");
|
|
9
|
+
let tsModule;
|
|
10
|
+
function addRouting(host, options) {
|
|
11
|
+
if (!options.routing) {
|
|
12
|
+
return () => { };
|
|
13
|
+
}
|
|
14
|
+
if (!tsModule) {
|
|
15
|
+
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
16
|
+
}
|
|
17
|
+
const appPath = (0, devkit_1.joinPathFragments)(options.appProjectRoot, (0, maybe_js_1.maybeJs)(options, `src/app/${options.fileName}.tsx`));
|
|
18
|
+
const appFileContent = host.read(appPath, 'utf-8');
|
|
19
|
+
const appSource = tsModule.createSourceFile(appPath, appFileContent, tsModule.ScriptTarget.Latest, true);
|
|
20
|
+
const changes = (0, devkit_1.applyChangesToString)(appFileContent, (0, ast_utils_1.addInitialRoutes)(appPath, appSource));
|
|
21
|
+
host.write(appPath, changes);
|
|
22
|
+
if (!options.skipPackageJson) {
|
|
23
|
+
return (0, devkit_1.addDependenciesToPackageJson)(host, { 'react-router-dom': versions_1.reactRouterDomVersion }, {});
|
|
24
|
+
}
|
|
25
|
+
return () => { };
|
|
26
|
+
}
|
|
27
|
+
exports.addRouting = addRouting;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createApplicationFiles = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const js_1 = require("@nx/js");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const create_ts_config_1 = require("../../../utils/create-ts-config");
|
|
8
|
+
const get_in_source_vitest_tests_template_1 = require("../../../utils/get-in-source-vitest-tests-template");
|
|
9
|
+
const maybe_js_1 = require("../../../utils/maybe-js");
|
|
10
|
+
const has_webpack_plugin_1 = require("../../../utils/has-webpack-plugin");
|
|
11
|
+
const get_app_tests_1 = require("./get-app-tests");
|
|
12
|
+
function createApplicationFiles(host, options) {
|
|
13
|
+
let styleSolutionSpecificAppFiles;
|
|
14
|
+
if (options.styledModule && options.style !== 'styled-jsx') {
|
|
15
|
+
styleSolutionSpecificAppFiles = '../files/style-styled-module';
|
|
16
|
+
}
|
|
17
|
+
else if (options.style === 'styled-jsx') {
|
|
18
|
+
styleSolutionSpecificAppFiles = '../files/style-styled-jsx';
|
|
19
|
+
}
|
|
20
|
+
else if (options.style === 'tailwind') {
|
|
21
|
+
styleSolutionSpecificAppFiles = '../files/style-tailwind';
|
|
22
|
+
}
|
|
23
|
+
else if (options.style === 'none') {
|
|
24
|
+
styleSolutionSpecificAppFiles = '../files/style-none';
|
|
25
|
+
}
|
|
26
|
+
else if (options.globalCss) {
|
|
27
|
+
styleSolutionSpecificAppFiles = '../files/style-global-css';
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
styleSolutionSpecificAppFiles = '../files/style-css-module';
|
|
31
|
+
}
|
|
32
|
+
const relativePathToRootTsConfig = (0, js_1.getRelativePathToRootTsConfig)(host, options.appProjectRoot);
|
|
33
|
+
const appTests = (0, get_app_tests_1.getAppTests)(options);
|
|
34
|
+
const templateVariables = {
|
|
35
|
+
...(0, devkit_1.names)(options.name),
|
|
36
|
+
...options,
|
|
37
|
+
tmpl: '',
|
|
38
|
+
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.appProjectRoot),
|
|
39
|
+
appTests,
|
|
40
|
+
inSourceVitestTests: (0, get_in_source_vitest_tests_template_1.getInSourceVitestTestsTemplate)(appTests),
|
|
41
|
+
};
|
|
42
|
+
if (options.bundler === 'vite') {
|
|
43
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/base-vite'), options.appProjectRoot, templateVariables);
|
|
44
|
+
}
|
|
45
|
+
else if (options.bundler === 'webpack') {
|
|
46
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/base-webpack'), options.appProjectRoot, {
|
|
47
|
+
...templateVariables,
|
|
48
|
+
webpackPluginOptions: (0, has_webpack_plugin_1.hasWebpackPlugin)(host)
|
|
49
|
+
? createNxWebpackPluginOptions(options)
|
|
50
|
+
: null,
|
|
51
|
+
});
|
|
52
|
+
if (options.compiler === 'babel') {
|
|
53
|
+
(0, devkit_1.writeJson)(host, `${options.appProjectRoot}/.babelrc`, {
|
|
54
|
+
presets: [
|
|
55
|
+
[
|
|
56
|
+
'@nx/react/babel',
|
|
57
|
+
{
|
|
58
|
+
runtime: 'automatic',
|
|
59
|
+
importSource: options.style === '@emotion/styled'
|
|
60
|
+
? '@emotion/react'
|
|
61
|
+
: undefined,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
],
|
|
65
|
+
plugins: [
|
|
66
|
+
options.style === 'styled-components'
|
|
67
|
+
? ['styled-components', { pure: true, ssr: true }]
|
|
68
|
+
: undefined,
|
|
69
|
+
options.style === 'styled-jsx' ? 'styled-jsx/babel' : undefined,
|
|
70
|
+
options.style === '@emotion/styled'
|
|
71
|
+
? '@emotion/babel-plugin'
|
|
72
|
+
: undefined,
|
|
73
|
+
].filter(Boolean),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
else if (options.compiler === 'swc') {
|
|
77
|
+
const swcrc = {
|
|
78
|
+
jsc: {
|
|
79
|
+
target: 'es2016',
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
if (options.style === 'styled-components') {
|
|
83
|
+
swcrc.jsc.experimental = {
|
|
84
|
+
plugins: [
|
|
85
|
+
[
|
|
86
|
+
'@swc/plugin-styled-components',
|
|
87
|
+
{
|
|
88
|
+
displayName: true,
|
|
89
|
+
ssr: true,
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
else if (options.style === '@emotion/styled') {
|
|
96
|
+
swcrc.jsc.experimental = {
|
|
97
|
+
plugins: [['@swc/plugin-emotion', {}]],
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
else if (options.style === 'styled-jsx') {
|
|
101
|
+
swcrc.jsc.experimental = {
|
|
102
|
+
plugins: [['@swc/plugin-styled-jsx', {}]],
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
(0, devkit_1.writeJson)(host, `${options.appProjectRoot}/.swcrc`, swcrc);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else if (options.bundler === 'rspack') {
|
|
109
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/base-rspack'), options.appProjectRoot, templateVariables);
|
|
110
|
+
}
|
|
111
|
+
if (options.unitTestRunner === 'none' ||
|
|
112
|
+
(options.unitTestRunner === 'vitest' && options.inSourceTests == true)) {
|
|
113
|
+
host.delete(`${options.appProjectRoot}/src/app/${options.fileName}.spec.tsx`);
|
|
114
|
+
}
|
|
115
|
+
if (!options.minimal) {
|
|
116
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/nx-welcome'), options.appProjectRoot, templateVariables);
|
|
117
|
+
}
|
|
118
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, styleSolutionSpecificAppFiles), options.appProjectRoot, templateVariables);
|
|
119
|
+
if (options.js) {
|
|
120
|
+
(0, devkit_1.toJS)(host);
|
|
121
|
+
}
|
|
122
|
+
(0, create_ts_config_1.createTsConfig)(host, options.appProjectRoot, 'app', options, relativePathToRootTsConfig);
|
|
123
|
+
}
|
|
124
|
+
exports.createApplicationFiles = createApplicationFiles;
|
|
125
|
+
function createNxWebpackPluginOptions(options) {
|
|
126
|
+
return {
|
|
127
|
+
target: 'web',
|
|
128
|
+
compiler: options.compiler ?? 'babel',
|
|
129
|
+
outputPath: (0, devkit_1.joinPathFragments)('dist', options.appProjectRoot != '.'
|
|
130
|
+
? options.appProjectRoot
|
|
131
|
+
: options.projectName),
|
|
132
|
+
index: './src/index.html',
|
|
133
|
+
baseHref: '/',
|
|
134
|
+
main: (0, maybe_js_1.maybeJs)(options, `./src/main.tsx`),
|
|
135
|
+
tsConfig: './tsconfig.app.json',
|
|
136
|
+
assets: ['./src/favicon.ico', './src/assets'],
|
|
137
|
+
styles: options.styledModule || !options.hasStyles
|
|
138
|
+
? []
|
|
139
|
+
: [
|
|
140
|
+
`./src/styles.${options.style !== 'tailwind' ? options.style : 'css'}`,
|
|
141
|
+
],
|
|
142
|
+
};
|
|
143
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findFreePort = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function findFreePort(host) {
|
|
6
|
+
const projects = (0, devkit_1.getProjects)(host);
|
|
7
|
+
let port = -Infinity;
|
|
8
|
+
for (const [, p] of projects.entries()) {
|
|
9
|
+
const curr = p.targets?.serve?.options?.port;
|
|
10
|
+
if (typeof curr === 'number') {
|
|
11
|
+
port = Math.max(port, curr);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return port > 0 ? port + 1 : 4200;
|
|
15
|
+
}
|
|
16
|
+
exports.findFreePort = findFreePort;
|