@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.
Files changed (421) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +22 -0
  3. package/README.md +63 -0
  4. package/ast-utils.d.ts +1 -0
  5. package/ast-utils.js +12 -0
  6. package/ast-utils.js.map +1 -0
  7. package/babel.d.ts +16 -0
  8. package/babel.js +52 -0
  9. package/babel.js.map +1 -0
  10. package/executors.json +26 -0
  11. package/generators.json +223 -0
  12. package/index.d.ts +21 -0
  13. package/index.js +47 -0
  14. package/index.js.map +1 -0
  15. package/migrations.json +870 -0
  16. package/module-federation.d.ts +4 -0
  17. package/module-federation.js +13 -0
  18. package/module-federation.js.map +1 -0
  19. package/package.json +49 -0
  20. package/plugins/bundle-rollup.d.ts +1 -0
  21. package/plugins/bundle-rollup.js +42 -0
  22. package/plugins/bundle-rollup.js.map +1 -0
  23. package/plugins/component-testing/index.d.ts +38 -0
  24. package/plugins/component-testing/index.js +122 -0
  25. package/plugins/component-testing/index.js.map +1 -0
  26. package/plugins/component-testing/webpack-fallback.d.ts +5 -0
  27. package/plugins/component-testing/webpack-fallback.js +135 -0
  28. package/plugins/component-testing/webpack-fallback.js.map +1 -0
  29. package/plugins/jest.d.ts +1 -0
  30. package/plugins/jest.js +62 -0
  31. package/plugins/jest.js.map +1 -0
  32. package/plugins/storybook/index.d.ts +3 -0
  33. package/plugins/storybook/index.js +77 -0
  34. package/plugins/storybook/index.js.map +1 -0
  35. package/plugins/storybook/merge-plugins.d.ts +3 -0
  36. package/plugins/storybook/merge-plugins.js +18 -0
  37. package/plugins/storybook/merge-plugins.js.map +1 -0
  38. package/plugins/webpack.d.ts +3 -0
  39. package/plugins/webpack.js +15 -0
  40. package/plugins/webpack.js.map +1 -0
  41. package/plugins/with-react.d.ts +12 -0
  42. package/plugins/with-react.js +82 -0
  43. package/plugins/with-react.js.map +1 -0
  44. package/src/executors/module-federation-dev-server/compat.d.ts +2 -0
  45. package/src/executors/module-federation-dev-server/compat.js +6 -0
  46. package/src/executors/module-federation-dev-server/compat.js.map +1 -0
  47. package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +11 -0
  48. package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +55 -0
  49. package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js.map +1 -0
  50. package/src/executors/module-federation-dev-server/schema.json +96 -0
  51. package/src/executors/module-federation-ssr-dev-server/compat.d.ts +2 -0
  52. package/src/executors/module-federation-ssr-dev-server/compat.js +6 -0
  53. package/src/executors/module-federation-ssr-dev-server/compat.js.map +1 -0
  54. package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +9 -0
  55. package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +71 -0
  56. package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js.map +1 -0
  57. package/src/executors/module-federation-ssr-dev-server/schema.json +48 -0
  58. package/src/generators/application/application.d.ts +5 -0
  59. package/src/generators/application/application.js +129 -0
  60. package/src/generators/application/application.js.map +1 -0
  61. package/src/generators/application/files/base-vite/index.html__tmpl__ +16 -0
  62. package/src/generators/application/files/base-vite/public/favicon.ico +0 -0
  63. package/src/generators/application/files/base-vite/src/app/__fileName__.spec.tsx__tmpl__ +10 -0
  64. package/src/generators/application/files/base-vite/src/assets/.gitkeep +0 -0
  65. package/src/generators/application/files/base-vite/src/environments/environment.prod.ts__tmpl__ +3 -0
  66. package/src/generators/application/files/base-vite/src/environments/environment.ts__tmpl__ +6 -0
  67. package/src/generators/application/files/base-vite/src/main.tsx__tmpl__ +10 -0
  68. package/src/generators/application/files/base-vite/tsconfig.app.json__tmpl__ +14 -0
  69. package/src/generators/application/files/base-webpack/.babelrc__tmpl__ +13 -0
  70. package/src/generators/application/files/base-webpack/src/app/__fileName__.spec.tsx__tmpl__ +10 -0
  71. package/src/generators/application/files/base-webpack/src/assets/.gitkeep +0 -0
  72. package/src/generators/application/files/base-webpack/src/environments/environment.prod.ts__tmpl__ +3 -0
  73. package/src/generators/application/files/base-webpack/src/environments/environment.ts__tmpl__ +6 -0
  74. package/src/generators/application/files/base-webpack/src/favicon.ico +0 -0
  75. package/src/generators/application/files/base-webpack/src/index.html +14 -0
  76. package/src/generators/application/files/base-webpack/src/main.tsx__tmpl__ +10 -0
  77. package/src/generators/application/files/base-webpack/tsconfig.app.json__tmpl__ +14 -0
  78. package/src/generators/application/files/base-webpack/webpack.config.js__tmpl__ +9 -0
  79. package/src/generators/application/files/nx-welcome/src/app/nx-welcome.tsx +845 -0
  80. package/src/generators/application/files/style-css-module/src/app/__fileName__.module.__style__ +1 -0
  81. package/src/generators/application/files/style-css-module/src/app/__fileName__.tsx__tmpl__ +37 -0
  82. package/src/generators/application/files/style-css-module/src/styles.__style__ +1 -0
  83. package/src/generators/application/files/style-global-css/src/app/__fileName__.__style__ +1 -0
  84. package/src/generators/application/files/style-global-css/src/app/__fileName__.tsx__tmpl__ +36 -0
  85. package/src/generators/application/files/style-global-css/src/styles.__style__ +1 -0
  86. package/src/generators/application/files/style-none/src/app/__fileName__.tsx__tmpl__ +35 -0
  87. package/src/generators/application/files/style-styled-jsx/src/app/__fileName__.tsx__tmpl__ +29 -0
  88. package/src/generators/application/files/style-styled-module/src/app/__fileName__.tsx__tmpl__ +40 -0
  89. package/src/generators/application/lib/add-cypress.d.ts +3 -0
  90. package/src/generators/application/lib/add-cypress.js +22 -0
  91. package/src/generators/application/lib/add-cypress.js.map +1 -0
  92. package/src/generators/application/lib/add-jest.d.ts +3 -0
  93. package/src/generators/application/lib/add-jest.js +17 -0
  94. package/src/generators/application/lib/add-jest.js.map +1 -0
  95. package/src/generators/application/lib/add-project.d.ts +2 -0
  96. package/src/generators/application/lib/add-project.js +98 -0
  97. package/src/generators/application/lib/add-project.js.map +1 -0
  98. package/src/generators/application/lib/add-routing.d.ts +3 -0
  99. package/src/generators/application/lib/add-routing.js +32 -0
  100. package/src/generators/application/lib/add-routing.js.map +1 -0
  101. package/src/generators/application/lib/create-application-files.d.ts +3 -0
  102. package/src/generators/application/lib/create-application-files.js +47 -0
  103. package/src/generators/application/lib/create-application-files.js.map +1 -0
  104. package/src/generators/application/lib/find-free-port.d.ts +2 -0
  105. package/src/generators/application/lib/find-free-port.js +18 -0
  106. package/src/generators/application/lib/find-free-port.js.map +1 -0
  107. package/src/generators/application/lib/get-app-tests.d.ts +2 -0
  108. package/src/generators/application/lib/get-app-tests.js +22 -0
  109. package/src/generators/application/lib/get-app-tests.js.map +1 -0
  110. package/src/generators/application/lib/install-common-dependencies.d.ts +3 -0
  111. package/src/generators/application/lib/install-common-dependencies.js +29 -0
  112. package/src/generators/application/lib/install-common-dependencies.js.map +1 -0
  113. package/src/generators/application/lib/normalize-options.d.ts +5 -0
  114. package/src/generators/application/lib/normalize-options.js +60 -0
  115. package/src/generators/application/lib/normalize-options.js.map +1 -0
  116. package/src/generators/application/lib/set-defaults.d.ts +3 -0
  117. package/src/generators/application/lib/set-defaults.js +23 -0
  118. package/src/generators/application/lib/set-defaults.js.map +1 -0
  119. package/src/generators/application/lib/update-jest-config.d.ts +3 -0
  120. package/src/generators/application/lib/update-jest-config.js +30 -0
  121. package/src/generators/application/lib/update-jest-config.js.map +1 -0
  122. package/src/generators/application/schema.d.ts +44 -0
  123. package/src/generators/application/schema.json +196 -0
  124. package/src/generators/component/component.d.ts +5 -0
  125. package/src/generators/component/component.js +141 -0
  126. package/src/generators/component/component.js.map +1 -0
  127. package/src/generators/component/files/__fileName__.__style__ +0 -0
  128. package/src/generators/component/files/__fileName__.module.__style__ +7 -0
  129. package/src/generators/component/files/__fileName__.spec.tsx__tmpl__ +7 -0
  130. package/src/generators/component/files/__fileName__.tsx__tmpl__ +71 -0
  131. package/src/generators/component/get-component-tests.d.ts +2 -0
  132. package/src/generators/component/get-component-tests.js +13 -0
  133. package/src/generators/component/get-component-tests.js.map +1 -0
  134. package/src/generators/component/noramlized-schema.d.ts +8 -0
  135. package/src/generators/component/noramlized-schema.js +3 -0
  136. package/src/generators/component/noramlized-schema.js.map +1 -0
  137. package/src/generators/component/schema.d.ts +20 -0
  138. package/src/generators/component/schema.json +153 -0
  139. package/src/generators/component-cypress-spec/component-cypress-spec.d.ts +14 -0
  140. package/src/generators/component-cypress-spec/component-cypress-spec.js +105 -0
  141. package/src/generators/component-cypress-spec/component-cypress-spec.js.map +1 -0
  142. package/src/generators/component-cypress-spec/files/__componentName__.__fileExt__ +13 -0
  143. package/src/generators/component-cypress-spec/schema.json +44 -0
  144. package/src/generators/component-story/component-story.d.ts +12 -0
  145. package/src/generators/component-story/component-story.js +81 -0
  146. package/src/generators/component-story/component-story.js.map +1 -0
  147. package/src/generators/component-story/files/__componentFileName__.stories.__fileExt__ +32 -0
  148. package/src/generators/component-story/schema.json +36 -0
  149. package/src/generators/component-test/component-test.d.ts +4 -0
  150. package/src/generators/component-test/component-test.js +78 -0
  151. package/src/generators/component-test/component-test.js.map +1 -0
  152. package/src/generators/component-test/files/__fileName__.cy__ext__ +21 -0
  153. package/src/generators/component-test/schema.d.ts +4 -0
  154. package/src/generators/component-test/schema.js +3 -0
  155. package/src/generators/component-test/schema.js.map +1 -0
  156. package/src/generators/component-test/schema.json +31 -0
  157. package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts +9 -0
  158. package/src/generators/cypress-component-configuration/cypress-component-configuration.js +34 -0
  159. package/src/generators/cypress-component-configuration/cypress-component-configuration.js.map +1 -0
  160. package/src/generators/cypress-component-configuration/files/cypress/support/commands.ts__tpl__ +42 -0
  161. package/src/generators/cypress-component-configuration/files/cypress.config.ts__tpl__ +8 -0
  162. package/src/generators/cypress-component-configuration/lib/add-files.d.ts +4 -0
  163. package/src/generators/cypress-component-configuration/lib/add-files.js +75 -0
  164. package/src/generators/cypress-component-configuration/lib/add-files.js.map +1 -0
  165. package/src/generators/cypress-component-configuration/lib/update-configs.d.ts +7 -0
  166. package/src/generators/cypress-component-configuration/lib/update-configs.js +30 -0
  167. package/src/generators/cypress-component-configuration/lib/update-configs.js.map +1 -0
  168. package/src/generators/cypress-component-configuration/schema.d.ts +7 -0
  169. package/src/generators/cypress-component-configuration/schema.json +54 -0
  170. package/src/generators/hook/files/__fileName__.spec.tsx__tmpl__ +18 -0
  171. package/src/generators/hook/files/__fileName__.ts__tmpl__ +15 -0
  172. package/src/generators/hook/hook.d.ts +5 -0
  173. package/src/generators/hook/hook.js +117 -0
  174. package/src/generators/hook/hook.js.map +1 -0
  175. package/src/generators/hook/schema.d.ts +11 -0
  176. package/src/generators/hook/schema.json +77 -0
  177. package/src/generators/host/files/common/src/app/__fileName__.tsx__tmpl__ +33 -0
  178. package/src/generators/host/files/module-federation/module-federation.config.js__tmpl__ +6 -0
  179. package/src/generators/host/files/module-federation/src/main.ts__tmpl__ +1 -0
  180. package/src/generators/host/files/module-federation/src/remotes.d.ts__tmpl__ +4 -0
  181. package/src/generators/host/files/module-federation/webpack.config.js__tmpl__ +12 -0
  182. package/src/generators/host/files/module-federation/webpack.config.prod.js__tmpl__ +32 -0
  183. package/src/generators/host/files/module-federation-ssr/module-federation.server.config.js__tmpl__ +13 -0
  184. package/src/generators/host/files/module-federation-ssr/server.ts__tmpl__ +28 -0
  185. package/src/generators/host/files/module-federation-ssr/tsconfig.server.json__tmpl__ +15 -0
  186. package/src/generators/host/files/module-federation-ssr/webpack.server.config.js__tmpl__ +12 -0
  187. package/src/generators/host/host.d.ts +4 -0
  188. package/src/generators/host/host.js +67 -0
  189. package/src/generators/host/host.js.map +1 -0
  190. package/src/generators/host/lib/add-module-federation-files.d.ts +5 -0
  191. package/src/generators/host/lib/add-module-federation-files.js +21 -0
  192. package/src/generators/host/lib/add-module-federation-files.js.map +1 -0
  193. package/src/generators/host/lib/setup-ssr-for-host.d.ts +6 -0
  194. package/src/generators/host/lib/setup-ssr-for-host.js +27 -0
  195. package/src/generators/host/lib/setup-ssr-for-host.js.map +1 -0
  196. package/src/generators/host/lib/update-module-federation-e2e-project.d.ts +3 -0
  197. package/src/generators/host/lib/update-module-federation-e2e-project.js +16 -0
  198. package/src/generators/host/lib/update-module-federation-e2e-project.js.map +1 -0
  199. package/src/generators/host/schema.d.ts +31 -0
  200. package/src/generators/host/schema.json +168 -0
  201. package/src/generators/init/init.d.ts +5 -0
  202. package/src/generators/init/init.js +80 -0
  203. package/src/generators/init/init.js.map +1 -0
  204. package/src/generators/init/schema.d.ts +11 -0
  205. package/src/generators/init/schema.json +49 -0
  206. package/src/generators/library/files/common/.babelrc__tmpl__ +16 -0
  207. package/src/generators/library/files/common/README.md +7 -0
  208. package/src/generators/library/files/common/package.json__tmpl__ +4 -0
  209. package/src/generators/library/files/common/src/index.ts__tmpl__ +0 -0
  210. package/src/generators/library/files/common/tsconfig.lib.json__tmpl__ +14 -0
  211. package/src/generators/library/files/vite/README.md +7 -0
  212. package/src/generators/library/files/vite/package.json__tmpl__ +12 -0
  213. package/src/generators/library/files/vite/tsconfig.lib.json__tmpl__ +14 -0
  214. package/src/generators/library/lib/add-linting.d.ts +3 -0
  215. package/src/generators/library/lib/add-linting.js +38 -0
  216. package/src/generators/library/lib/add-linting.js.map +1 -0
  217. package/src/generators/library/lib/add-rollup-build-target.d.ts +3 -0
  218. package/src/generators/library/lib/add-rollup-build-target.js +59 -0
  219. package/src/generators/library/lib/add-rollup-build-target.js.map +1 -0
  220. package/src/generators/library/lib/create-files.d.ts +3 -0
  221. package/src/generators/library/lib/create-files.js +26 -0
  222. package/src/generators/library/lib/create-files.js.map +1 -0
  223. package/src/generators/library/lib/install-common-dependencies.d.ts +3 -0
  224. package/src/generators/library/lib/install-common-dependencies.js +30 -0
  225. package/src/generators/library/lib/install-common-dependencies.js.map +1 -0
  226. package/src/generators/library/lib/maybe-js.d.ts +2 -0
  227. package/src/generators/library/lib/maybe-js.js +10 -0
  228. package/src/generators/library/lib/maybe-js.js.map +1 -0
  229. package/src/generators/library/lib/normalize-options.d.ts +3 -0
  230. package/src/generators/library/lib/normalize-options.js +57 -0
  231. package/src/generators/library/lib/normalize-options.js.map +1 -0
  232. package/src/generators/library/lib/set-defaults.d.ts +3 -0
  233. package/src/generators/library/lib/set-defaults.js +16 -0
  234. package/src/generators/library/lib/set-defaults.js.map +1 -0
  235. package/src/generators/library/lib/update-app-routes.d.ts +3 -0
  236. package/src/generators/library/lib/update-app-routes.js +63 -0
  237. package/src/generators/library/lib/update-app-routes.js.map +1 -0
  238. package/src/generators/library/library.d.ts +5 -0
  239. package/src/generators/library/library.js +128 -0
  240. package/src/generators/library/library.js.map +1 -0
  241. package/src/generators/library/schema.d.ts +43 -0
  242. package/src/generators/library/schema.json +192 -0
  243. package/src/generators/redux/files/__directory__/__fileName__.slice.spec.ts__tmpl__ +53 -0
  244. package/src/generators/redux/files/__directory__/__fileName__.slice.ts__tmpl__ +129 -0
  245. package/src/generators/redux/redux.d.ts +5 -0
  246. package/src/generators/redux/redux.js +117 -0
  247. package/src/generators/redux/redux.js.map +1 -0
  248. package/src/generators/redux/schema.d.ts +20 -0
  249. package/src/generators/redux/schema.json +47 -0
  250. package/src/generators/remote/files/module-federation/module-federation.config.js__tmpl__ +6 -0
  251. package/src/generators/remote/files/module-federation/src/main.ts__tmpl__ +1 -0
  252. package/src/generators/remote/files/module-federation/src/remote-entry.ts__tmpl__ +1 -0
  253. package/src/generators/remote/files/module-federation/webpack.config.js__tmpl__ +12 -0
  254. package/src/generators/remote/files/module-federation/webpack.config.prod.js__tmpl__ +1 -0
  255. package/src/generators/remote/files/module-federation-ssr/module-federation.server.config.js__tmpl__ +6 -0
  256. package/src/generators/remote/files/module-federation-ssr/server.ts__tmpl__ +45 -0
  257. package/src/generators/remote/files/module-federation-ssr/webpack.server.config.js__tmpl__ +12 -0
  258. package/src/generators/remote/lib/setup-ssr-for-remote.d.ts +4 -0
  259. package/src/generators/remote/lib/setup-ssr-for-remote.js +32 -0
  260. package/src/generators/remote/lib/setup-ssr-for-remote.js.map +1 -0
  261. package/src/generators/remote/lib/update-host-with-remote.d.ts +2 -0
  262. package/src/generators/remote/lib/update-host-with-remote.js +53 -0
  263. package/src/generators/remote/lib/update-host-with-remote.js.map +1 -0
  264. package/src/generators/remote/remote.d.ts +6 -0
  265. package/src/generators/remote/remote.js +56 -0
  266. package/src/generators/remote/remote.js.map +1 -0
  267. package/src/generators/remote/schema.d.ts +26 -0
  268. package/src/generators/remote/schema.json +167 -0
  269. package/src/generators/setup-ssr/files/server.ts__tmpl__ +28 -0
  270. package/src/generators/setup-ssr/files/src/main.server.tsx__tmpl__ +47 -0
  271. package/src/generators/setup-ssr/files/tsconfig.server.json__tmpl__ +15 -0
  272. package/src/generators/setup-ssr/schema.d.ts +7 -0
  273. package/src/generators/setup-ssr/schema.json +48 -0
  274. package/src/generators/setup-ssr/setup-ssr.d.ts +5 -0
  275. package/src/generators/setup-ssr/setup-ssr.js +162 -0
  276. package/src/generators/setup-ssr/setup-ssr.js.map +1 -0
  277. package/src/generators/setup-tailwind/files/postcss.config.js__tmpl__ +15 -0
  278. package/src/generators/setup-tailwind/files/tailwind.config.js__tmpl__ +17 -0
  279. package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.d.ts +3 -0
  280. package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js +36 -0
  281. package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js.map +1 -0
  282. package/src/generators/setup-tailwind/lib/update-project.d.ts +3 -0
  283. package/src/generators/setup-tailwind/lib/update-project.js +15 -0
  284. package/src/generators/setup-tailwind/lib/update-project.js.map +1 -0
  285. package/src/generators/setup-tailwind/schema.d.ts +6 -0
  286. package/src/generators/setup-tailwind/schema.js +3 -0
  287. package/src/generators/setup-tailwind/schema.js.map +1 -0
  288. package/src/generators/setup-tailwind/schema.json +47 -0
  289. package/src/generators/setup-tailwind/setup-tailwind.d.ts +5 -0
  290. package/src/generators/setup-tailwind/setup-tailwind.js +39 -0
  291. package/src/generators/setup-tailwind/setup-tailwind.js.map +1 -0
  292. package/src/generators/stories/schema.json +59 -0
  293. package/src/generators/stories/stories.d.ts +15 -0
  294. package/src/generators/stories/stories.js +118 -0
  295. package/src/generators/stories/stories.js.map +1 -0
  296. package/src/generators/storybook-configuration/configuration.d.ts +5 -0
  297. package/src/generators/storybook-configuration/configuration.js +64 -0
  298. package/src/generators/storybook-configuration/configuration.js.map +1 -0
  299. package/src/generators/storybook-configuration/schema.d.ts +17 -0
  300. package/src/generators/storybook-configuration/schema.json +103 -0
  301. package/src/migrations/update-12-0-0/remove-react-redux-types-package.d.ts +3 -0
  302. package/src/migrations/update-12-0-0/remove-react-redux-types-package.js +13 -0
  303. package/src/migrations/update-12-0-0/remove-react-redux-types-package.js.map +1 -0
  304. package/src/migrations/update-12-0-0/update-emotion-setup.d.ts +3 -0
  305. package/src/migrations/update-12-0-0/update-emotion-setup.js +67 -0
  306. package/src/migrations/update-12-0-0/update-emotion-setup.js.map +1 -0
  307. package/src/migrations/update-12-0-0/use-react-jsx-in-tsconfig.d.ts +3 -0
  308. package/src/migrations/update-12-0-0/use-react-jsx-in-tsconfig.js +27 -0
  309. package/src/migrations/update-12-0-0/use-react-jsx-in-tsconfig.js.map +1 -0
  310. package/src/migrations/update-12-8-0/update-12-8-0.d.ts +3 -0
  311. package/src/migrations/update-12-8-0/update-12-8-0.js +15 -0
  312. package/src/migrations/update-12-8-0/update-12-8-0.js.map +1 -0
  313. package/src/migrations/update-13-0-0/migrate-storybook-to-webpack-5.d.ts +3 -0
  314. package/src/migrations/update-13-0-0/migrate-storybook-to-webpack-5.js +38 -0
  315. package/src/migrations/update-13-0-0/migrate-storybook-to-webpack-5.js.map +1 -0
  316. package/src/migrations/update-13-0-0/update-emotion-setup.d.ts +3 -0
  317. package/src/migrations/update-13-0-0/update-emotion-setup.js +39 -0
  318. package/src/migrations/update-13-0-0/update-emotion-setup.js.map +1 -0
  319. package/src/migrations/update-13-0-0/webpack5-changes-utils.d.ts +11 -0
  320. package/src/migrations/update-13-0-0/webpack5-changes-utils.js +269 -0
  321. package/src/migrations/update-13-0-0/webpack5-changes-utils.js.map +1 -0
  322. package/src/migrations/update-13-10-0/update-13-10-0.d.ts +3 -0
  323. package/src/migrations/update-13-10-0/update-13-10-0.js +29 -0
  324. package/src/migrations/update-13-10-0/update-13-10-0.js.map +1 -0
  325. package/src/migrations/update-14-0-0/add-default-development-configurations.d.ts +3 -0
  326. package/src/migrations/update-14-0-0/add-default-development-configurations.js +40 -0
  327. package/src/migrations/update-14-0-0/add-default-development-configurations.js.map +1 -0
  328. package/src/migrations/update-14-0-0/replace-testing-library-react-hook.d.ts +3 -0
  329. package/src/migrations/update-14-0-0/replace-testing-library-react-hook.js +27 -0
  330. package/src/migrations/update-14-0-0/replace-testing-library-react-hook.js.map +1 -0
  331. package/src/migrations/update-14-0-0/update-react-dom-render-for-v18.d.ts +5 -0
  332. package/src/migrations/update-14-0-0/update-react-dom-render-for-v18.js +69 -0
  333. package/src/migrations/update-14-0-0/update-react-dom-render-for-v18.js.map +1 -0
  334. package/src/migrations/update-14-1-0/update-external-emotion-jsx-runtime.d.ts +3 -0
  335. package/src/migrations/update-14-1-0/update-external-emotion-jsx-runtime.js +38 -0
  336. package/src/migrations/update-14-1-0/update-external-emotion-jsx-runtime.js.map +1 -0
  337. package/src/migrations/update-14-6-0/add-preset-jest-config.d.ts +3 -0
  338. package/src/migrations/update-14-6-0/add-preset-jest-config.js +40 -0
  339. package/src/migrations/update-14-6-0/add-preset-jest-config.js.map +1 -0
  340. package/src/migrations/update-15-3-0/install-webpack-rollup-dependencies.d.ts +3 -0
  341. package/src/migrations/update-15-3-0/install-webpack-rollup-dependencies.js +39 -0
  342. package/src/migrations/update-15-3-0/install-webpack-rollup-dependencies.js.map +1 -0
  343. package/src/migrations/update-15-3-0/update-rollup-executor.d.ts +3 -0
  344. package/src/migrations/update-15-3-0/update-rollup-executor.js +17 -0
  345. package/src/migrations/update-15-3-0/update-rollup-executor.js.map +1 -0
  346. package/src/migrations/update-15-6-3/webpack-config-setup.d.ts +2 -0
  347. package/src/migrations/update-15-6-3/webpack-config-setup.js +108 -0
  348. package/src/migrations/update-15-6-3/webpack-config-setup.js.map +1 -0
  349. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
  350. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +13 -0
  351. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
  352. package/src/module-federation/ast-utils.d.ts +8 -0
  353. package/src/module-federation/ast-utils.js +103 -0
  354. package/src/module-federation/ast-utils.js.map +1 -0
  355. package/src/module-federation/load-config.d.ts +3 -0
  356. package/src/module-federation/load-config.js +17 -0
  357. package/src/module-federation/load-config.js.map +1 -0
  358. package/src/module-federation/models.d.ts +24 -0
  359. package/src/module-federation/models.js +3 -0
  360. package/src/module-federation/models.js.map +1 -0
  361. package/src/module-federation/package-json.d.ts +8 -0
  362. package/src/module-federation/package-json.js +14 -0
  363. package/src/module-federation/package-json.js.map +1 -0
  364. package/src/module-federation/utils.d.ts +10 -0
  365. package/src/module-federation/utils.js +38 -0
  366. package/src/module-federation/utils.js.map +1 -0
  367. package/src/module-federation/with-module-federation-ssr.d.ts +2 -0
  368. package/src/module-federation/with-module-federation-ssr.js +48 -0
  369. package/src/module-federation/with-module-federation-ssr.js.map +1 -0
  370. package/src/module-federation/with-module-federation.d.ts +7 -0
  371. package/src/module-federation/with-module-federation.js +50 -0
  372. package/src/module-federation/with-module-federation.js.map +1 -0
  373. package/src/rules/add-styled-dependencies.d.ts +2 -0
  374. package/src/rules/add-styled-dependencies.js +16 -0
  375. package/src/rules/add-styled-dependencies.js.map +1 -0
  376. package/src/rules/update-module-federation-project.d.ts +6 -0
  377. package/src/rules/update-module-federation-project.js +34 -0
  378. package/src/rules/update-module-federation-project.js.map +1 -0
  379. package/src/utils/assertion.d.ts +1 -0
  380. package/src/utils/assertion.js +20 -0
  381. package/src/utils/assertion.js.map +1 -0
  382. package/src/utils/ast-utils.d.ts +29 -0
  383. package/src/utils/ast-utils.js +526 -0
  384. package/src/utils/ast-utils.js.map +1 -0
  385. package/src/utils/component-props.d.ts +15 -0
  386. package/src/utils/component-props.js +61 -0
  387. package/src/utils/component-props.js.map +1 -0
  388. package/src/utils/create-ts-config.d.ts +9 -0
  389. package/src/utils/create-ts-config.js +64 -0
  390. package/src/utils/create-ts-config.js.map +1 -0
  391. package/src/utils/dependencies.d.ts +7 -0
  392. package/src/utils/dependencies.js +3 -0
  393. package/src/utils/dependencies.js.map +1 -0
  394. package/src/utils/format-file.d.ts +1 -0
  395. package/src/utils/format-file.js +13 -0
  396. package/src/utils/format-file.js.map +1 -0
  397. package/src/utils/get-in-source-vitest-tests-template.d.ts +1 -0
  398. package/src/utils/get-in-source-vitest-tests-template.js +22 -0
  399. package/src/utils/get-in-source-vitest-tests-template.js.map +1 -0
  400. package/src/utils/jest-utils.d.ts +1 -0
  401. package/src/utils/jest-utils.js +10 -0
  402. package/src/utils/jest-utils.js.map +1 -0
  403. package/src/utils/lint.d.ts +37 -0
  404. package/src/utils/lint.js +68 -0
  405. package/src/utils/lint.js.map +1 -0
  406. package/src/utils/styled.d.ts +4 -0
  407. package/src/utils/styled.js +33 -0
  408. package/src/utils/styled.js.map +1 -0
  409. package/src/utils/testing-generators.d.ts +3 -0
  410. package/src/utils/testing-generators.js +35 -0
  411. package/src/utils/testing-generators.js.map +1 -0
  412. package/src/utils/versions.d.ts +43 -0
  413. package/src/utils/versions.js +51 -0
  414. package/src/utils/versions.js.map +1 -0
  415. package/tailwind.d.ts +6 -0
  416. package/tailwind.js +30 -0
  417. package/tailwind.js.map +1 -0
  418. package/typings/cssmodule.d.ts +24 -0
  419. package/typings/image.d.ts +48 -0
  420. package/typings/style.d.ts +9 -0
  421. package/typings/styled-jsx.d.ts +8 -0
