@nrwl/react 15.9.2 → 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/ast-utils.d.ts +1 -1
- package/ast-utils.js +2 -9
- package/ast-utils.js.map +1 -1
- package/babel.d.ts +0 -16
- package/babel.js +1 -51
- package/babel.js.map +1 -1
- package/executors.json +8 -8
- package/generators.json +2 -221
- package/index.d.ts +1 -21
- package/index.js +1 -43
- package/index.js.map +1 -1
- package/module-federation.d.ts +1 -4
- package/module-federation.js +2 -10
- package/module-federation.js.map +1 -1
- package/package.json +7 -16
- package/plugins/bundle-rollup.d.ts +0 -1
- package/plugins/bundle-rollup.js +1 -41
- package/plugins/bundle-rollup.js.map +1 -1
- package/plugins/component-testing/index.d.ts +1 -38
- package/plugins/component-testing/index.js +1 -118
- package/plugins/component-testing/index.js.map +1 -1
- package/plugins/jest.d.ts +0 -1
- package/plugins/jest.js +1 -61
- package/plugins/jest.js.map +1 -1
- package/plugins/storybook/index.d.ts +1 -3
- package/plugins/storybook/index.js +1 -73
- package/plugins/storybook/index.js.map +1 -1
- package/plugins/webpack.d.ts +1 -3
- package/plugins/webpack.js +2 -12
- package/plugins/webpack.js.map +1 -1
- package/plugins/with-react.d.ts +1 -12
- package/plugins/with-react.js +2 -79
- package/plugins/with-react.js.map +1 -1
- package/tailwind.d.ts +1 -6
- package/tailwind.js +2 -26
- package/tailwind.js.map +1 -1
- package/README.md +0 -63
- package/migrations.json +0 -864
- package/plugins/component-testing/webpack-fallback.d.ts +0 -5
- package/plugins/component-testing/webpack-fallback.js +0 -135
- package/plugins/component-testing/webpack-fallback.js.map +0 -1
- package/plugins/storybook/merge-plugins.d.ts +0 -3
- package/plugins/storybook/merge-plugins.js +0 -18
- package/plugins/storybook/merge-plugins.js.map +0 -1
- package/src/executors/module-federation-dev-server/compat.d.ts +0 -2
- package/src/executors/module-federation-dev-server/compat.js +0 -6
- package/src/executors/module-federation-dev-server/compat.js.map +0 -1
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +0 -11
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +0 -55
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js.map +0 -1
- package/src/executors/module-federation-dev-server/schema.json +0 -96
- package/src/executors/module-federation-ssr-dev-server/compat.d.ts +0 -2
- package/src/executors/module-federation-ssr-dev-server/compat.js +0 -6
- package/src/executors/module-federation-ssr-dev-server/compat.js.map +0 -1
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +0 -9
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +0 -71
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js.map +0 -1
- package/src/executors/module-federation-ssr-dev-server/schema.json +0 -48
- package/src/generators/application/application.d.ts +0 -5
- package/src/generators/application/application.js +0 -129
- package/src/generators/application/application.js.map +0 -1
- package/src/generators/application/files/base-vite/index.html__tmpl__ +0 -16
- 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__ +0 -10
- 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__ +0 -3
- package/src/generators/application/files/base-vite/src/environments/environment.ts__tmpl__ +0 -6
- package/src/generators/application/files/base-vite/src/main.tsx__tmpl__ +0 -10
- package/src/generators/application/files/base-vite/tsconfig.app.json__tmpl__ +0 -14
- package/src/generators/application/files/base-webpack/.babelrc__tmpl__ +0 -13
- package/src/generators/application/files/base-webpack/src/app/__fileName__.spec.tsx__tmpl__ +0 -10
- 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__ +0 -3
- package/src/generators/application/files/base-webpack/src/environments/environment.ts__tmpl__ +0 -6
- package/src/generators/application/files/base-webpack/src/favicon.ico +0 -0
- package/src/generators/application/files/base-webpack/src/index.html +0 -14
- package/src/generators/application/files/base-webpack/src/main.tsx__tmpl__ +0 -10
- package/src/generators/application/files/base-webpack/tsconfig.app.json__tmpl__ +0 -14
- package/src/generators/application/files/base-webpack/webpack.config.js__tmpl__ +0 -9
- package/src/generators/application/files/nx-welcome/src/app/nx-welcome.tsx +0 -845
- package/src/generators/application/files/style-css-module/src/app/__fileName__.module.__style__ +0 -1
- package/src/generators/application/files/style-css-module/src/app/__fileName__.tsx__tmpl__ +0 -37
- package/src/generators/application/files/style-css-module/src/styles.__style__ +0 -1
- package/src/generators/application/files/style-global-css/src/app/__fileName__.__style__ +0 -1
- package/src/generators/application/files/style-global-css/src/app/__fileName__.tsx__tmpl__ +0 -36
- package/src/generators/application/files/style-global-css/src/styles.__style__ +0 -1
- package/src/generators/application/files/style-none/src/app/__fileName__.tsx__tmpl__ +0 -35
- package/src/generators/application/files/style-styled-jsx/src/app/__fileName__.tsx__tmpl__ +0 -29
- package/src/generators/application/files/style-styled-module/src/app/__fileName__.tsx__tmpl__ +0 -40
- package/src/generators/application/lib/add-cypress.d.ts +0 -3
- package/src/generators/application/lib/add-cypress.js +0 -22
- package/src/generators/application/lib/add-cypress.js.map +0 -1
- package/src/generators/application/lib/add-jest.d.ts +0 -3
- package/src/generators/application/lib/add-jest.js +0 -17
- package/src/generators/application/lib/add-jest.js.map +0 -1
- package/src/generators/application/lib/add-project.d.ts +0 -2
- package/src/generators/application/lib/add-project.js +0 -98
- package/src/generators/application/lib/add-project.js.map +0 -1
- package/src/generators/application/lib/add-routing.d.ts +0 -3
- package/src/generators/application/lib/add-routing.js +0 -32
- package/src/generators/application/lib/add-routing.js.map +0 -1
- package/src/generators/application/lib/create-application-files.d.ts +0 -3
- package/src/generators/application/lib/create-application-files.js +0 -47
- package/src/generators/application/lib/create-application-files.js.map +0 -1
- package/src/generators/application/lib/find-free-port.d.ts +0 -2
- package/src/generators/application/lib/find-free-port.js +0 -18
- package/src/generators/application/lib/find-free-port.js.map +0 -1
- package/src/generators/application/lib/get-app-tests.d.ts +0 -2
- package/src/generators/application/lib/get-app-tests.js +0 -22
- package/src/generators/application/lib/get-app-tests.js.map +0 -1
- package/src/generators/application/lib/install-common-dependencies.d.ts +0 -3
- package/src/generators/application/lib/install-common-dependencies.js +0 -29
- package/src/generators/application/lib/install-common-dependencies.js.map +0 -1
- package/src/generators/application/lib/normalize-options.d.ts +0 -5
- package/src/generators/application/lib/normalize-options.js +0 -60
- package/src/generators/application/lib/normalize-options.js.map +0 -1
- package/src/generators/application/lib/set-defaults.d.ts +0 -3
- package/src/generators/application/lib/set-defaults.js +0 -23
- package/src/generators/application/lib/set-defaults.js.map +0 -1
- package/src/generators/application/lib/update-jest-config.d.ts +0 -3
- package/src/generators/application/lib/update-jest-config.js +0 -30
- package/src/generators/application/lib/update-jest-config.js.map +0 -1
- package/src/generators/application/schema.d.ts +0 -45
- package/src/generators/application/schema.json +0 -202
- package/src/generators/component/component.d.ts +0 -5
- package/src/generators/component/component.js +0 -141
- package/src/generators/component/component.js.map +0 -1
- package/src/generators/component/files/__fileName__.__style__ +0 -0
- package/src/generators/component/files/__fileName__.module.__style__ +0 -7
- package/src/generators/component/files/__fileName__.spec.tsx__tmpl__ +0 -7
- package/src/generators/component/files/__fileName__.tsx__tmpl__ +0 -71
- package/src/generators/component/get-component-tests.d.ts +0 -2
- package/src/generators/component/get-component-tests.js +0 -13
- package/src/generators/component/get-component-tests.js.map +0 -1
- package/src/generators/component/noramlized-schema.d.ts +0 -8
- package/src/generators/component/noramlized-schema.js +0 -3
- package/src/generators/component/noramlized-schema.js.map +0 -1
- package/src/generators/component/schema.d.ts +0 -20
- package/src/generators/component/schema.json +0 -153
- package/src/generators/component-cypress-spec/component-cypress-spec.d.ts +0 -14
- package/src/generators/component-cypress-spec/component-cypress-spec.js +0 -105
- package/src/generators/component-cypress-spec/component-cypress-spec.js.map +0 -1
- package/src/generators/component-cypress-spec/files/__componentName__.__fileExt__ +0 -13
- package/src/generators/component-cypress-spec/schema.json +0 -44
- package/src/generators/component-story/component-story.d.ts +0 -12
- package/src/generators/component-story/component-story.js +0 -81
- package/src/generators/component-story/component-story.js.map +0 -1
- package/src/generators/component-story/files/__componentFileName__.stories.__fileExt__ +0 -32
- package/src/generators/component-story/schema.json +0 -36
- package/src/generators/component-test/component-test.d.ts +0 -4
- package/src/generators/component-test/component-test.js +0 -78
- package/src/generators/component-test/component-test.js.map +0 -1
- package/src/generators/component-test/files/__fileName__.cy__ext__ +0 -21
- package/src/generators/component-test/schema.d.ts +0 -4
- package/src/generators/component-test/schema.js +0 -3
- package/src/generators/component-test/schema.js.map +0 -1
- package/src/generators/component-test/schema.json +0 -31
- package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts +0 -9
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +0 -34
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js.map +0 -1
- package/src/generators/cypress-component-configuration/files/cypress/support/commands.ts__tpl__ +0 -42
- package/src/generators/cypress-component-configuration/files/cypress.config.ts__tpl__ +0 -8
- package/src/generators/cypress-component-configuration/lib/add-files.d.ts +0 -4
- package/src/generators/cypress-component-configuration/lib/add-files.js +0 -75
- package/src/generators/cypress-component-configuration/lib/add-files.js.map +0 -1
- package/src/generators/cypress-component-configuration/lib/update-configs.d.ts +0 -7
- package/src/generators/cypress-component-configuration/lib/update-configs.js +0 -30
- package/src/generators/cypress-component-configuration/lib/update-configs.js.map +0 -1
- package/src/generators/cypress-component-configuration/schema.d.ts +0 -7
- package/src/generators/cypress-component-configuration/schema.json +0 -54
- package/src/generators/hook/files/__fileName__.spec.tsx__tmpl__ +0 -18
- package/src/generators/hook/files/__fileName__.ts__tmpl__ +0 -15
- package/src/generators/hook/hook.d.ts +0 -5
- package/src/generators/hook/hook.js +0 -117
- package/src/generators/hook/hook.js.map +0 -1
- package/src/generators/hook/schema.d.ts +0 -11
- package/src/generators/hook/schema.json +0 -77
- package/src/generators/host/files/common/src/app/__fileName__.tsx__tmpl__ +0 -33
- package/src/generators/host/files/module-federation/module-federation.config.js__tmpl__ +0 -6
- package/src/generators/host/files/module-federation/src/main.ts__tmpl__ +0 -1
- package/src/generators/host/files/module-federation/src/remotes.d.ts__tmpl__ +0 -4
- package/src/generators/host/files/module-federation/webpack.config.js__tmpl__ +0 -12
- package/src/generators/host/files/module-federation/webpack.config.prod.js__tmpl__ +0 -32
- package/src/generators/host/files/module-federation-ssr/module-federation.server.config.js__tmpl__ +0 -13
- package/src/generators/host/files/module-federation-ssr/server.ts__tmpl__ +0 -28
- package/src/generators/host/files/module-federation-ssr/tsconfig.server.json__tmpl__ +0 -15
- package/src/generators/host/files/module-federation-ssr/webpack.server.config.js__tmpl__ +0 -12
- package/src/generators/host/host.d.ts +0 -4
- package/src/generators/host/host.js +0 -67
- package/src/generators/host/host.js.map +0 -1
- package/src/generators/host/lib/add-module-federation-files.d.ts +0 -5
- package/src/generators/host/lib/add-module-federation-files.js +0 -21
- package/src/generators/host/lib/add-module-federation-files.js.map +0 -1
- package/src/generators/host/lib/setup-ssr-for-host.d.ts +0 -6
- package/src/generators/host/lib/setup-ssr-for-host.js +0 -27
- package/src/generators/host/lib/setup-ssr-for-host.js.map +0 -1
- package/src/generators/host/lib/update-module-federation-e2e-project.d.ts +0 -3
- package/src/generators/host/lib/update-module-federation-e2e-project.js +0 -16
- package/src/generators/host/lib/update-module-federation-e2e-project.js.map +0 -1
- package/src/generators/host/schema.d.ts +0 -32
- package/src/generators/host/schema.json +0 -174
- package/src/generators/init/init.d.ts +0 -5
- package/src/generators/init/init.js +0 -80
- package/src/generators/init/init.js.map +0 -1
- package/src/generators/init/schema.d.ts +0 -11
- package/src/generators/init/schema.json +0 -49
- package/src/generators/library/files/common/.babelrc__tmpl__ +0 -16
- package/src/generators/library/files/common/README.md +0 -7
- package/src/generators/library/files/common/package.json__tmpl__ +0 -4
- package/src/generators/library/files/common/src/index.ts__tmpl__ +0 -0
- package/src/generators/library/files/common/tsconfig.lib.json__tmpl__ +0 -14
- package/src/generators/library/files/vite/README.md +0 -7
- package/src/generators/library/files/vite/package.json__tmpl__ +0 -12
- package/src/generators/library/files/vite/tsconfig.lib.json__tmpl__ +0 -14
- package/src/generators/library/lib/add-linting.d.ts +0 -3
- package/src/generators/library/lib/add-linting.js +0 -38
- package/src/generators/library/lib/add-linting.js.map +0 -1
- package/src/generators/library/lib/add-rollup-build-target.d.ts +0 -3
- package/src/generators/library/lib/add-rollup-build-target.js +0 -59
- package/src/generators/library/lib/add-rollup-build-target.js.map +0 -1
- package/src/generators/library/lib/create-files.d.ts +0 -3
- package/src/generators/library/lib/create-files.js +0 -26
- package/src/generators/library/lib/create-files.js.map +0 -1
- package/src/generators/library/lib/install-common-dependencies.d.ts +0 -3
- package/src/generators/library/lib/install-common-dependencies.js +0 -30
- package/src/generators/library/lib/install-common-dependencies.js.map +0 -1
- package/src/generators/library/lib/maybe-js.d.ts +0 -2
- package/src/generators/library/lib/maybe-js.js +0 -10
- package/src/generators/library/lib/maybe-js.js.map +0 -1
- package/src/generators/library/lib/normalize-options.d.ts +0 -3
- package/src/generators/library/lib/normalize-options.js +0 -57
- package/src/generators/library/lib/normalize-options.js.map +0 -1
- package/src/generators/library/lib/set-defaults.d.ts +0 -3
- package/src/generators/library/lib/set-defaults.js +0 -16
- package/src/generators/library/lib/set-defaults.js.map +0 -1
- package/src/generators/library/lib/update-app-routes.d.ts +0 -3
- package/src/generators/library/lib/update-app-routes.js +0 -63
- package/src/generators/library/lib/update-app-routes.js.map +0 -1
- package/src/generators/library/library.d.ts +0 -5
- package/src/generators/library/library.js +0 -126
- package/src/generators/library/library.js.map +0 -1
- package/src/generators/library/schema.d.ts +0 -44
- package/src/generators/library/schema.json +0 -198
- package/src/generators/redux/files/__directory__/__fileName__.slice.spec.ts__tmpl__ +0 -53
- package/src/generators/redux/files/__directory__/__fileName__.slice.ts__tmpl__ +0 -129
- package/src/generators/redux/redux.d.ts +0 -5
- package/src/generators/redux/redux.js +0 -117
- package/src/generators/redux/redux.js.map +0 -1
- package/src/generators/redux/schema.d.ts +0 -20
- package/src/generators/redux/schema.json +0 -47
- package/src/generators/remote/files/module-federation/module-federation.config.js__tmpl__ +0 -6
- package/src/generators/remote/files/module-federation/src/main.ts__tmpl__ +0 -1
- package/src/generators/remote/files/module-federation/src/remote-entry.ts__tmpl__ +0 -1
- package/src/generators/remote/files/module-federation/webpack.config.js__tmpl__ +0 -12
- package/src/generators/remote/files/module-federation/webpack.config.prod.js__tmpl__ +0 -1
- package/src/generators/remote/files/module-federation-ssr/module-federation.server.config.js__tmpl__ +0 -6
- package/src/generators/remote/files/module-federation-ssr/server.ts__tmpl__ +0 -45
- package/src/generators/remote/files/module-federation-ssr/webpack.server.config.js__tmpl__ +0 -12
- package/src/generators/remote/lib/setup-ssr-for-remote.d.ts +0 -4
- package/src/generators/remote/lib/setup-ssr-for-remote.js +0 -32
- package/src/generators/remote/lib/setup-ssr-for-remote.js.map +0 -1
- package/src/generators/remote/lib/update-host-with-remote.d.ts +0 -2
- package/src/generators/remote/lib/update-host-with-remote.js +0 -53
- package/src/generators/remote/lib/update-host-with-remote.js.map +0 -1
- package/src/generators/remote/remote.d.ts +0 -6
- package/src/generators/remote/remote.js +0 -56
- package/src/generators/remote/remote.js.map +0 -1
- package/src/generators/remote/schema.d.ts +0 -27
- package/src/generators/remote/schema.json +0 -173
- package/src/generators/setup-ssr/files/server.ts__tmpl__ +0 -28
- package/src/generators/setup-ssr/files/src/main.server.tsx__tmpl__ +0 -47
- package/src/generators/setup-ssr/files/tsconfig.server.json__tmpl__ +0 -15
- package/src/generators/setup-ssr/schema.d.ts +0 -7
- package/src/generators/setup-ssr/schema.json +0 -48
- package/src/generators/setup-ssr/setup-ssr.d.ts +0 -5
- package/src/generators/setup-ssr/setup-ssr.js +0 -162
- package/src/generators/setup-ssr/setup-ssr.js.map +0 -1
- package/src/generators/setup-tailwind/files/postcss.config.js__tmpl__ +0 -15
- package/src/generators/setup-tailwind/files/tailwind.config.js__tmpl__ +0 -17
- package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.d.ts +0 -3
- package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js +0 -36
- package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js.map +0 -1
- package/src/generators/setup-tailwind/lib/update-project.d.ts +0 -3
- package/src/generators/setup-tailwind/lib/update-project.js +0 -15
- package/src/generators/setup-tailwind/lib/update-project.js.map +0 -1
- package/src/generators/setup-tailwind/schema.d.ts +0 -6
- package/src/generators/setup-tailwind/schema.js +0 -3
- package/src/generators/setup-tailwind/schema.js.map +0 -1
- package/src/generators/setup-tailwind/schema.json +0 -47
- package/src/generators/setup-tailwind/setup-tailwind.d.ts +0 -5
- package/src/generators/setup-tailwind/setup-tailwind.js +0 -39
- package/src/generators/setup-tailwind/setup-tailwind.js.map +0 -1
- package/src/generators/stories/schema.json +0 -59
- package/src/generators/stories/stories.d.ts +0 -15
- package/src/generators/stories/stories.js +0 -118
- package/src/generators/stories/stories.js.map +0 -1
- package/src/generators/storybook-configuration/configuration.d.ts +0 -5
- package/src/generators/storybook-configuration/configuration.js +0 -65
- package/src/generators/storybook-configuration/configuration.js.map +0 -1
- package/src/generators/storybook-configuration/schema.d.ts +0 -18
- package/src/generators/storybook-configuration/schema.json +0 -109
- package/src/migrations/update-12-0-0/remove-react-redux-types-package.d.ts +0 -3
- package/src/migrations/update-12-0-0/remove-react-redux-types-package.js +0 -13
- package/src/migrations/update-12-0-0/remove-react-redux-types-package.js.map +0 -1
- package/src/migrations/update-12-0-0/update-emotion-setup.d.ts +0 -3
- package/src/migrations/update-12-0-0/update-emotion-setup.js +0 -67
- package/src/migrations/update-12-0-0/update-emotion-setup.js.map +0 -1
- package/src/migrations/update-12-0-0/use-react-jsx-in-tsconfig.d.ts +0 -3
- package/src/migrations/update-12-0-0/use-react-jsx-in-tsconfig.js +0 -27
- package/src/migrations/update-12-0-0/use-react-jsx-in-tsconfig.js.map +0 -1
- package/src/migrations/update-12-8-0/update-12-8-0.d.ts +0 -3
- package/src/migrations/update-12-8-0/update-12-8-0.js +0 -15
- package/src/migrations/update-12-8-0/update-12-8-0.js.map +0 -1
- package/src/migrations/update-13-0-0/migrate-storybook-to-webpack-5.d.ts +0 -3
- package/src/migrations/update-13-0-0/migrate-storybook-to-webpack-5.js +0 -38
- package/src/migrations/update-13-0-0/migrate-storybook-to-webpack-5.js.map +0 -1
- package/src/migrations/update-13-0-0/update-emotion-setup.d.ts +0 -3
- package/src/migrations/update-13-0-0/update-emotion-setup.js +0 -39
- package/src/migrations/update-13-0-0/update-emotion-setup.js.map +0 -1
- package/src/migrations/update-13-0-0/webpack5-changes-utils.d.ts +0 -11
- package/src/migrations/update-13-0-0/webpack5-changes-utils.js +0 -269
- package/src/migrations/update-13-0-0/webpack5-changes-utils.js.map +0 -1
- package/src/migrations/update-13-10-0/update-13-10-0.d.ts +0 -3
- package/src/migrations/update-13-10-0/update-13-10-0.js +0 -29
- package/src/migrations/update-13-10-0/update-13-10-0.js.map +0 -1
- package/src/migrations/update-14-0-0/add-default-development-configurations.d.ts +0 -3
- package/src/migrations/update-14-0-0/add-default-development-configurations.js +0 -40
- package/src/migrations/update-14-0-0/add-default-development-configurations.js.map +0 -1
- package/src/migrations/update-14-0-0/replace-testing-library-react-hook.d.ts +0 -3
- package/src/migrations/update-14-0-0/replace-testing-library-react-hook.js +0 -27
- package/src/migrations/update-14-0-0/replace-testing-library-react-hook.js.map +0 -1
- package/src/migrations/update-14-0-0/update-react-dom-render-for-v18.d.ts +0 -5
- package/src/migrations/update-14-0-0/update-react-dom-render-for-v18.js +0 -69
- package/src/migrations/update-14-0-0/update-react-dom-render-for-v18.js.map +0 -1
- package/src/migrations/update-14-1-0/update-external-emotion-jsx-runtime.d.ts +0 -3
- package/src/migrations/update-14-1-0/update-external-emotion-jsx-runtime.js +0 -38
- package/src/migrations/update-14-1-0/update-external-emotion-jsx-runtime.js.map +0 -1
- package/src/migrations/update-14-6-0/add-preset-jest-config.d.ts +0 -3
- package/src/migrations/update-14-6-0/add-preset-jest-config.js +0 -40
- package/src/migrations/update-14-6-0/add-preset-jest-config.js.map +0 -1
- package/src/migrations/update-15-3-0/install-webpack-rollup-dependencies.d.ts +0 -3
- package/src/migrations/update-15-3-0/install-webpack-rollup-dependencies.js +0 -39
- package/src/migrations/update-15-3-0/install-webpack-rollup-dependencies.js.map +0 -1
- package/src/migrations/update-15-3-0/update-rollup-executor.d.ts +0 -3
- package/src/migrations/update-15-3-0/update-rollup-executor.js +0 -17
- package/src/migrations/update-15-3-0/update-rollup-executor.js.map +0 -1
- package/src/migrations/update-15-6-3/webpack-config-setup.d.ts +0 -2
- package/src/migrations/update-15-6-3/webpack-config-setup.js +0 -108
- package/src/migrations/update-15-6-3/webpack-config-setup.js.map +0 -1
- package/src/module-federation/ast-utils.d.ts +0 -8
- package/src/module-federation/ast-utils.js +0 -103
- package/src/module-federation/ast-utils.js.map +0 -1
- package/src/module-federation/load-config.d.ts +0 -3
- package/src/module-federation/load-config.js +0 -17
- package/src/module-federation/load-config.js.map +0 -1
- package/src/module-federation/models.d.ts +0 -24
- package/src/module-federation/models.js +0 -3
- package/src/module-federation/models.js.map +0 -1
- package/src/module-federation/package-json.d.ts +0 -8
- package/src/module-federation/package-json.js +0 -14
- package/src/module-federation/package-json.js.map +0 -1
- package/src/module-federation/utils.d.ts +0 -10
- package/src/module-federation/utils.js +0 -38
- package/src/module-federation/utils.js.map +0 -1
- package/src/module-federation/with-module-federation-ssr.d.ts +0 -2
- package/src/module-federation/with-module-federation-ssr.js +0 -48
- package/src/module-federation/with-module-federation-ssr.js.map +0 -1
- package/src/module-federation/with-module-federation.d.ts +0 -7
- package/src/module-federation/with-module-federation.js +0 -50
- package/src/module-federation/with-module-federation.js.map +0 -1
- package/src/rules/add-styled-dependencies.d.ts +0 -2
- package/src/rules/add-styled-dependencies.js +0 -16
- package/src/rules/add-styled-dependencies.js.map +0 -1
- package/src/rules/update-module-federation-project.d.ts +0 -6
- package/src/rules/update-module-federation-project.js +0 -34
- package/src/rules/update-module-federation-project.js.map +0 -1
- package/src/utils/assertion.d.ts +0 -1
- package/src/utils/assertion.js +0 -20
- package/src/utils/assertion.js.map +0 -1
- package/src/utils/ast-utils.d.ts +0 -29
- package/src/utils/ast-utils.js +0 -526
- package/src/utils/ast-utils.js.map +0 -1
- package/src/utils/component-props.d.ts +0 -15
- package/src/utils/component-props.js +0 -61
- package/src/utils/component-props.js.map +0 -1
- package/src/utils/create-ts-config.d.ts +0 -9
- package/src/utils/create-ts-config.js +0 -64
- package/src/utils/create-ts-config.js.map +0 -1
- package/src/utils/dependencies.d.ts +0 -7
- package/src/utils/dependencies.js +0 -3
- package/src/utils/dependencies.js.map +0 -1
- package/src/utils/format-file.d.ts +0 -1
- package/src/utils/format-file.js +0 -13
- package/src/utils/format-file.js.map +0 -1
- package/src/utils/get-in-source-vitest-tests-template.d.ts +0 -1
- package/src/utils/get-in-source-vitest-tests-template.js +0 -22
- package/src/utils/get-in-source-vitest-tests-template.js.map +0 -1
- package/src/utils/jest-utils.d.ts +0 -1
- package/src/utils/jest-utils.js +0 -10
- package/src/utils/jest-utils.js.map +0 -1
- package/src/utils/lint.d.ts +0 -37
- package/src/utils/lint.js +0 -68
- package/src/utils/lint.js.map +0 -1
- package/src/utils/styled.d.ts +0 -4
- package/src/utils/styled.js +0 -33
- package/src/utils/styled.js.map +0 -1
- package/src/utils/testing-generators.d.ts +0 -3
- package/src/utils/testing-generators.js +0 -36
- package/src/utils/testing-generators.js.map +0 -1
- package/src/utils/versions.d.ts +0 -43
- package/src/utils/versions.js +0 -51
- package/src/utils/versions.js.map +0 -1
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"cli": "nx",
|
|
4
|
-
"$id": "NxReactComponent",
|
|
5
|
-
"title": "Create a React Component",
|
|
6
|
-
"description": "Create a React Component for Nx.",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"examples": [
|
|
9
|
-
{
|
|
10
|
-
"command": "nx g component my-component --project=mylib",
|
|
11
|
-
"description": "Generate a component in the `mylib` library"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"command": "nx g component my-component --project=mylib --classComponent",
|
|
15
|
-
"description": "Generate a class component in the `mylib` library"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
"properties": {
|
|
19
|
-
"project": {
|
|
20
|
-
"type": "string",
|
|
21
|
-
"description": "The name of the project.",
|
|
22
|
-
"alias": "p",
|
|
23
|
-
"$default": {
|
|
24
|
-
"$source": "projectName"
|
|
25
|
-
},
|
|
26
|
-
"x-prompt": "What is the name of the project for this component?",
|
|
27
|
-
"x-priority": "important"
|
|
28
|
-
},
|
|
29
|
-
"name": {
|
|
30
|
-
"type": "string",
|
|
31
|
-
"description": "The name of the component.",
|
|
32
|
-
"$default": {
|
|
33
|
-
"$source": "argv",
|
|
34
|
-
"index": 0
|
|
35
|
-
},
|
|
36
|
-
"x-prompt": "What name would you like to use for the component?",
|
|
37
|
-
"x-priority": "important"
|
|
38
|
-
},
|
|
39
|
-
"style": {
|
|
40
|
-
"description": "The file extension to be used for style files.",
|
|
41
|
-
"type": "string",
|
|
42
|
-
"alias": "s",
|
|
43
|
-
"default": "css",
|
|
44
|
-
"x-prompt": {
|
|
45
|
-
"message": "Which stylesheet format would you like to use?",
|
|
46
|
-
"type": "list",
|
|
47
|
-
"items": [
|
|
48
|
-
{ "value": "css", "label": "CSS" },
|
|
49
|
-
{
|
|
50
|
-
"value": "scss",
|
|
51
|
-
"label": "SASS(.scss) [ http://sass-lang.com ]"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"value": "styl",
|
|
55
|
-
"label": "Stylus(.styl) [ http://stylus-lang.com ]"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"value": "less",
|
|
59
|
-
"label": "LESS [ http://lesscss.org ]"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"value": "styled-components",
|
|
63
|
-
"label": "styled-components [ https://styled-components.com ]"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"value": "@emotion/styled",
|
|
67
|
-
"label": "emotion [ https://emotion.sh ]"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"value": "styled-jsx",
|
|
71
|
-
"label": "styled-jsx [ https://www.npmjs.com/package/styled-jsx ]"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"value": "none",
|
|
75
|
-
"label": "None"
|
|
76
|
-
}
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
"js": {
|
|
81
|
-
"type": "boolean",
|
|
82
|
-
"description": "Generate JavaScript files rather than TypeScript files.",
|
|
83
|
-
"default": false
|
|
84
|
-
},
|
|
85
|
-
"skipTests": {
|
|
86
|
-
"type": "boolean",
|
|
87
|
-
"description": "When true, does not create `spec.ts` test files for the new component.",
|
|
88
|
-
"default": false,
|
|
89
|
-
"x-priority": "internal"
|
|
90
|
-
},
|
|
91
|
-
"directory": {
|
|
92
|
-
"type": "string",
|
|
93
|
-
"description": "Create the component under this directory (can be nested).",
|
|
94
|
-
"alias": "dir",
|
|
95
|
-
"x-priority": "important"
|
|
96
|
-
},
|
|
97
|
-
"flat": {
|
|
98
|
-
"type": "boolean",
|
|
99
|
-
"description": "Create component at the source root rather than its own directory.",
|
|
100
|
-
"default": false
|
|
101
|
-
},
|
|
102
|
-
"export": {
|
|
103
|
-
"type": "boolean",
|
|
104
|
-
"description": "When true, the component is exported from the project `index.ts` (if it exists).",
|
|
105
|
-
"alias": "e",
|
|
106
|
-
"default": false,
|
|
107
|
-
"x-prompt": "Should this component be exported in the project?"
|
|
108
|
-
},
|
|
109
|
-
"pascalCaseFiles": {
|
|
110
|
-
"type": "boolean",
|
|
111
|
-
"description": "Use pascal case component file name (e.g. `App.tsx`).",
|
|
112
|
-
"alias": "P",
|
|
113
|
-
"default": false
|
|
114
|
-
},
|
|
115
|
-
"pascalCaseDirectory": {
|
|
116
|
-
"type": "boolean",
|
|
117
|
-
"description": "Use pascal case directory name (e.g. `App/App.tsx`).",
|
|
118
|
-
"alias": "R",
|
|
119
|
-
"default": false
|
|
120
|
-
},
|
|
121
|
-
"classComponent": {
|
|
122
|
-
"type": "boolean",
|
|
123
|
-
"alias": "C",
|
|
124
|
-
"description": "Use class components instead of functional component.",
|
|
125
|
-
"default": false
|
|
126
|
-
},
|
|
127
|
-
"routing": {
|
|
128
|
-
"type": "boolean",
|
|
129
|
-
"description": "Generate a library with routes."
|
|
130
|
-
},
|
|
131
|
-
"globalCss": {
|
|
132
|
-
"type": "boolean",
|
|
133
|
-
"description": "Default is `false`. When `true`, the component is generated with `*.css`/`*.scss` instead of `*.module.css`/`*.module.scss`.",
|
|
134
|
-
"default": false
|
|
135
|
-
},
|
|
136
|
-
"fileName": {
|
|
137
|
-
"type": "string",
|
|
138
|
-
"description": "Create a component with this file name."
|
|
139
|
-
},
|
|
140
|
-
"inSourceTests": {
|
|
141
|
-
"type": "boolean",
|
|
142
|
-
"default": false,
|
|
143
|
-
"description": "When using Vitest, separate spec files will not be generated and instead will be included within the source files. Read more on the Vitest docs site: https://vitest.dev/guide/in-source.html"
|
|
144
|
-
},
|
|
145
|
-
"skipFormat": {
|
|
146
|
-
"description": "Skip formatting files.",
|
|
147
|
-
"type": "boolean",
|
|
148
|
-
"default": false,
|
|
149
|
-
"x-priority": "internal"
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
"required": ["name", "project"]
|
|
153
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Tree } from '@nrwl/devkit';
|
|
2
|
-
import type * as ts from 'typescript';
|
|
3
|
-
export interface CreateComponentSpecFileSchema {
|
|
4
|
-
project: string;
|
|
5
|
-
componentPath: string;
|
|
6
|
-
js?: boolean;
|
|
7
|
-
cypressProject?: string;
|
|
8
|
-
skipFormat?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare function componentCypressGenerator(host: Tree, schema: CreateComponentSpecFileSchema): Promise<void>;
|
|
11
|
-
export declare function getArgsDefaultValue(property: ts.SyntaxKind): string;
|
|
12
|
-
export declare function createComponentSpecFile(tree: Tree, { project, componentPath, js, cypressProject }: CreateComponentSpecFileSchema): void;
|
|
13
|
-
export default componentCypressGenerator;
|
|
14
|
-
export declare const componentCypressSchematic: (generatorOptions: CreateComponentSpecFileSchema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.componentCypressSchematic = exports.createComponentSpecFile = exports.getArgsDefaultValue = exports.componentCypressGenerator = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
-
const path_1 = require("path");
|
|
7
|
-
const ast_utils_1 = require("../../utils/ast-utils");
|
|
8
|
-
const ensure_typescript_1 = require("@nrwl/js/src/utils/typescript/ensure-typescript");
|
|
9
|
-
let tsModule;
|
|
10
|
-
function componentCypressGenerator(host, schema) {
|
|
11
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
|
-
createComponentSpecFile(host, schema);
|
|
13
|
-
if (!schema.skipFormat) {
|
|
14
|
-
yield (0, devkit_1.formatFiles)(host);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
exports.componentCypressGenerator = componentCypressGenerator;
|
|
19
|
-
// TODO: candidate to refactor with the angular component story
|
|
20
|
-
function getArgsDefaultValue(property) {
|
|
21
|
-
if (!tsModule) {
|
|
22
|
-
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
23
|
-
}
|
|
24
|
-
const typeNameToDefault = {
|
|
25
|
-
[tsModule.SyntaxKind.StringKeyword]: '',
|
|
26
|
-
[tsModule.SyntaxKind.NumberKeyword]: 0,
|
|
27
|
-
[tsModule.SyntaxKind.BooleanKeyword]: false,
|
|
28
|
-
};
|
|
29
|
-
const resolvedValue = typeNameToDefault[property];
|
|
30
|
-
if (typeof resolvedValue === undefined) {
|
|
31
|
-
return '';
|
|
32
|
-
}
|
|
33
|
-
else if (typeof resolvedValue === 'string') {
|
|
34
|
-
return resolvedValue.replace(/\s/g, '+');
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
return resolvedValue;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.getArgsDefaultValue = getArgsDefaultValue;
|
|
41
|
-
function createComponentSpecFile(tree, { project, componentPath, js, cypressProject }) {
|
|
42
|
-
if (!tsModule) {
|
|
43
|
-
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
44
|
-
}
|
|
45
|
-
const e2eProjectName = cypressProject || `${project}-e2e`;
|
|
46
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
47
|
-
const e2eProject = projects.get(e2eProjectName);
|
|
48
|
-
// cypress >= v10 will have a cypress.config.ts < v10 will have a cypress.json
|
|
49
|
-
const isCypressV10 = tree.exists((0, path_1.join)(e2eProject.root, 'cypress.config.ts'));
|
|
50
|
-
const e2eLibIntegrationFolderPath = (0, path_1.join)(e2eProject.sourceRoot, isCypressV10 ? 'e2e' : 'integration');
|
|
51
|
-
const proj = projects.get(project);
|
|
52
|
-
const componentFilePath = (0, devkit_1.joinPathFragments)(proj.sourceRoot, componentPath);
|
|
53
|
-
const componentName = componentFilePath
|
|
54
|
-
.slice(componentFilePath.lastIndexOf('/') + 1)
|
|
55
|
-
.replace('.tsx', '')
|
|
56
|
-
.replace('.jsx', '')
|
|
57
|
-
.replace('.js', '');
|
|
58
|
-
const contents = tree.read(componentFilePath, 'utf-8');
|
|
59
|
-
if (contents === null) {
|
|
60
|
-
throw new Error(`Failed to read ${componentFilePath}`);
|
|
61
|
-
}
|
|
62
|
-
const sourceFile = tsModule.createSourceFile(componentFilePath, contents, tsModule.ScriptTarget.Latest, true);
|
|
63
|
-
const cmpDeclaration = (0, ast_utils_1.getComponentNode)(sourceFile);
|
|
64
|
-
if (!cmpDeclaration) {
|
|
65
|
-
const componentNodes = (0, ast_utils_1.findExportDeclarationsForJsx)(sourceFile);
|
|
66
|
-
if (componentNodes === null || componentNodes === void 0 ? void 0 : componentNodes.length) {
|
|
67
|
-
componentNodes.forEach((declaration) => {
|
|
68
|
-
findPropsAndGenerateFileForCypress(tree, sourceFile, declaration, e2eLibIntegrationFolderPath, componentName, project, js, true);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
throw new Error(`Could not find any React component in file ${componentFilePath}`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
findPropsAndGenerateFileForCypress(tree, sourceFile, cmpDeclaration, e2eLibIntegrationFolderPath, componentName, project, js);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.createComponentSpecFile = createComponentSpecFile;
|
|
80
|
-
function findPropsAndGenerateFileForCypress(tree, sourceFile, cmpDeclaration, e2eLibIntegrationFolderPath, componentName, project, js, fromNodeArray) {
|
|
81
|
-
const propsInterface = (0, ast_utils_1.getComponentPropsInterface)(sourceFile, cmpDeclaration);
|
|
82
|
-
let props = [];
|
|
83
|
-
if (propsInterface) {
|
|
84
|
-
props = propsInterface.members.map((member) => {
|
|
85
|
-
return {
|
|
86
|
-
name: member.name.text,
|
|
87
|
-
defaultValue: getArgsDefaultValue(member.type.kind),
|
|
88
|
-
};
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
const isCypressV10 = (0, path_1.basename)(e2eLibIntegrationFolderPath) === 'e2e';
|
|
92
|
-
const cyFilePrefix = isCypressV10 ? 'cy' : 'spec';
|
|
93
|
-
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, './files'), `${e2eLibIntegrationFolderPath}/${fromNodeArray
|
|
94
|
-
? componentName + '--' + cmpDeclaration.name.text
|
|
95
|
-
: componentName}`, {
|
|
96
|
-
projectName: project,
|
|
97
|
-
componentName,
|
|
98
|
-
componentSelector: cmpDeclaration.name.text,
|
|
99
|
-
props,
|
|
100
|
-
fileExt: js ? `${cyFilePrefix}.js` : `${cyFilePrefix}.ts`,
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
exports.default = componentCypressGenerator;
|
|
104
|
-
exports.componentCypressSchematic = (0, devkit_1.convertNxGenerator)(componentCypressGenerator);
|
|
105
|
-
//# sourceMappingURL=component-cypress-spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-cypress-spec.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/component-cypress-spec/component-cypress-spec.ts"],"names":[],"mappings":";;;;AAAA,yCAOsB;AACtB,+BAAsC;AAEtC,qDAI+B;AAC/B,uFAAmF;AAEnF,IAAI,QAAqC,CAAC;AAU1C,SAAsB,yBAAyB,CAC7C,IAAU,EACV,MAAqC;;QAErC,uBAAuB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAEtC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;YACtB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;IACH,CAAC;CAAA;AATD,8DASC;AAED,+DAA+D;AAC/D,SAAgB,mBAAmB,CAAC,QAAuB;IACzD,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG,IAAA,oCAAgB,GAAE,CAAC;KAC/B;IACD,MAAM,iBAAiB,GAAwB;QAC7C,CAAC,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,EAAE;QACvC,CAAC,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QACtC,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,KAAK;KAC5C,CAAC;IAEF,MAAM,aAAa,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAClD,IAAI,OAAO,aAAa,KAAK,SAAS,EAAE;QACtC,OAAO,EAAE,CAAC;KACX;SAAM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AO,CAAC,GAAG,CAAC,CAAC,MAA4B,EAAE,EAAE;YAClE,OAAO;gBACL,IAAI,EAAG,MAAM,CAAC,IAAsB,CAAC,IAAI;gBACzC,YAAY,EAAE,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;aACpD,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;IAED,MAAM,YAAY,GAAG,IAAA,eAAQ,EAAC,2BAA2B,CAAC,KAAK,KAAK,CAAC;IACrE,MAAM,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;IAElD,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,SAAS,CAAC,EACvC,GAAG,2BAA2B,IAC5B,aAAa;QACX,CAAC,CAAC,aAAa,GAAG,IAAI,GAAI,cAAsB,CAAC,IAAI,CAAC,IAAI;QAC1D,CAAC,CAAC,aACN,EAAE,EACF;QACE,WAAW,EAAE,OAAO;QACpB,aAAa;QACb,iBAAiB,EAAG,cAAsB,CAAC,IAAI,CAAC,IAAI;QACpD,KAAK;QACL,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,YAAY,KAAK;KAC1D,CACF,CAAC;AACJ,CAAC;AAED,kBAAe,yBAAyB,CAAC;AAC5B,QAAA,yBAAyB,GAAG,IAAA,2BAAkB,EACzD,yBAAyB,CAC1B,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
describe('<%=projectName%>: <%= componentSelector %> component', () => {
|
|
2
|
-
beforeEach(() => cy.visit('/iframe.html?id=<%= componentSelector.toLowerCase() %>--primary<% if ( props && props.length > 0 ) { %>&args=<% } %><%
|
|
3
|
-
for(let prop of props) {
|
|
4
|
-
%><%=prop.name%><%
|
|
5
|
-
if(prop.defaultValue !== undefined && (prop.defaultValue || prop.defaultValue === false)) {
|
|
6
|
-
%>:<%=prop.defaultValue%><%
|
|
7
|
-
} %>;<%
|
|
8
|
-
}%>'));
|
|
9
|
-
|
|
10
|
-
it('should render the component', () => {
|
|
11
|
-
cy.get('h1').should('contain', 'Welcome to <%=componentSelector%>!');
|
|
12
|
-
});
|
|
13
|
-
});
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"cli": "nx",
|
|
4
|
-
"$id": "NxReactComponentCypressSpec",
|
|
5
|
-
"title": "Create component Cypress spec",
|
|
6
|
-
"description": "Create a Cypress spec for a UI component that has a story.",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"properties": {
|
|
9
|
-
"project": {
|
|
10
|
-
"type": "string",
|
|
11
|
-
"description": "The project name for which to generate tests.",
|
|
12
|
-
"examples": ["shared-ui-component"],
|
|
13
|
-
"$default": {
|
|
14
|
-
"$source": "projectName",
|
|
15
|
-
"index": 0
|
|
16
|
-
},
|
|
17
|
-
"x-prompt": "What's name of the project for which to generate tests?",
|
|
18
|
-
"x-priority": "important"
|
|
19
|
-
},
|
|
20
|
-
"componentPath": {
|
|
21
|
-
"type": "string",
|
|
22
|
-
"description": "Relative path to the component file from the library root?",
|
|
23
|
-
"examples": ["lib/components"],
|
|
24
|
-
"x-prompt": "What's path of the component relative to the project's lib root for which to generate a test?",
|
|
25
|
-
"x-priority": "important"
|
|
26
|
-
},
|
|
27
|
-
"js": {
|
|
28
|
-
"type": "boolean",
|
|
29
|
-
"description": "Generate JavaScript files rather than TypeScript files.",
|
|
30
|
-
"default": false
|
|
31
|
-
},
|
|
32
|
-
"cypressProject": {
|
|
33
|
-
"type": "string",
|
|
34
|
-
"description": "The Cypress project to generate the stories under. By default, inferred from `project`."
|
|
35
|
-
},
|
|
36
|
-
"skipFormat": {
|
|
37
|
-
"description": "Skip formatting files.",
|
|
38
|
-
"type": "boolean",
|
|
39
|
-
"default": false,
|
|
40
|
-
"x-priority": "internal"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"required": ["project", "componentPath"]
|
|
44
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Tree } from '@nrwl/devkit';
|
|
2
|
-
import type * as ts from 'typescript';
|
|
3
|
-
export interface CreateComponentStoriesFileSchema {
|
|
4
|
-
project: string;
|
|
5
|
-
componentPath: string;
|
|
6
|
-
skipFormat?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare function createComponentStoriesFile(host: Tree, { project, componentPath }: CreateComponentStoriesFileSchema): void;
|
|
9
|
-
export declare function findPropsAndGenerateFile(host: Tree, sourceFile: ts.SourceFile, cmpDeclaration: ts.Node, componentDirectory: string, name: string, isPlainJs: boolean, fileExt: string, fromNodeArray?: boolean): void;
|
|
10
|
-
export declare function componentStoryGenerator(host: Tree, schema: CreateComponentStoriesFileSchema): Promise<void>;
|
|
11
|
-
export default componentStoryGenerator;
|
|
12
|
-
export declare const componentStorySchematic: (generatorOptions: CreateComponentStoriesFileSchema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.componentStorySchematic = exports.componentStoryGenerator = exports.findPropsAndGenerateFile = exports.createComponentStoriesFile = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
-
const ast_utils_1 = require("../../utils/ast-utils");
|
|
7
|
-
const component_props_1 = require("../../utils/component-props");
|
|
8
|
-
const ensure_typescript_1 = require("@nrwl/js/src/utils/typescript/ensure-typescript");
|
|
9
|
-
let tsModule;
|
|
10
|
-
function createComponentStoriesFile(host, { project, componentPath }) {
|
|
11
|
-
if (!tsModule) {
|
|
12
|
-
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
13
|
-
}
|
|
14
|
-
const proj = (0, devkit_1.getProjects)(host).get(project);
|
|
15
|
-
const sourceRoot = proj.sourceRoot;
|
|
16
|
-
const componentFilePath = (0, devkit_1.joinPathFragments)(sourceRoot, componentPath);
|
|
17
|
-
const componentDirectory = componentFilePath.replace(componentFilePath.slice(componentFilePath.lastIndexOf('/')), '');
|
|
18
|
-
const isPlainJs = componentFilePath.endsWith('.jsx') || componentFilePath.endsWith('.js');
|
|
19
|
-
let fileExt = 'tsx';
|
|
20
|
-
if (componentFilePath.endsWith('.jsx')) {
|
|
21
|
-
fileExt = 'jsx';
|
|
22
|
-
}
|
|
23
|
-
else if (componentFilePath.endsWith('.js')) {
|
|
24
|
-
fileExt = 'js';
|
|
25
|
-
}
|
|
26
|
-
const componentFileName = componentFilePath
|
|
27
|
-
.slice(componentFilePath.lastIndexOf('/') + 1)
|
|
28
|
-
.replace('.tsx', '')
|
|
29
|
-
.replace('.jsx', '')
|
|
30
|
-
.replace('.js', '');
|
|
31
|
-
const name = componentFileName;
|
|
32
|
-
const contents = host.read(componentFilePath, 'utf-8');
|
|
33
|
-
if (contents === null) {
|
|
34
|
-
throw new Error(`Failed to read ${componentFilePath}`);
|
|
35
|
-
}
|
|
36
|
-
const sourceFile = tsModule.createSourceFile(componentFilePath, contents, tsModule.ScriptTarget.Latest, true);
|
|
37
|
-
const cmpDeclaration = (0, ast_utils_1.getComponentNode)(sourceFile);
|
|
38
|
-
if (!cmpDeclaration) {
|
|
39
|
-
const componentNodes = (0, ast_utils_1.findExportDeclarationsForJsx)(sourceFile);
|
|
40
|
-
if (componentNodes === null || componentNodes === void 0 ? void 0 : componentNodes.length) {
|
|
41
|
-
componentNodes.forEach((declaration) => {
|
|
42
|
-
findPropsAndGenerateFile(host, sourceFile, declaration, componentDirectory, name, isPlainJs, fileExt, componentNodes.length > 1);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
throw new Error(`Could not find any React component in file ${componentFilePath}`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
findPropsAndGenerateFile(host, sourceFile, cmpDeclaration, componentDirectory, name, isPlainJs, fileExt);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.createComponentStoriesFile = createComponentStoriesFile;
|
|
54
|
-
function findPropsAndGenerateFile(host, sourceFile, cmpDeclaration, componentDirectory, name, isPlainJs, fileExt, fromNodeArray) {
|
|
55
|
-
const { propsTypeName, props, argTypes } = (0, component_props_1.getDefaultsForComponent)(sourceFile, cmpDeclaration);
|
|
56
|
-
(0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, './files'), (0, devkit_1.normalizePath)(componentDirectory), {
|
|
57
|
-
componentFileName: fromNodeArray
|
|
58
|
-
? `${name}--${cmpDeclaration.name.text}`
|
|
59
|
-
: name,
|
|
60
|
-
componentImportFileName: name,
|
|
61
|
-
propsTypeName,
|
|
62
|
-
props,
|
|
63
|
-
argTypes,
|
|
64
|
-
componentName: cmpDeclaration.name.text,
|
|
65
|
-
isPlainJs,
|
|
66
|
-
fileExt,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
exports.findPropsAndGenerateFile = findPropsAndGenerateFile;
|
|
70
|
-
function componentStoryGenerator(host, schema) {
|
|
71
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
createComponentStoriesFile(host, schema);
|
|
73
|
-
if (!schema.skipFormat) {
|
|
74
|
-
yield (0, devkit_1.formatFiles)(host);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
exports.componentStoryGenerator = componentStoryGenerator;
|
|
79
|
-
exports.default = componentStoryGenerator;
|
|
80
|
-
exports.componentStorySchematic = (0, devkit_1.convertNxGenerator)(componentStoryGenerator);
|
|
81
|
-
//# sourceMappingURL=component-story.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-story.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/component-story/component-story.ts"],"names":[],"mappings":";;;;AAAA,yCAQsB;AAEtB,qDAG+B;AAC/B,i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A,0BAAiB,EAAC,SAAS,EAAE,SAAS,CAAC,EACvC,IAAA,sBAAa,EAAC,kBAAkB,CAAC,EACjC;QACE,iBAAiB,EAAE,aAAa;YAC9B,CAAC,CAAC,GAAG,IAAI,KAAM,cAAsB,CAAC,IAAI,CAAC,IAAI,EAAE;YACjD,CAAC,CAAC,IAAI;QACR,uBAAuB,EAAE,IAAI;QAC7B,aAAa;QACb,KAAK;QACL,QAAQ;QACR,aAAa,EAAG,cAAsB,CAAC,IAAI,CAAC,IAAI;QAChD,SAAS;QACT,OAAO;KACR,CACF,CAAC;AACJ,CAAC;AAhCD,4DAgCC;AAED,SAAsB,uBAAuB,CAC3C,IAAU,EACV,MAAwC;;QAExC,0BAA0B,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAEzC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;YACtB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;IACH,CAAC;CAAA;AATD,0DASC;AAED,kBAAe,uBAAuB,CAAC;AAC1B,QAAA,uBAAuB,GAAG,IAAA,2BAAkB,EACvD,uBAAuB,CACxB,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<% if ( !isPlainJs ) { %>import type { Meta } from '@storybook/react';<% } %>
|
|
2
|
-
import<% if ( !isPlainJs ) { %> { <% } %> <%= componentName %> <% if ( !isPlainJs ) { %> } <% } %> from './<%= componentImportFileName %>';
|
|
3
|
-
|
|
4
|
-
<% if ( isPlainJs ) { %>
|
|
5
|
-
export default {
|
|
6
|
-
component: <%= componentName %>,
|
|
7
|
-
title: '<%= componentName %>',<% if ( argTypes && argTypes.length > 0 ) { %>
|
|
8
|
-
argTypes: {<% for (let argType of argTypes) { %>
|
|
9
|
-
<%= argType.name %>: { <%- argType.type %> : "<%- argType.actionText %>" },<% } %>
|
|
10
|
-
}
|
|
11
|
-
<% } %>
|
|
12
|
-
};
|
|
13
|
-
<% } %>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<% if ( !isPlainJs ) { %>
|
|
17
|
-
const Story: Meta<typeof <%= componentName %>> = {
|
|
18
|
-
component: <%= componentName %>,
|
|
19
|
-
title: '<%= componentName %>',<% if ( argTypes && argTypes.length > 0 ) { %>
|
|
20
|
-
argTypes: {<% for (let argType of argTypes) { %>
|
|
21
|
-
<%= argType.name %>: { <%- argType.type %> : "<%- argType.actionText %>" },<% } %>
|
|
22
|
-
}
|
|
23
|
-
<% } %>
|
|
24
|
-
};
|
|
25
|
-
export default Story;
|
|
26
|
-
<% } %>
|
|
27
|
-
|
|
28
|
-
export const Primary = {
|
|
29
|
-
args: {<% for (let prop of props) { %>
|
|
30
|
-
<%= prop.name %>: <%- prop.defaultValue %>,<% } %>
|
|
31
|
-
},
|
|
32
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"cli": "nx",
|
|
4
|
-
"$id": "NxReactComponentStory",
|
|
5
|
-
"title": "Create component story",
|
|
6
|
-
"description": "Generate storybook story for a react component.",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"properties": {
|
|
9
|
-
"project": {
|
|
10
|
-
"type": "string",
|
|
11
|
-
"aliases": ["name", "projectName"],
|
|
12
|
-
"description": "The project where to add the components.",
|
|
13
|
-
"examples": ["shared-ui-component"],
|
|
14
|
-
"$default": {
|
|
15
|
-
"$source": "projectName",
|
|
16
|
-
"index": 0
|
|
17
|
-
},
|
|
18
|
-
"x-prompt": "What's name of the project where the component lives?",
|
|
19
|
-
"x-priority": "important"
|
|
20
|
-
},
|
|
21
|
-
"componentPath": {
|
|
22
|
-
"type": "string",
|
|
23
|
-
"description": "Relative path to the component file from the library root.",
|
|
24
|
-
"examples": ["lib/components"],
|
|
25
|
-
"x-prompt": "What's path of the component relative to the project's lib root?",
|
|
26
|
-
"x-priority": "important"
|
|
27
|
-
},
|
|
28
|
-
"skipFormat": {
|
|
29
|
-
"description": "Skip formatting files.",
|
|
30
|
-
"type": "boolean",
|
|
31
|
-
"default": false,
|
|
32
|
-
"x-priority": "internal"
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
"required": ["project", "componentPath"]
|
|
36
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.componentTestGenerator = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
-
const path_1 = require("path");
|
|
7
|
-
const ast_utils_1 = require("../../utils/ast-utils");
|
|
8
|
-
const component_props_1 = require("../../utils/component-props");
|
|
9
|
-
const versions_1 = require("../../utils/versions");
|
|
10
|
-
const ensure_typescript_1 = require("@nrwl/js/src/utils/typescript/ensure-typescript");
|
|
11
|
-
let tsModule;
|
|
12
|
-
function componentTestGenerator(tree, options) {
|
|
13
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
14
|
-
(0, devkit_1.ensurePackage)('@nrwl/cypress', versions_1.nxVersion);
|
|
15
|
-
const { assertMinimumCypressVersion } = yield Promise.resolve().then(() => require('@nrwl/cypress/src/utils/cypress-version'));
|
|
16
|
-
assertMinimumCypressVersion(10);
|
|
17
|
-
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
18
|
-
const normalizedPath = options.componentPath.startsWith(projectConfig.sourceRoot)
|
|
19
|
-
? (0, path_1.relative)(projectConfig.sourceRoot, options.componentPath)
|
|
20
|
-
: options.componentPath;
|
|
21
|
-
const componentPath = (0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, normalizedPath);
|
|
22
|
-
if (tree.exists(componentPath)) {
|
|
23
|
-
generateSpecsForComponents(tree, componentPath);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
exports.componentTestGenerator = componentTestGenerator;
|
|
28
|
-
function generateSpecsForComponents(tree, filePath) {
|
|
29
|
-
if (!tsModule) {
|
|
30
|
-
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
31
|
-
}
|
|
32
|
-
const sourceFile = tsModule.createSourceFile(filePath, tree.read(filePath, 'utf-8'), tsModule.ScriptTarget.Latest, true);
|
|
33
|
-
const cmpNodes = (0, ast_utils_1.findExportDeclarationsForJsx)(sourceFile);
|
|
34
|
-
const componentDir = (0, path_1.dirname)(filePath);
|
|
35
|
-
const ext = (0, path_1.extname)(filePath);
|
|
36
|
-
const fileName = (0, path_1.basename)(filePath, ext);
|
|
37
|
-
if (tree.exists((0, devkit_1.joinPathFragments)(componentDir, `${fileName}.cy${ext}`))) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const defaultExport = (0, ast_utils_1.getComponentNode)(sourceFile);
|
|
41
|
-
if (cmpNodes === null || cmpNodes === void 0 ? void 0 : cmpNodes.length) {
|
|
42
|
-
const components = cmpNodes.map((cmp) => {
|
|
43
|
-
const defaults = (0, component_props_1.getDefaultsForComponent)(sourceFile, cmp);
|
|
44
|
-
const isDefaultExport = defaultExport
|
|
45
|
-
? defaultExport.name.text === cmp.name.text
|
|
46
|
-
: false;
|
|
47
|
-
return {
|
|
48
|
-
isDefaultExport,
|
|
49
|
-
props: [...defaults.props, ...defaults.argTypes],
|
|
50
|
-
name: cmp.name.text,
|
|
51
|
-
typeName: defaults.propsTypeName,
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
const namedImports = components
|
|
55
|
-
.reduce((imports, cmp) => {
|
|
56
|
-
if (cmp.typeName) {
|
|
57
|
-
imports.push(cmp.typeName);
|
|
58
|
-
}
|
|
59
|
-
if (cmp.isDefaultExport) {
|
|
60
|
-
return imports;
|
|
61
|
-
}
|
|
62
|
-
imports.push(cmp.name);
|
|
63
|
-
return imports;
|
|
64
|
-
}, [])
|
|
65
|
-
.join(', ');
|
|
66
|
-
const namedImportStatement = namedImports.length > 0 ? `, { ${namedImports} }` : '';
|
|
67
|
-
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), componentDir, {
|
|
68
|
-
fileName,
|
|
69
|
-
components,
|
|
70
|
-
importStatement: defaultExport
|
|
71
|
-
? `import ${defaultExport.name.text}${namedImportStatement} from './${fileName}'`
|
|
72
|
-
: `import { ${namedImports} } from './${fileName}'`,
|
|
73
|
-
ext,
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.default = componentTestGenerator;
|
|
78
|
-
//# sourceMappingURL=component-test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-test.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/component-test/component-test.ts"],"names":[],"mappings":";;;;AAAA,yCAMsB;AACtB,+BAA4D;AAC5D,qDAG+B;AAC/B,iEAAsE;AACtE,mDAAiD;AAEjD,uFAAmF;AAEnF,IAAI,QAAqC,CAAC;AAE1C,SAAsB,sBAAsB,CAC1C,IAAU,EACV,OAA4B;;QAE5B,IAAA,sBAAa,EAAC,eAAe,EAAE,oBAAS,CAAC,CAAC;QAC1C,MAAM,EAAE,2BAA2B,EAAE,GAAG,2CACtC,yCAAyC,EAC1C,CAAC;QACF,2BAA2B,CAAC,EAAE,CAAC,CAAC;QAEhC,MAAM,aAAa,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAEtE,MAAM,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,UAAU,CACrD,aAAa,CAAC,UAAU,CACzB;YACC,CAAC,CAAC,IAAA,eAAQ,EAAC,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,aAAa,CAAC;YAC3D,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;QAE1B,MAAM,aAAa,GAAG,IAAA,0BAAiB,EACrC,aAAa,CAAC,UAAU,EACxB,cAAc,CACf,CAAC;QAEF,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;YAC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
|
|
5
|
-
describe(<%= cmp.name %>.name, () => {<% if (cmp.typeName) { %>
|
|
6
|
-
let props: <%= cmp.typeName%>;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
props = {<% for (let prop of cmp.props) { %>
|
|
10
|
-
<%- prop.name %>: <% if(prop.type === 'action') { %>undefined<% } else { %><%- prop.defaultValue %>,<% } %><% }%>
|
|
11
|
-
}
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
it('renders', () => {
|
|
15
|
-
cy.mount(<<%= cmp.name %> {...props}/>)
|
|
16
|
-
})<% } else { %>
|
|
17
|
-
it('renders', () => {
|
|
18
|
-
cy.mount(<<%= cmp.name %> />)
|
|
19
|
-
})<% } %>
|
|
20
|
-
})
|
|
21
|
-
<% } %>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/component-test/schema.ts"],"names":[],"mappings":""}
|