@nx/react 16.0.0-beta.1
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/CHANGELOG.md +8 -0
- package/LICENSE +22 -0
- package/README.md +63 -0
- package/ast-utils.d.ts +1 -0
- package/ast-utils.js +12 -0
- package/ast-utils.js.map +1 -0
- package/babel.d.ts +16 -0
- package/babel.js +52 -0
- package/babel.js.map +1 -0
- package/executors.json +26 -0
- package/generators.json +223 -0
- package/index.d.ts +21 -0
- package/index.js +47 -0
- package/index.js.map +1 -0
- package/migrations.json +870 -0
- package/module-federation.d.ts +4 -0
- package/module-federation.js +13 -0
- package/module-federation.js.map +1 -0
- package/package.json +49 -0
- package/plugins/bundle-rollup.d.ts +1 -0
- package/plugins/bundle-rollup.js +42 -0
- package/plugins/bundle-rollup.js.map +1 -0
- package/plugins/component-testing/index.d.ts +38 -0
- package/plugins/component-testing/index.js +122 -0
- package/plugins/component-testing/index.js.map +1 -0
- package/plugins/component-testing/webpack-fallback.d.ts +5 -0
- package/plugins/component-testing/webpack-fallback.js +135 -0
- package/plugins/component-testing/webpack-fallback.js.map +1 -0
- package/plugins/jest.d.ts +1 -0
- package/plugins/jest.js +62 -0
- package/plugins/jest.js.map +1 -0
- package/plugins/storybook/index.d.ts +3 -0
- package/plugins/storybook/index.js +77 -0
- package/plugins/storybook/index.js.map +1 -0
- package/plugins/storybook/merge-plugins.d.ts +3 -0
- package/plugins/storybook/merge-plugins.js +18 -0
- package/plugins/storybook/merge-plugins.js.map +1 -0
- package/plugins/webpack.d.ts +3 -0
- package/plugins/webpack.js +15 -0
- package/plugins/webpack.js.map +1 -0
- package/plugins/with-react.d.ts +12 -0
- package/plugins/with-react.js +82 -0
- package/plugins/with-react.js.map +1 -0
- package/src/executors/module-federation-dev-server/compat.d.ts +2 -0
- package/src/executors/module-federation-dev-server/compat.js +6 -0
- package/src/executors/module-federation-dev-server/compat.js.map +1 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +11 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +55 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js.map +1 -0
- package/src/executors/module-federation-dev-server/schema.json +96 -0
- package/src/executors/module-federation-ssr-dev-server/compat.d.ts +2 -0
- package/src/executors/module-federation-ssr-dev-server/compat.js +6 -0
- package/src/executors/module-federation-ssr-dev-server/compat.js.map +1 -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 +71 -0
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js.map +1 -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 +129 -0
- package/src/generators/application/application.js.map +1 -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/.babelrc__tmpl__ +13 -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/environments/environment.prod.ts__tmpl__ +3 -0
- package/src/generators/application/files/base-webpack/src/environments/environment.ts__tmpl__ +6 -0
- package/src/generators/application/files/base-webpack/src/favicon.ico +0 -0
- package/src/generators/application/files/base-webpack/src/index.html +14 -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__ +9 -0
- package/src/generators/application/files/nx-welcome/src/app/nx-welcome.tsx +845 -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__ +37 -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__ +36 -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__ +35 -0
- package/src/generators/application/files/style-styled-jsx/src/app/__fileName__.tsx__tmpl__ +29 -0
- package/src/generators/application/files/style-styled-module/src/app/__fileName__.tsx__tmpl__ +40 -0
- package/src/generators/application/lib/add-cypress.d.ts +3 -0
- package/src/generators/application/lib/add-cypress.js +22 -0
- package/src/generators/application/lib/add-cypress.js.map +1 -0
- package/src/generators/application/lib/add-jest.d.ts +3 -0
- package/src/generators/application/lib/add-jest.js +17 -0
- package/src/generators/application/lib/add-jest.js.map +1 -0
- package/src/generators/application/lib/add-project.d.ts +2 -0
- package/src/generators/application/lib/add-project.js +98 -0
- package/src/generators/application/lib/add-project.js.map +1 -0
- package/src/generators/application/lib/add-routing.d.ts +3 -0
- package/src/generators/application/lib/add-routing.js +32 -0
- package/src/generators/application/lib/add-routing.js.map +1 -0
- package/src/generators/application/lib/create-application-files.d.ts +3 -0
- package/src/generators/application/lib/create-application-files.js +47 -0
- package/src/generators/application/lib/create-application-files.js.map +1 -0
- package/src/generators/application/lib/find-free-port.d.ts +2 -0
- package/src/generators/application/lib/find-free-port.js +18 -0
- package/src/generators/application/lib/find-free-port.js.map +1 -0
- package/src/generators/application/lib/get-app-tests.d.ts +2 -0
- package/src/generators/application/lib/get-app-tests.js +22 -0
- package/src/generators/application/lib/get-app-tests.js.map +1 -0
- package/src/generators/application/lib/install-common-dependencies.d.ts +3 -0
- package/src/generators/application/lib/install-common-dependencies.js +29 -0
- package/src/generators/application/lib/install-common-dependencies.js.map +1 -0
- package/src/generators/application/lib/normalize-options.d.ts +5 -0
- package/src/generators/application/lib/normalize-options.js +60 -0
- package/src/generators/application/lib/normalize-options.js.map +1 -0
- package/src/generators/application/lib/set-defaults.d.ts +3 -0
- package/src/generators/application/lib/set-defaults.js +23 -0
- package/src/generators/application/lib/set-defaults.js.map +1 -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/lib/update-jest-config.js.map +1 -0
- package/src/generators/application/schema.d.ts +44 -0
- package/src/generators/application/schema.json +196 -0
- package/src/generators/component/component.d.ts +5 -0
- package/src/generators/component/component.js +141 -0
- package/src/generators/component/component.js.map +1 -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__ +71 -0
- package/src/generators/component/get-component-tests.d.ts +2 -0
- package/src/generators/component/get-component-tests.js +13 -0
- package/src/generators/component/get-component-tests.js.map +1 -0
- package/src/generators/component/noramlized-schema.d.ts +8 -0
- package/src/generators/component/noramlized-schema.js +3 -0
- package/src/generators/component/noramlized-schema.js.map +1 -0
- package/src/generators/component/schema.d.ts +20 -0
- package/src/generators/component/schema.json +153 -0
- package/src/generators/component-cypress-spec/component-cypress-spec.d.ts +14 -0
- package/src/generators/component-cypress-spec/component-cypress-spec.js +105 -0
- package/src/generators/component-cypress-spec/component-cypress-spec.js.map +1 -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 +81 -0
- package/src/generators/component-story/component-story.js.map +1 -0
- package/src/generators/component-story/files/__componentFileName__.stories.__fileExt__ +32 -0
- package/src/generators/component-story/schema.json +36 -0
- package/src/generators/component-test/component-test.d.ts +4 -0
- package/src/generators/component-test/component-test.js +78 -0
- package/src/generators/component-test/component-test.js.map +1 -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 +3 -0
- package/src/generators/component-test/schema.js.map +1 -0
- package/src/generators/component-test/schema.json +31 -0
- package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts +9 -0
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +34 -0
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js.map +1 -0
- package/src/generators/cypress-component-configuration/files/cypress/support/commands.ts__tpl__ +42 -0
- package/src/generators/cypress-component-configuration/files/cypress.config.ts__tpl__ +8 -0
- package/src/generators/cypress-component-configuration/lib/add-files.d.ts +4 -0
- package/src/generators/cypress-component-configuration/lib/add-files.js +75 -0
- package/src/generators/cypress-component-configuration/lib/add-files.js.map +1 -0
- package/src/generators/cypress-component-configuration/lib/update-configs.d.ts +7 -0
- package/src/generators/cypress-component-configuration/lib/update-configs.js +30 -0
- package/src/generators/cypress-component-configuration/lib/update-configs.js.map +1 -0
- package/src/generators/cypress-component-configuration/schema.d.ts +7 -0
- package/src/generators/cypress-component-configuration/schema.json +54 -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 +117 -0
- package/src/generators/hook/hook.js.map +1 -0
- package/src/generators/hook/schema.d.ts +11 -0
- package/src/generators/hook/schema.json +77 -0
- package/src/generators/host/files/common/src/app/__fileName__.tsx__tmpl__ +33 -0
- package/src/generators/host/files/module-federation/module-federation.config.js__tmpl__ +6 -0
- package/src/generators/host/files/module-federation/src/main.ts__tmpl__ +1 -0
- package/src/generators/host/files/module-federation/src/remotes.d.ts__tmpl__ +4 -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__ +13 -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__ +15 -0
- package/src/generators/host/files/module-federation-ssr/webpack.server.config.js__tmpl__ +12 -0
- package/src/generators/host/host.d.ts +4 -0
- package/src/generators/host/host.js +67 -0
- package/src/generators/host/host.js.map +1 -0
- package/src/generators/host/lib/add-module-federation-files.d.ts +5 -0
- package/src/generators/host/lib/add-module-federation-files.js +21 -0
- package/src/generators/host/lib/add-module-federation-files.js.map +1 -0
- package/src/generators/host/lib/setup-ssr-for-host.d.ts +6 -0
- package/src/generators/host/lib/setup-ssr-for-host.js +27 -0
- package/src/generators/host/lib/setup-ssr-for-host.js.map +1 -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 +16 -0
- package/src/generators/host/lib/update-module-federation-e2e-project.js.map +1 -0
- package/src/generators/host/schema.d.ts +31 -0
- package/src/generators/host/schema.json +168 -0
- package/src/generators/init/init.d.ts +5 -0
- package/src/generators/init/init.js +80 -0
- package/src/generators/init/init.js.map +1 -0
- package/src/generators/init/schema.d.ts +11 -0
- package/src/generators/init/schema.json +49 -0
- package/src/generators/library/files/common/.babelrc__tmpl__ +16 -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 +38 -0
- package/src/generators/library/lib/add-linting.js.map +1 -0
- package/src/generators/library/lib/add-rollup-build-target.d.ts +3 -0
- package/src/generators/library/lib/add-rollup-build-target.js +59 -0
- package/src/generators/library/lib/add-rollup-build-target.js.map +1 -0
- package/src/generators/library/lib/create-files.d.ts +3 -0
- package/src/generators/library/lib/create-files.js +26 -0
- package/src/generators/library/lib/create-files.js.map +1 -0
- package/src/generators/library/lib/install-common-dependencies.d.ts +3 -0
- package/src/generators/library/lib/install-common-dependencies.js +30 -0
- package/src/generators/library/lib/install-common-dependencies.js.map +1 -0
- package/src/generators/library/lib/maybe-js.d.ts +2 -0
- package/src/generators/library/lib/maybe-js.js +10 -0
- package/src/generators/library/lib/maybe-js.js.map +1 -0
- package/src/generators/library/lib/normalize-options.d.ts +3 -0
- package/src/generators/library/lib/normalize-options.js +57 -0
- package/src/generators/library/lib/normalize-options.js.map +1 -0
- package/src/generators/library/lib/set-defaults.d.ts +3 -0
- package/src/generators/library/lib/set-defaults.js +16 -0
- package/src/generators/library/lib/set-defaults.js.map +1 -0
- package/src/generators/library/lib/update-app-routes.d.ts +3 -0
- package/src/generators/library/lib/update-app-routes.js +63 -0
- package/src/generators/library/lib/update-app-routes.js.map +1 -0
- package/src/generators/library/library.d.ts +5 -0
- package/src/generators/library/library.js +128 -0
- package/src/generators/library/library.js.map +1 -0
- package/src/generators/library/schema.d.ts +43 -0
- package/src/generators/library/schema.json +192 -0
- package/src/generators/redux/files/__directory__/__fileName__.slice.spec.ts__tmpl__ +53 -0
- package/src/generators/redux/files/__directory__/__fileName__.slice.ts__tmpl__ +129 -0
- package/src/generators/redux/redux.d.ts +5 -0
- package/src/generators/redux/redux.js +117 -0
- package/src/generators/redux/redux.js.map +1 -0
- package/src/generators/redux/schema.d.ts +20 -0
- package/src/generators/redux/schema.json +47 -0
- package/src/generators/remote/files/module-federation/module-federation.config.js__tmpl__ +6 -0
- package/src/generators/remote/files/module-federation/src/main.ts__tmpl__ +1 -0
- package/src/generators/remote/files/module-federation/src/remote-entry.ts__tmpl__ +1 -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/lib/setup-ssr-for-remote.d.ts +4 -0
- package/src/generators/remote/lib/setup-ssr-for-remote.js +32 -0
- package/src/generators/remote/lib/setup-ssr-for-remote.js.map +1 -0
- package/src/generators/remote/lib/update-host-with-remote.d.ts +2 -0
- package/src/generators/remote/lib/update-host-with-remote.js +53 -0
- package/src/generators/remote/lib/update-host-with-remote.js.map +1 -0
- package/src/generators/remote/remote.d.ts +6 -0
- package/src/generators/remote/remote.js +56 -0
- package/src/generators/remote/remote.js.map +1 -0
- package/src/generators/remote/schema.d.ts +26 -0
- package/src/generators/remote/schema.json +167 -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__ +15 -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 +5 -0
- package/src/generators/setup-ssr/setup-ssr.js +162 -0
- package/src/generators/setup-ssr/setup-ssr.js.map +1 -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/add-tailwind-style-imports.js.map +1 -0
- package/src/generators/setup-tailwind/lib/update-project.d.ts +3 -0
- package/src/generators/setup-tailwind/lib/update-project.js +15 -0
- package/src/generators/setup-tailwind/lib/update-project.js.map +1 -0
- package/src/generators/setup-tailwind/schema.d.ts +6 -0
- package/src/generators/setup-tailwind/schema.js +3 -0
- package/src/generators/setup-tailwind/schema.js.map +1 -0
- package/src/generators/setup-tailwind/schema.json +47 -0
- package/src/generators/setup-tailwind/setup-tailwind.d.ts +5 -0
- package/src/generators/setup-tailwind/setup-tailwind.js +39 -0
- package/src/generators/setup-tailwind/setup-tailwind.js.map +1 -0
- package/src/generators/stories/schema.json +59 -0
- package/src/generators/stories/stories.d.ts +15 -0
- package/src/generators/stories/stories.js +118 -0
- package/src/generators/stories/stories.js.map +1 -0
- package/src/generators/storybook-configuration/configuration.d.ts +5 -0
- package/src/generators/storybook-configuration/configuration.js +64 -0
- package/src/generators/storybook-configuration/configuration.js.map +1 -0
- package/src/generators/storybook-configuration/schema.d.ts +17 -0
- package/src/generators/storybook-configuration/schema.json +103 -0
- package/src/migrations/update-12-0-0/remove-react-redux-types-package.d.ts +3 -0
- package/src/migrations/update-12-0-0/remove-react-redux-types-package.js +13 -0
- package/src/migrations/update-12-0-0/remove-react-redux-types-package.js.map +1 -0
- package/src/migrations/update-12-0-0/update-emotion-setup.d.ts +3 -0
- package/src/migrations/update-12-0-0/update-emotion-setup.js +67 -0
- package/src/migrations/update-12-0-0/update-emotion-setup.js.map +1 -0
- package/src/migrations/update-12-0-0/use-react-jsx-in-tsconfig.d.ts +3 -0
- package/src/migrations/update-12-0-0/use-react-jsx-in-tsconfig.js +27 -0
- package/src/migrations/update-12-0-0/use-react-jsx-in-tsconfig.js.map +1 -0
- package/src/migrations/update-12-8-0/update-12-8-0.d.ts +3 -0
- package/src/migrations/update-12-8-0/update-12-8-0.js +15 -0
- package/src/migrations/update-12-8-0/update-12-8-0.js.map +1 -0
- package/src/migrations/update-13-0-0/migrate-storybook-to-webpack-5.d.ts +3 -0
- package/src/migrations/update-13-0-0/migrate-storybook-to-webpack-5.js +38 -0
- package/src/migrations/update-13-0-0/migrate-storybook-to-webpack-5.js.map +1 -0
- package/src/migrations/update-13-0-0/update-emotion-setup.d.ts +3 -0
- package/src/migrations/update-13-0-0/update-emotion-setup.js +39 -0
- package/src/migrations/update-13-0-0/update-emotion-setup.js.map +1 -0
- package/src/migrations/update-13-0-0/webpack5-changes-utils.d.ts +11 -0
- package/src/migrations/update-13-0-0/webpack5-changes-utils.js +269 -0
- package/src/migrations/update-13-0-0/webpack5-changes-utils.js.map +1 -0
- package/src/migrations/update-13-10-0/update-13-10-0.d.ts +3 -0
- package/src/migrations/update-13-10-0/update-13-10-0.js +29 -0
- package/src/migrations/update-13-10-0/update-13-10-0.js.map +1 -0
- package/src/migrations/update-14-0-0/add-default-development-configurations.d.ts +3 -0
- package/src/migrations/update-14-0-0/add-default-development-configurations.js +40 -0
- package/src/migrations/update-14-0-0/add-default-development-configurations.js.map +1 -0
- package/src/migrations/update-14-0-0/replace-testing-library-react-hook.d.ts +3 -0
- package/src/migrations/update-14-0-0/replace-testing-library-react-hook.js +27 -0
- package/src/migrations/update-14-0-0/replace-testing-library-react-hook.js.map +1 -0
- package/src/migrations/update-14-0-0/update-react-dom-render-for-v18.d.ts +5 -0
- package/src/migrations/update-14-0-0/update-react-dom-render-for-v18.js +69 -0
- package/src/migrations/update-14-0-0/update-react-dom-render-for-v18.js.map +1 -0
- package/src/migrations/update-14-1-0/update-external-emotion-jsx-runtime.d.ts +3 -0
- package/src/migrations/update-14-1-0/update-external-emotion-jsx-runtime.js +38 -0
- package/src/migrations/update-14-1-0/update-external-emotion-jsx-runtime.js.map +1 -0
- package/src/migrations/update-14-6-0/add-preset-jest-config.d.ts +3 -0
- package/src/migrations/update-14-6-0/add-preset-jest-config.js +40 -0
- package/src/migrations/update-14-6-0/add-preset-jest-config.js.map +1 -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 +39 -0
- package/src/migrations/update-15-3-0/install-webpack-rollup-dependencies.js.map +1 -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 +17 -0
- package/src/migrations/update-15-3-0/update-rollup-executor.js.map +1 -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 +108 -0
- package/src/migrations/update-15-6-3/webpack-config-setup.js.map +1 -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 +13 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
- package/src/module-federation/ast-utils.d.ts +8 -0
- package/src/module-federation/ast-utils.js +103 -0
- package/src/module-federation/ast-utils.js.map +1 -0
- package/src/module-federation/load-config.d.ts +3 -0
- package/src/module-federation/load-config.js +17 -0
- package/src/module-federation/load-config.js.map +1 -0
- package/src/module-federation/models.d.ts +24 -0
- package/src/module-federation/models.js +3 -0
- package/src/module-federation/models.js.map +1 -0
- package/src/module-federation/package-json.d.ts +8 -0
- package/src/module-federation/package-json.js +14 -0
- package/src/module-federation/package-json.js.map +1 -0
- package/src/module-federation/utils.d.ts +10 -0
- package/src/module-federation/utils.js +38 -0
- package/src/module-federation/utils.js.map +1 -0
- package/src/module-federation/with-module-federation-ssr.d.ts +2 -0
- package/src/module-federation/with-module-federation-ssr.js +48 -0
- package/src/module-federation/with-module-federation-ssr.js.map +1 -0
- package/src/module-federation/with-module-federation.d.ts +7 -0
- package/src/module-federation/with-module-federation.js +50 -0
- package/src/module-federation/with-module-federation.js.map +1 -0
- package/src/rules/add-styled-dependencies.d.ts +2 -0
- package/src/rules/add-styled-dependencies.js +16 -0
- package/src/rules/add-styled-dependencies.js.map +1 -0
- package/src/rules/update-module-federation-project.d.ts +6 -0
- package/src/rules/update-module-federation-project.js +34 -0
- package/src/rules/update-module-federation-project.js.map +1 -0
- package/src/utils/assertion.d.ts +1 -0
- package/src/utils/assertion.js +20 -0
- package/src/utils/assertion.js.map +1 -0
- package/src/utils/ast-utils.d.ts +29 -0
- package/src/utils/ast-utils.js +526 -0
- package/src/utils/ast-utils.js.map +1 -0
- package/src/utils/component-props.d.ts +15 -0
- package/src/utils/component-props.js +61 -0
- package/src/utils/component-props.js.map +1 -0
- package/src/utils/create-ts-config.d.ts +9 -0
- package/src/utils/create-ts-config.js +64 -0
- package/src/utils/create-ts-config.js.map +1 -0
- package/src/utils/dependencies.d.ts +7 -0
- package/src/utils/dependencies.js +3 -0
- package/src/utils/dependencies.js.map +1 -0
- package/src/utils/format-file.d.ts +1 -0
- package/src/utils/format-file.js +13 -0
- package/src/utils/format-file.js.map +1 -0
- package/src/utils/get-in-source-vitest-tests-template.d.ts +1 -0
- package/src/utils/get-in-source-vitest-tests-template.js +22 -0
- package/src/utils/get-in-source-vitest-tests-template.js.map +1 -0
- package/src/utils/jest-utils.d.ts +1 -0
- package/src/utils/jest-utils.js +10 -0
- package/src/utils/jest-utils.js.map +1 -0
- package/src/utils/lint.d.ts +37 -0
- package/src/utils/lint.js +68 -0
- package/src/utils/lint.js.map +1 -0
- package/src/utils/styled.d.ts +4 -0
- package/src/utils/styled.js +33 -0
- package/src/utils/styled.js.map +1 -0
- package/src/utils/testing-generators.d.ts +3 -0
- package/src/utils/testing-generators.js +35 -0
- package/src/utils/testing-generators.js.map +1 -0
- package/src/utils/versions.d.ts +43 -0
- package/src/utils/versions.js +51 -0
- package/src/utils/versions.js.map +1 -0
- package/tailwind.d.ts +6 -0
- package/tailwind.js +30 -0
- package/tailwind.js.map +1 -0
- package/typings/cssmodule.d.ts +24 -0
- package/typings/image.d.ts +48 -0
- package/typings/style.d.ts +9 -0
- package/typings/styled-jsx.d.ts +8 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.storiesSchematic = exports.storiesGenerator = exports.createAllStories = exports.containsComponentDeclaration = exports.projectRootPath = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const component_story_1 = require("../component-story/component-story");
|
|
6
|
+
const component_cypress_spec_1 = require("../component-cypress-spec/component-cypress-spec");
|
|
7
|
+
const ast_utils_1 = require("../../utils/ast-utils");
|
|
8
|
+
const devkit_1 = require("@nx/devkit");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
const minimatch = require("minimatch");
|
|
11
|
+
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
12
|
+
let tsModule;
|
|
13
|
+
function projectRootPath(tree, config) {
|
|
14
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
const { findStorybookAndBuildTargetsAndCompiler } = yield Promise.resolve().then(() => require('@nx/storybook/src/utils/utilities'));
|
|
16
|
+
let projectDir;
|
|
17
|
+
if (config.projectType === 'application') {
|
|
18
|
+
const { nextBuildTarget } = findStorybookAndBuildTargetsAndCompiler(config.targets);
|
|
19
|
+
if (!!nextBuildTarget) {
|
|
20
|
+
// Next.js apps
|
|
21
|
+
projectDir = 'components';
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
// apps/test-app/src/app
|
|
25
|
+
projectDir = 'app';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else if (config.projectType == 'library') {
|
|
29
|
+
// libs/test-lib/src/lib
|
|
30
|
+
projectDir = 'lib';
|
|
31
|
+
}
|
|
32
|
+
return (0, devkit_1.joinPathFragments)(config.sourceRoot, projectDir);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
exports.projectRootPath = projectRootPath;
|
|
36
|
+
function containsComponentDeclaration(tree, componentPath) {
|
|
37
|
+
var _a;
|
|
38
|
+
if (!tsModule) {
|
|
39
|
+
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
40
|
+
}
|
|
41
|
+
const contents = tree.read(componentPath, 'utf-8');
|
|
42
|
+
if (contents === null) {
|
|
43
|
+
throw new Error(`Failed to read ${componentPath}`);
|
|
44
|
+
}
|
|
45
|
+
const sourceFile = tsModule.createSourceFile(componentPath, contents, tsModule.ScriptTarget.Latest, true);
|
|
46
|
+
return !!((0, ast_utils_1.getComponentNode)(sourceFile) ||
|
|
47
|
+
((_a = (0, ast_utils_1.findExportDeclarationsForJsx)(sourceFile)) === null || _a === void 0 ? void 0 : _a.length));
|
|
48
|
+
}
|
|
49
|
+
exports.containsComponentDeclaration = containsComponentDeclaration;
|
|
50
|
+
function createAllStories(tree, projectName, generateCypressSpecs, js, cypressProject, ignorePaths) {
|
|
51
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const { isTheFileAStory } = yield Promise.resolve().then(() => require('@nx/storybook/src/utils/utilities'));
|
|
53
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
54
|
+
const projectConfiguration = projects.get(projectName);
|
|
55
|
+
const { sourceRoot, root } = projectConfiguration;
|
|
56
|
+
let componentPaths = [];
|
|
57
|
+
const projectPath = yield projectRootPath(tree, projectConfiguration);
|
|
58
|
+
(0, devkit_1.visitNotIgnoredFiles)(tree, projectPath, (path) => {
|
|
59
|
+
// Ignore private files starting with "_".
|
|
60
|
+
if ((0, path_1.basename)(path).startsWith('_'))
|
|
61
|
+
return;
|
|
62
|
+
if (ignorePaths === null || ignorePaths === void 0 ? void 0 : ignorePaths.some((pattern) => minimatch(path, pattern)))
|
|
63
|
+
return;
|
|
64
|
+
if ((path.endsWith('.tsx') && !path.endsWith('.spec.tsx')) ||
|
|
65
|
+
(path.endsWith('.js') && !path.endsWith('.spec.js')) ||
|
|
66
|
+
(path.endsWith('.jsx') && !path.endsWith('.spec.jsx'))) {
|
|
67
|
+
// Check if file is NOT a story (either ts/tsx or js/jsx)
|
|
68
|
+
if (!isTheFileAStory(tree, path)) {
|
|
69
|
+
// Since the file is not a story
|
|
70
|
+
// Let's see if the .stories.* file exists
|
|
71
|
+
const ext = path.slice(path.lastIndexOf('.'));
|
|
72
|
+
const storyPath = `${path.split(ext)[0]}.stories${ext}`;
|
|
73
|
+
if (!tree.exists(storyPath)) {
|
|
74
|
+
componentPaths.push(path);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const e2eProjectName = cypressProject || `${projectName}-e2e`;
|
|
80
|
+
const e2eProject = projects.get(e2eProjectName);
|
|
81
|
+
if (generateCypressSpecs && !e2eProject) {
|
|
82
|
+
devkit_1.logger.info(`There was no e2e project "${e2eProjectName}" found, so cypress specs will not be generated. Pass "--cypressProject" to specify a different e2e project name`);
|
|
83
|
+
}
|
|
84
|
+
yield Promise.all(componentPaths.map((componentPath) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
const relativeCmpDir = componentPath.replace((0, path_1.join)(sourceRoot, '/'), '');
|
|
86
|
+
if (!containsComponentDeclaration(tree, componentPath)) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
yield (0, component_story_1.default)(tree, {
|
|
90
|
+
componentPath: relativeCmpDir,
|
|
91
|
+
project: projectName,
|
|
92
|
+
skipFormat: true,
|
|
93
|
+
});
|
|
94
|
+
if (generateCypressSpecs && e2eProject) {
|
|
95
|
+
yield (0, component_cypress_spec_1.default)(tree, {
|
|
96
|
+
project: projectName,
|
|
97
|
+
componentPath: relativeCmpDir,
|
|
98
|
+
js,
|
|
99
|
+
cypressProject,
|
|
100
|
+
skipFormat: true,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
})));
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
exports.createAllStories = createAllStories;
|
|
107
|
+
function storiesGenerator(host, schema) {
|
|
108
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
yield createAllStories(host, schema.project, schema.generateCypressSpecs, schema.js, schema.cypressProject, schema.ignorePaths);
|
|
110
|
+
if (!schema.skipFormat) {
|
|
111
|
+
yield (0, devkit_1.formatFiles)(host);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
exports.storiesGenerator = storiesGenerator;
|
|
116
|
+
exports.default = storiesGenerator;
|
|
117
|
+
exports.storiesSchematic = (0, devkit_1.convertNxGenerator)(storiesGenerator);
|
|
118
|
+
//# sourceMappingURL=stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stories.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/stories/stories.ts"],"names":[],"mappings":";;;;AAAA,wEAAyE;AACzE,6FAA6F;AAC7F,qDAG+B;AAC/B,uCASoB;AACpB,+BAAsC;AACtC,uCAAwC;AACxC,qFAAiF;AAEjF,IAAI,QAAqC,CAAC;AAW1C,SAAsB,eAAe,CACnC,IAAU,EACV,MAA4B;;QAE5B,MAAM,EAAE,uCAAuC,EAAE,GAAG,2CAClD,mCAAmC,EACpC,CAAC;QACF,IAAI,UAAkB,CAAC;QACvB,IAAI,MAAM,CAAC,WAAW,KAAK,aAAa,EAAE;YACxC,MAAM,EAAE,eAAe,EAAE,GAAG,uCAAuC,CACjE,MAAM,CAAC,OAAO,CACf,CAAC;YACF,IAAI,CAAC,CAAC,eAAe,EAAE;gBACrB,eAAe;gBACf,UAAU,GAAG,YAAY,CAAC;aAC3B;iBAAM;gBACL,wBAAwB;gBACxB,UAAU,GAAG,KAAK,CAAC;aACpB;SACF;aAAM,IAAI,MAAM,CAAC,WAAW,IAAI,SAAS,EAAE;YAC1C,wBAAwB;YACxB,UAAU,GAAG,KAAK,CAAC;SACpB;QACD,OAAO,IAAA,0BAAiB,EAAC,MAAM,CAAC,UAAU,EAAE,UA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|
2
|
+
import { Tree } from '@nx/devkit';
|
|
3
|
+
export declare function storybookConfigurationGenerator(host: Tree, schema: StorybookConfigureSchema): Promise<import("@nx/devkit").GeneratorCallback>;
|
|
4
|
+
export default storybookConfigurationGenerator;
|
|
5
|
+
export declare const storybookConfigurationSchematic: (generatorOptions: StorybookConfigureSchema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.storybookConfigurationSchematic = exports.storybookConfigurationGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const stories_1 = require("../stories/stories");
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
const versions_1 = require("../../utils/versions");
|
|
8
|
+
function generateStories(host, schema) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
(0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
11
|
+
const { getE2eProjectName } = yield Promise.resolve().then(() => require('@nx/cypress/src/utils/project-name'));
|
|
12
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(host, schema.name);
|
|
13
|
+
const cypressProject = getE2eProjectName(schema.name, projectConfig.root, schema.cypressDirectory);
|
|
14
|
+
yield (0, stories_1.default)(host, {
|
|
15
|
+
project: schema.name,
|
|
16
|
+
generateCypressSpecs: schema.configureCypress && schema.generateCypressSpecs,
|
|
17
|
+
js: schema.js,
|
|
18
|
+
cypressProject,
|
|
19
|
+
ignorePaths: schema.ignorePaths,
|
|
20
|
+
skipFormat: true,
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function storybookConfigurationGenerator(host, schema) {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/storybook', versions_1.nxVersion);
|
|
28
|
+
let bundler = (_a = schema.bundler) !== null && _a !== void 0 ? _a : 'webpack';
|
|
29
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(host, schema.name);
|
|
30
|
+
if (projectConfig.projectType === 'application' &&
|
|
31
|
+
((_b = projectConfig.targets['build']) === null || _b === void 0 ? void 0 : _b.executor) === '@nrwl/vite:build') {
|
|
32
|
+
bundler = 'vite';
|
|
33
|
+
if (schema.bundler !== 'vite') {
|
|
34
|
+
devkit_1.logger.info(`The project ${schema.name} is set up to use Vite. So
|
|
35
|
+
Storybook will be configured to use Vite as well.`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const installTask = yield configurationGenerator(host, {
|
|
39
|
+
name: schema.name,
|
|
40
|
+
uiFramework: '@storybook/react',
|
|
41
|
+
configureCypress: schema.configureCypress,
|
|
42
|
+
js: schema.js,
|
|
43
|
+
linter: schema.linter,
|
|
44
|
+
cypressDirectory: schema.cypressDirectory,
|
|
45
|
+
tsConfiguration: schema.tsConfiguration,
|
|
46
|
+
configureTestRunner: schema.configureTestRunner,
|
|
47
|
+
configureStaticServe: schema.configureStaticServe,
|
|
48
|
+
bundler,
|
|
49
|
+
storybook7Configuration: schema.storybook7Configuration,
|
|
50
|
+
storybook7UiFramework: bundler === 'vite'
|
|
51
|
+
? '@storybook/react-vite'
|
|
52
|
+
: '@storybook/react-webpack5',
|
|
53
|
+
skipFormat: true,
|
|
54
|
+
});
|
|
55
|
+
if (schema.generateStories) {
|
|
56
|
+
yield generateStories(host, schema);
|
|
57
|
+
}
|
|
58
|
+
return installTask;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
exports.storybookConfigurationGenerator = storybookConfigurationGenerator;
|
|
62
|
+
exports.default = storybookConfigurationGenerator;
|
|
63
|
+
exports.storybookConfigurationSchematic = (0, devkit_1.convertNxGenerator)(storybookConfigurationGenerator);
|
|
64
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/storybook-configuration/configuration.ts"],"names":[],"mappings":";;;;AACA,gDAAkD;AAClD,uCAMoB;AACpB,mDAAiD;AAEjD,SAAe,eAAe,CAAC,IAAU,EAAE,MAAgC;;QACzE,IAAA,sBAAa,EAAC,aAAa,EAAE,oBAAS,CAAC,CAAC;QACxC,MAAM,EAAE,iBAAiB,EAAE,GAAG,2CAC5B,oCAAoC,EACrC,CAAC;QACF,MAAM,aAAa,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAClE,MAAM,cAAc,GAAG,iBAAiB,CACtC,MAAM,CAAC,IAAI,EACX,aAAa,CAAC,IAAI,EAClB,MAAM,CAAC,gBAAgB,CACxB,CAAC;QACF,MAAM,IAAA,iBAAgB,EAAC,IAAI,EAAE;YAC3B,OAAO,EAAE,MAAM,CAAC,IAAI;YACpB,oBAAoB,EAClB,MAAM,CAAC,gBAAgB,IAAI,MAAM,CAAC,oBAAoB;YACxD,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,cAAc;YACd,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;IACL,CAAC;CAAA;AAED,SAAsB,+BAA+B,CACnD,IAAU,EACV,MAAgC;;;QAEhC,MAAM,EAAE,sBAAsB,EAAE,GAAG,IAAA,sBAAa,EAE9C,eAAe,EAAE,oBAAS,CAAC,CAAC;QAE9B,IAAI,OAAO,GAAG,MAAA,MAAM,CAAC,OAAO,mCAAI,SAAS,CAAC;QAC1C,MAAM,aAAa,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAElE,IACE,aAAa,CAAC,WAAW,KAAK,aAAa;YAC3C,CAAA,MAAA,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,0CAAE,QAAQ,MAAK,kBAAkB,EAC/D;YACA,OAAO,GAAG,MAAM,CAAC;YACjB,IAAI,MAAM,CAAC,OAAO,KAAK,MAAM,EAAE;gBAC7B,eAAM,CAAC,IAAI,CACT,eAAe,MAAM,CAAC,IAAI;wDACsB,CACjD,CAAC;aACH;SACF;QAED,MAAM,WAAW,GAAG,MAAM,sBAAsB,CAAC,IAAI,EAAE;YACrD,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,WAAW,EAAE,kBAAkB;YAC/B,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;YACzC,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;YACzC,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,mBAAmB,EAAE,MAAM,CAAC,mBAAmB;YAC/C,oBAAoB,EAAE,MAAM,CAAC,oBAAoB;YACjD,OAAO;YACP,uBAAuB,EAAE,MAAM,CAAC,uBAAuB;YACvD,qBAAqB,EACnB,OAAO,KAAK,MAAM;gBAChB,CAAC,CAAC,uBAAuB;gBACzB,CAAC,CAAC,2BAA2B;YACjC,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,eAAe,EAAE;YAC1B,MAAM,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;SACrC;QAED,OAAO,WAAW,CAAC;;CACpB;AAhDD,0EAgDC;AAED,kBAAe,+BAA+B,CAAC;AAClC,QAAA,+BAA+B,GAAG,IAAA,2BAAkB,EAC/D,+BAA+B,CAChC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Linter } from '@nx/linter';
|
|
2
|
+
|
|
3
|
+
export interface StorybookConfigureSchema {
|
|
4
|
+
name: string;
|
|
5
|
+
configureCypress: boolean;
|
|
6
|
+
generateStories?: boolean;
|
|
7
|
+
generateCypressSpecs?: boolean;
|
|
8
|
+
js?: boolean;
|
|
9
|
+
tsConfiguration?: boolean;
|
|
10
|
+
linter?: Linter;
|
|
11
|
+
cypressDirectory?: string;
|
|
12
|
+
ignorePaths?: string[];
|
|
13
|
+
bundler?: 'webpack' | 'vite';
|
|
14
|
+
configureTestRunner?: boolean;
|
|
15
|
+
configureStaticServe?: boolean;
|
|
16
|
+
storybook7Configuration?: boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"cli": "nx",
|
|
4
|
+
"$id": "NxReactStorybookConfigure",
|
|
5
|
+
"title": "React Storybook Configure",
|
|
6
|
+
"description": "Set up Storybook for a React app or library.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"name": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"aliases": ["project", "projectName"],
|
|
12
|
+
"description": "Project for which to generate Storybook configuration.",
|
|
13
|
+
"$default": {
|
|
14
|
+
"$source": "argv",
|
|
15
|
+
"index": 0
|
|
16
|
+
},
|
|
17
|
+
"x-prompt": "For which project do you want to generate Storybook configuration?",
|
|
18
|
+
"x-dropdown": "projects",
|
|
19
|
+
"x-priority": "important"
|
|
20
|
+
},
|
|
21
|
+
"configureCypress": {
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"description": "Run the cypress-configure generator.",
|
|
24
|
+
"x-prompt": "Configure a cypress e2e app to run against the storybook instance?",
|
|
25
|
+
"default": true,
|
|
26
|
+
"x-priority": "important"
|
|
27
|
+
},
|
|
28
|
+
"generateStories": {
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"description": "Automatically generate `*.stories.ts` files for components declared in this project?",
|
|
31
|
+
"x-prompt": "Automatically generate *.stories.ts files for components declared in this project?",
|
|
32
|
+
"default": true,
|
|
33
|
+
"x-priority": "important"
|
|
34
|
+
},
|
|
35
|
+
"generateCypressSpecs": {
|
|
36
|
+
"type": "boolean",
|
|
37
|
+
"description": "Automatically generate test files in the Cypress E2E app generated by the `cypress-configure` generator.",
|
|
38
|
+
"x-prompt": "Automatically generate test files in the Cypress E2E app generated by the cypress-configure generator?",
|
|
39
|
+
"default": true,
|
|
40
|
+
"x-priority": "important"
|
|
41
|
+
},
|
|
42
|
+
"configureStaticServe": {
|
|
43
|
+
"type": "boolean",
|
|
44
|
+
"description": "Specifies whether to configure a static file server target for serving storybook. Helpful for speeding up CI build/test times.",
|
|
45
|
+
"x-prompt": "Configure a static file server for the storybook instance?",
|
|
46
|
+
"default": true,
|
|
47
|
+
"x-priority": "important"
|
|
48
|
+
},
|
|
49
|
+
"cypressDirectory": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"description": "A directory where the Cypress project will be placed. Placed at the root by default."
|
|
52
|
+
},
|
|
53
|
+
"js": {
|
|
54
|
+
"type": "boolean",
|
|
55
|
+
"description": "Generate JavaScript story files rather than TypeScript story files.",
|
|
56
|
+
"default": false
|
|
57
|
+
},
|
|
58
|
+
"tsConfiguration": {
|
|
59
|
+
"type": "boolean",
|
|
60
|
+
"description": "Configure your project with TypeScript. Generate main.ts and preview.ts files, instead of main.js and preview.js.",
|
|
61
|
+
"default": false
|
|
62
|
+
},
|
|
63
|
+
"linter": {
|
|
64
|
+
"description": "The tool to use for running lint checks.",
|
|
65
|
+
"type": "string",
|
|
66
|
+
"enum": ["eslint"],
|
|
67
|
+
"default": "eslint"
|
|
68
|
+
},
|
|
69
|
+
"ignorePaths": {
|
|
70
|
+
"type": "array",
|
|
71
|
+
"description": "Paths to ignore when looking for components.",
|
|
72
|
+
"items": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"description": "Path to ignore."
|
|
75
|
+
},
|
|
76
|
+
"examples": [
|
|
77
|
+
"apps/my-app/src/not-stories/**",
|
|
78
|
+
"**/**/src/**/not-stories/**",
|
|
79
|
+
"libs/my-lib/**/*.something.ts",
|
|
80
|
+
"**/**/src/**/*.other.*",
|
|
81
|
+
"libs/my-lib/src/not-stories/**,**/**/src/**/*.other.*,apps/my-app/**/*.something.ts"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
"configureTestRunner": {
|
|
85
|
+
"type": "boolean",
|
|
86
|
+
"description": "Add a Storybook Test-Runner target."
|
|
87
|
+
},
|
|
88
|
+
"bundler": {
|
|
89
|
+
"description": "The Storybook builder to use.",
|
|
90
|
+
"enum": ["vite", "webpack"],
|
|
91
|
+
"x-priority": "important"
|
|
92
|
+
},
|
|
93
|
+
"storybook7Configuration": {
|
|
94
|
+
"description": "Configure your workspace using Storybook version 7.",
|
|
95
|
+
"type": "boolean",
|
|
96
|
+
"default": true,
|
|
97
|
+
"hidden": true,
|
|
98
|
+
"aliases": ["storybook7betaConfiguration"]
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"required": ["name"],
|
|
102
|
+
"examplesFile": "../../../docs/storybook-configuration-examples.md"
|
|
103
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeReactReduxTypesFromPackageJson = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
function removeReactReduxTypesFromPackageJson(host) {
|
|
7
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
return (0, devkit_1.removeDependenciesFromPackageJson)(host, ['@types/react-redux'], ['@types/react-redux']);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
exports.removeReactReduxTypesFromPackageJson = removeReactReduxTypesFromPackageJson;
|
|
12
|
+
exports.default = removeReactReduxTypesFromPackageJson;
|
|
13
|
+
//# sourceMappingURL=remove-react-redux-types-package.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-react-redux-types-package.js","sourceRoot":"","sources":["../../../../../../packages/react/src/migrations/update-12-0-0/remove-react-redux-types-package.ts"],"names":[],"mappings":";;;;AAAA,uCAAqE;AAErE,SAAsB,oCAAoC,CAAC,IAAU;;QACnE,OAAO,IAAA,0CAAiC,EACtC,IAAI,EACJ,CAAC,oBAAoB,CAAC,EACtB,CAAC,oBAAoB,CAAC,CACvB,CAAC;IACJ,CAAC;CAAA;AAND,oFAMC;AAED,kBAAe,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateEmotionSetup = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
function updateEmotionSetup(host) {
|
|
7
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
const projects = (0, devkit_1.getProjects)(host);
|
|
9
|
+
projects.forEach((p) => {
|
|
10
|
+
const babelrcPath = `${p.root}/.babelrc`;
|
|
11
|
+
const oldPreset = '@emotion/babel-preset-css-prop';
|
|
12
|
+
const newPlugin = '@emotion/babel-plugin';
|
|
13
|
+
if (host.exists(babelrcPath)) {
|
|
14
|
+
(0, devkit_1.updateJson)(host, babelrcPath, (json) => {
|
|
15
|
+
var _a;
|
|
16
|
+
if (!json.presets)
|
|
17
|
+
return json;
|
|
18
|
+
let emotionPresetIdx = -1;
|
|
19
|
+
let emotionOptions = null;
|
|
20
|
+
for (const [idx, preset] of json.presets.entries()) {
|
|
21
|
+
if (Array.isArray(preset)) {
|
|
22
|
+
if (!preset[0].includes(oldPreset))
|
|
23
|
+
continue;
|
|
24
|
+
emotionOptions = preset[1];
|
|
25
|
+
emotionPresetIdx = idx;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
if (!preset.includes(oldPreset))
|
|
30
|
+
continue;
|
|
31
|
+
emotionPresetIdx = idx;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (emotionPresetIdx !== -1) {
|
|
36
|
+
// Remove preset
|
|
37
|
+
json.presets.splice(emotionPresetIdx, 1);
|
|
38
|
+
// Add new plugin
|
|
39
|
+
(_a = json.plugins) !== null && _a !== void 0 ? _a : (json.plugins = []);
|
|
40
|
+
json.plugins.push(emotionOptions ? [newPlugin, emotionOptions] : newPlugin);
|
|
41
|
+
return json;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return json;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
(0, devkit_1.updateJson)(host, 'package.json', (json) => {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
if ((_a = json.devDependencies) === null || _a === void 0 ? void 0 : _a['@emotion/babel-preset-css-prop']) {
|
|
52
|
+
delete json.devDependencies['@emotion/babel-preset-css-prop'];
|
|
53
|
+
json.devDependencies['@emotion/babel-plugin'] = '11.2.0';
|
|
54
|
+
}
|
|
55
|
+
// Just in case someone moved it to `dependencies`
|
|
56
|
+
else if ((_b = json.dependencies) === null || _b === void 0 ? void 0 : _b['@emotion/babel-preset-css-prop']) {
|
|
57
|
+
delete json.dependencies['@emotion/babel-preset-css-prop'];
|
|
58
|
+
json.dependencies['@emotion/babel-plugin'] = '11.2.0';
|
|
59
|
+
}
|
|
60
|
+
return json;
|
|
61
|
+
});
|
|
62
|
+
yield (0, devkit_1.formatFiles)(host);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
exports.updateEmotionSetup = updateEmotionSetup;
|
|
66
|
+
exports.default = updateEmotionSetup;
|
|
67
|
+
//# sourceMappingURL=update-emotion-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-emotion-setup.js","sourceRoot":"","sources":["../../../../../../packages/react/src/migrations/update-12-0-0/update-emotion-setup.ts"],"names":[],"mappings":";;;;AAAA,uCAAwE;AAExE,SAAsB,kBAAkB,CAAC,IAAU;;QACjD,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAEnC,QAAQ,CAAC,O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AC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,CACzD,CAAC;wBAEF,OAAO,IAAI,CAAC;qBACb;yBAAM;wBACL,OAAO,IAAI,CAAC;qBACb;gBACH,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;QAEH,IAAA,mBAAU,EAAC,IAAI,EAAE,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE;;YACxC,IAAI,MAAA,IAAI,CAAC,eAAe,0CAAG,gCAAgC,CAAC,EAAE;gBAC5D,OAAO,IAAI,CAAC,eAAe,CAAC,gCAAgC,CAAC,CAAC;gBAC9D,IAAI,CAAC,eAAe,CAAC,uBAAuB,CAAC,GAAG,QAAQ,CAAC;aAC1D;YACD,kDAAkD;iBAC7C,IAAI,MAAA,IAAI,CAAC,YAAY,0CAAG,gCAAgC,CAAC,EAAE;gBAC9D,OAAO,IAAI,CAAC,YAAY,CAAC,gCAAgC,CAAC,CAAC;gBAC3D,IAAI,CAAC,YAAY,CAAC,uBAAuB,CAAC,GAAG,QAAQ,CAAC;aACvD;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AA5DD,gDA4DC;AAED,kBAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useReactJsxInTsconfig = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
function useReactJsxInTsconfig(host) {
|
|
7
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
const projects = (0, devkit_1.getProjects)(host);
|
|
9
|
+
projects.forEach((p) => {
|
|
10
|
+
const tsConfigPath = `${p.root}/tsconfig.json`;
|
|
11
|
+
if (host.exists(tsConfigPath)) {
|
|
12
|
+
(0, devkit_1.updateJson)(host, tsConfigPath, (json) => {
|
|
13
|
+
var _a;
|
|
14
|
+
if (((_a = json.compilerOptions) === null || _a === void 0 ? void 0 : _a.jsx) === 'react') {
|
|
15
|
+
// JSX is handled by babel
|
|
16
|
+
json.compilerOptions.jsx = 'react-jsx';
|
|
17
|
+
}
|
|
18
|
+
return json;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
yield (0, devkit_1.formatFiles)(host);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
exports.useReactJsxInTsconfig = useReactJsxInTsconfig;
|
|
26
|
+
exports.default = useReactJsxInTsconfig;
|
|
27
|
+
//# sourceMappingURL=use-react-jsx-in-tsconfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-react-jsx-in-tsconfig.js","sourceRoot":"","sources":["../../../../../../packages/react/src/migrations/update-12-0-0/use-react-jsx-in-tsconfig.ts"],"names":[],"mappings":";;;;AAAA,uCAAwE;AAExE,SAAsB,qBAAqB,CAAC,IAAU;;QACpD,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAEnC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACrB,MAAM,YAAY,GAAG,GAAG,CAAC,CAAC,IAAI,gBAAgB,CAAC;YAE/C,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;gBAC7B,IAAA,mBAAU,EAAC,IAAI,EAAE,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE;;oBACtC,IAAI,CAAA,MAAA,IAAI,CAAC,eAAe,0CAAE,GAAG,MAAK,OAAO,EAAE;wBACzC,0BAA0B;wBAC1B,IAAI,CAAC,eAAe,CAAC,GAAG,GAAG,WAAW,CAAC;qBACxC;oBACD,OAAO,IAAI,CAAC;gBACd,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAlBD,sDAkBC;AAED,kBAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeReactReduxTypesFromPackageJson = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
function removeReactReduxTypesFromPackageJson(host) {
|
|
7
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
return (0, devkit_1.addDependenciesToPackageJson)(host, {}, {
|
|
9
|
+
'@testing-library/react-hooks': '^7.0.1',
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
exports.removeReactReduxTypesFromPackageJson = removeReactReduxTypesFromPackageJson;
|
|
14
|
+
exports.default = removeReactReduxTypesFromPackageJson;
|
|
15
|
+
//# sourceMappingURL=update-12-8-0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-12-8-0.js","sourceRoot":"","sources":["../../../../../../packages/react/src/migrations/update-12-8-0/update-12-8-0.ts"],"names":[],"mappings":";;;;AAAA,uCAAgE;AAEhE,SAAsB,oCAAoC,CAAC,IAAU;;QACnE,OAAO,IAAA,qCAA4B,EACjC,IAAI,EACJ,EAAE,EACF;YACE,8BAA8B,EAAE,QAAQ;SACzC,CACF,CAAC;IACJ,CAAC;CAAA;AARD,oFAQC;AAED,kBAAe,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.migrateStorybookToWebPack5 = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const webpack5_changes_utils_1 = require("./webpack5-changes-utils");
|
|
7
|
+
let needsInstall = false;
|
|
8
|
+
function migrateStorybookToWebPack5(tree) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
11
|
+
if ((0, webpack5_changes_utils_1.workspaceHasStorybookForReact)(packageJson)) {
|
|
12
|
+
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|
|
13
|
+
json.dependencies = json.dependencies || {};
|
|
14
|
+
json.devDependencies = json.devDependencies || {};
|
|
15
|
+
if (!json.dependencies['@storybook/builder-webpack5'] &&
|
|
16
|
+
!json.devDependencies['@storybook/builder-webpack5']) {
|
|
17
|
+
needsInstall = true;
|
|
18
|
+
json.devDependencies['@storybook/builder-webpack5'] =
|
|
19
|
+
(0, webpack5_changes_utils_1.workspaceHasStorybookForReact)(packageJson);
|
|
20
|
+
}
|
|
21
|
+
if (!json.dependencies['@storybook/manager-webpack5'] &&
|
|
22
|
+
!json.devDependencies['@storybook/manager-webpack5']) {
|
|
23
|
+
needsInstall = true;
|
|
24
|
+
json.devDependencies['@storybook/manager-webpack5'] =
|
|
25
|
+
(0, webpack5_changes_utils_1.workspaceHasStorybookForReact)(packageJson);
|
|
26
|
+
}
|
|
27
|
+
return json;
|
|
28
|
+
});
|
|
29
|
+
yield (0, webpack5_changes_utils_1.migrateToWebPack5)(tree);
|
|
30
|
+
if (needsInstall) {
|
|
31
|
+
devkit_1.logger.info('Please make sure to run npm install or yarn install to get the latest packages added by this migration');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
exports.migrateStorybookToWebPack5 = migrateStorybookToWebPack5;
|
|
37
|
+
exports.default = migrateStorybookToWebPack5;
|
|
38
|
+
//# sourceMappingURL=migrate-storybook-to-webpack-5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-storybook-to-webpack-5.js","sourceRoot":"","sources":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AAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateEmotionSetup = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
function updateEmotionSetup(host) {
|
|
7
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
const projects = (0, devkit_1.getProjects)(host);
|
|
9
|
+
projects.forEach((p) => {
|
|
10
|
+
let hasEmotion = false;
|
|
11
|
+
const babelrcPath = `${p.root}/.babelrc`;
|
|
12
|
+
const tsConfigPath = `${p.root}/tsconfig.json`;
|
|
13
|
+
if (host.exists(babelrcPath)) {
|
|
14
|
+
const babelrc = (0, devkit_1.readJson)(host, babelrcPath);
|
|
15
|
+
if (babelrc.presets) {
|
|
16
|
+
for (const [idx, preset] of babelrc.presets.entries()) {
|
|
17
|
+
if (Array.isArray(preset)) {
|
|
18
|
+
if (!preset[0].includes('@nrwl/react/babel'))
|
|
19
|
+
continue;
|
|
20
|
+
const emotionOptions = preset[1];
|
|
21
|
+
hasEmotion = emotionOptions.importSource === '@emotion/react';
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (hasEmotion && host.exists(tsConfigPath)) {
|
|
28
|
+
(0, devkit_1.updateJson)(host, tsConfigPath, (json) => {
|
|
29
|
+
json.compilerOptions.jsxImportSource = '@emotion/react';
|
|
30
|
+
return json;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
yield (0, devkit_1.formatFiles)(host);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
exports.updateEmotionSetup = updateEmotionSetup;
|
|
38
|
+
exports.default = updateEmotionSetup;
|
|
39
|
+
//# sourceMappingURL=update-emotion-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-emotion-setup.js","sourceRoot":"","sources":["../../../../../../packages/react/src/migrations/update-13-0-0/update-emotion-setup.ts"],"names":[],"mappings":";;;;AAAA,uCAMoB;AAEpB,SAAsB,kBAAkB,CAAC,IAAU;;QACjD,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAEnC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACrB,IAAI,UAAU,GAAG,KAAK,CAAC;YACvB,MAAM,WAAW,GAAG,GAAG,CAAC,CAAC,IAAI,WAAW,CAAC;YACzC,MAAM,YAAY,GAAG,GAAG,CAAC,CAAC,IAAI,gBAAgB,CAAC;YAE/C,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;gBAC5B,MAAM,OAAO,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;gBAC5C,IAAI,OAAO,CAAC,OAAO,EAAE;oBACnB,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE;wBACrD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;4BACzB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;gCAAE,SAAS;4BACvD,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;4BACjC,UAAU,GAAG,cAAc,CAAC,YAAY,KAAK,gBAAgB,CAAC;4BAC9D,MAAM;yBACP;qBACF;iBACF;aACF;YAED,IAAI,UAAU,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;gBAC3C,IAAA,mBAAU,EAAC,IAAI,EAAE,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE;oBACtC,IAAI,CAAC,eAAe,CAAC,eAAe,GAAG,gBAAgB,CAAC;oBACxD,OAAO,IAAI,CAAC;gBACd,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AA/BD,gDA+BC;AAED,kBAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
import ts = require('typescript');
|
|
3
|
+
export declare function migrateToWebPack5(tree: Tree): Promise<void>;
|
|
4
|
+
export declare function workspaceHasStorybookForReact(packageJson: any): string | undefined;
|
|
5
|
+
export declare function allReactProjectsWithStorybookConfiguration(tree: Tree): {
|
|
6
|
+
projectName: string;
|
|
7
|
+
storybookConfigPath: string;
|
|
8
|
+
}[];
|
|
9
|
+
export declare function editProjectMainJs(tree: Tree, projectMainJsFile: string, projectName: string): void;
|
|
10
|
+
export declare function checkMainJsForOldSyntax(nodeList: ts.Node[], fileContent: string): string | undefined;
|
|
11
|
+
export declare function getTsSourceFile(host: Tree, path: string): ts.SourceFile;
|