@@ -0,0 +1,153 @@
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": "less",
55
+ "label": "LESS [ http://lesscss.org ]"
56
+ },
57
+ {
58
+ "value": "styled-components",
59
+ "label": "styled-components [ https://styled-components.com ]"
60
+ },
61
+ {
62
+ "value": "@emotion/styled",
63
+ "label": "emotion [ https://emotion.sh ]"
64
+ },
65
+ {
66
+ "value": "styled-jsx",
67
+ "label": "styled-jsx [ https://www.npmjs.com/package/styled-jsx ]"
68
+ },
69
+ {
70
+ "value": "none",
71
+ "label": "None"
72
+ },
73
+ {
74
+ "value": "styl",
75
+ "label": "Stylus(.styl) [ http://stylus-lang.com ] (DEPRECATED)"
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
+ }
@@ -0,0 +1,14 @@
1
+ import { Tree } from '@nx/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>;
@@ -0,0 +1,105 @@
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("@nx/devkit");
6
+ const path_1 = require("path");
7
+ const ast_utils_1 = require("../../utils/ast-utils");
8
+ const ensure_typescript_1 = require("@nx/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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-cypress-spec.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/component-cypress-spec/component-cypress-spec.ts"],"names":[],"mappings":";;;;AAAA,uCAOoB;AACpB,+BAAsC;AAEtC,qDAI+B;AAC/B,qFAAiF;AAEjF,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;YACt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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"}
@@ -0,0 +1,13 @@
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
+ });
@@ -0,0 +1,44 @@
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
+ }
@@ -0,0 +1,12 @@
1
+ import { Tree } from '@nx/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>;
@@ -0,0 +1,81 @@
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("@nx/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("@nx/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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-story.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/component-story/component-story.ts"],"names":[],"mappings":";;;;AAAA,uCAQoB;AAEpB,qDAG+B;AAC/B,iEAAsE;AACtE,qFAAiF;AAEjF,IAAI,QAAqC,CAAC;AAQ1C,SAAgB,0BAA0B,CACxC,IAAU,EACV,EAAE,OAAO,EAAE,aAAa,EAAoC;IAE5D,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG,IAAA,oCAAgB,GAAE,CAAC;KAC/B;IACD,MAAM,IAAI,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IAEnC,MAAM,iBAAiB,GAAG,IAAA,0BAAiB,EAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IAEvE,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,OAAO,CAClD,iBAAiB,CAAC,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAC3D,EAAE,C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I,CAAC,CAAC;SACzB;IACH,CAAC;CAAA;AATD,0DASC;AAED,kBAAe,uBAAuB,CAAC;AAC1B,QAAA,uBAAuB,GAAG,IAAA,2BAAkB,EACvD,uBAAuB,CACxB,CAAC"}
@@ -0,0 +1,32 @@
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
+ };
@@ -0,0 +1,36 @@
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
+ }
@@ -0,0 +1,4 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { ComponentTestSchema } from './schema';
3
+ export declare function componentTestGenerator(tree: Tree, options: ComponentTestSchema): Promise<void>;
4
+ export default componentTestGenerator;
@@ -0,0 +1,78 @@
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("@nx/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("@nx/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)('@nx/cypress', versions_1.nxVersion);
15
+ const { assertMinimumCypressVersion } = yield Promise.resolve().then(() => require('@nx/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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-test.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/component-test/component-test.ts"],"names":[],"mappings":";;;;AAAA,uCAMoB;AACpB,+BAA4D;AAC5D,qDAG+B;AAC/B,iEAAsE;AACtE,mDAAiD;AAEjD,qFAAiF;AAEjF,IAAI,QAAqC,CAAC;AAE1C,SAAsB,sBAAsB,CAC1C,IAAU,EACV,OAA4B;;QAE5B,IAAA,sBAAa,EAAC,aAAa,EAAE,oBAAS,CAAC,CAAC;QACxC,MAAM,EAAE,2BAA2B,EAAE,GAAG,2CACtC,uCAAuC,EACxC,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;YAC9B,0BAA0B,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;SACjD;IACH,CAAC;CAAA;AA1BD,wDA0BC;AAED,SAAS,0BAA0B,CAAC,IAAU,EAAE,QAAgB;IAC9D,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG,IAAA,oCAAgB,GAAE,CAAC;KAC/B;IAED,MAAM,UAAU,GAAG,QAAQ,CAAC,gBAAgB,CAC1C,QAAQ,EACR,IAAI,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AE,GAAG,EAAE,EAAE;YACvB,IAAI,GAAG,CAAC,QAAQ,EAAE;gBAChB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;aAC5B;YACD,IAAI,GAAG,CAAC,eAAe,EAAE;gBACvB,OAAO,OAAO,CAAC;aAChB;YAED,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACvB,OAAO,OAAO,CAAC;QACjB,CAAC,EAAE,EAAE,CAAC;aACL,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,MAAM,oBAAoB,GACxB,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,YAAY,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAEzD,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,EAAE,YAAY,EAAE;YACvE,QAAQ;YACR,UAAU;YACV,eAAe,EAAE,aAAa;gBAC5B,CAAC,CAAC,UACG,aAAqB,CAAC,IAAI,CAAC,IAC9B,GAAG,oBAAoB,YAAY,QAAQ,GAAG;gBAChD,CAAC,CAAC,YAAY,YAAY,cAAc,QAAQ,GAAG;YACrD,GAAG;SACJ,CAAC,CAAC;KACJ;AACH,CAAC;AAED,kBAAe,sBAAsB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import * as React from 'react'
2
+ <%- importStatement %>
3
+
4
+ <% for (let cmp of components) { %>
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
+ <% } %>
@@ -0,0 +1,4 @@
1
+ export interface ComponentTestSchema {
2
+ project: string;
3
+ componentPath: string;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/component-test/schema.ts"],"names":[],"mappings":""}