@cedarjs/cli 0.0.4

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 (360) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +706 -0
  3. package/dist/commands/build.js +54 -0
  4. package/dist/commands/buildHandler.js +134 -0
  5. package/dist/commands/check.js +28 -0
  6. package/dist/commands/console.js +13 -0
  7. package/dist/commands/consoleHandler.js +68 -0
  8. package/dist/commands/deploy/baremetal/SshExecutor.js +41 -0
  9. package/dist/commands/deploy/baremetal/baremetalHandler.js +558 -0
  10. package/dist/commands/deploy/baremetal.js +89 -0
  11. package/dist/commands/deploy/flightcontrol.js +40 -0
  12. package/dist/commands/deploy/flightcontrolHandler.js +58 -0
  13. package/dist/commands/deploy/helpers/deployBuilder.js +25 -0
  14. package/dist/commands/deploy/helpers/deployHandler.js +31 -0
  15. package/dist/commands/deploy/netlify.js +21 -0
  16. package/dist/commands/deploy/packing/nft.js +61 -0
  17. package/dist/commands/deploy/render.js +37 -0
  18. package/dist/commands/deploy/renderHandler.js +70 -0
  19. package/dist/commands/deploy/serverless.js +51 -0
  20. package/dist/commands/deploy/serverlessHandler.js +211 -0
  21. package/dist/commands/deploy/vercel.js +21 -0
  22. package/dist/commands/deploy.js +21 -0
  23. package/dist/commands/destroy/cell/cell.js +12 -0
  24. package/dist/commands/destroy/cell/cellHandler.js +10 -0
  25. package/dist/commands/destroy/component/component.js +15 -0
  26. package/dist/commands/destroy/component/componentHandler.js +10 -0
  27. package/dist/commands/destroy/directive/directive.js +14 -0
  28. package/dist/commands/destroy/directive/directiveHandler.js +12 -0
  29. package/dist/commands/destroy/function/function.js +20 -0
  30. package/dist/commands/destroy/function/functionHandler.js +10 -0
  31. package/dist/commands/destroy/handlerHelpers.js +34 -0
  32. package/dist/commands/destroy/helpers.js +22 -0
  33. package/dist/commands/destroy/layout/layout.js +12 -0
  34. package/dist/commands/destroy/layout/layoutHandler.js +10 -0
  35. package/dist/commands/destroy/page/page.js +20 -0
  36. package/dist/commands/destroy/page/pageHandler.js +51 -0
  37. package/dist/commands/destroy/scaffold/scaffold.js +16 -0
  38. package/dist/commands/destroy/scaffold/scaffoldHandler.js +105 -0
  39. package/dist/commands/destroy/sdl/sdl.js +16 -0
  40. package/dist/commands/destroy/sdl/sdlHandler.js +33 -0
  41. package/dist/commands/destroy/service/service.js +10 -0
  42. package/dist/commands/destroy/service/serviceHandler.js +17 -0
  43. package/dist/commands/destroy.js +25 -0
  44. package/dist/commands/dev.js +47 -0
  45. package/dist/commands/devHandler.js +202 -0
  46. package/dist/commands/exec.js +38 -0
  47. package/dist/commands/execHandler.js +180 -0
  48. package/dist/commands/experimental/setupInngest.js +28 -0
  49. package/dist/commands/experimental/setupInngestHandler.js +46 -0
  50. package/dist/commands/experimental/setupOpentelemetry.js +34 -0
  51. package/dist/commands/experimental/setupOpentelemetryHandler.js +215 -0
  52. package/dist/commands/experimental/setupReactCompiler.js +28 -0
  53. package/dist/commands/experimental/setupReactCompilerHandler.js +124 -0
  54. package/dist/commands/experimental/setupRsc.js +28 -0
  55. package/dist/commands/experimental/setupRscHandler.js +408 -0
  56. package/dist/commands/experimental/setupStreamingSsr.js +28 -0
  57. package/dist/commands/experimental/setupStreamingSsrHandler.js +208 -0
  58. package/dist/commands/experimental/templates/opentelemetry.ts.template +55 -0
  59. package/dist/commands/experimental/templates/rsc/AboutCounter.tsx.template +20 -0
  60. package/dist/commands/experimental/templates/rsc/AboutPage.css.template +2 -0
  61. package/dist/commands/experimental/templates/rsc/AboutPage.tsx.template +17 -0
  62. package/dist/commands/experimental/templates/rsc/Counter.css.template +7 -0
  63. package/dist/commands/experimental/templates/rsc/Counter.module.css.template +3 -0
  64. package/dist/commands/experimental/templates/rsc/Counter.tsx.template +18 -0
  65. package/dist/commands/experimental/templates/rsc/Document.tsx.template +27 -0
  66. package/dist/commands/experimental/templates/rsc/HomePage.css.template +2 -0
  67. package/dist/commands/experimental/templates/rsc/HomePage.module.css.template +3 -0
  68. package/dist/commands/experimental/templates/rsc/HomePage.tsx.template +19 -0
  69. package/dist/commands/experimental/templates/rsc/NavigationLayout.css.template +32 -0
  70. package/dist/commands/experimental/templates/rsc/NavigationLayout.tsx.template +31 -0
  71. package/dist/commands/experimental/templates/rsc/Routes.tsx.template +29 -0
  72. package/dist/commands/experimental/templates/rsc/entry.client.tsx.template +35 -0
  73. package/dist/commands/experimental/templates/rsc/entry.server.tsx.template +20 -0
  74. package/dist/commands/experimental/templates/rsc/index.css.template +4 -0
  75. package/dist/commands/experimental/templates/streamingSsr/Document.tsx.template +27 -0
  76. package/dist/commands/experimental/templates/streamingSsr/entry.client.tsx.template +40 -0
  77. package/dist/commands/experimental/templates/streamingSsr/entry.server.tsx.template +20 -0
  78. package/dist/commands/experimental/templates/streamingSsr/tsconfig.json.template +54 -0
  79. package/dist/commands/experimental/util.js +69 -0
  80. package/dist/commands/experimental.js +22 -0
  81. package/dist/commands/generate/cell/cell.js +35 -0
  82. package/dist/commands/generate/cell/cellHandler.js +153 -0
  83. package/dist/commands/generate/cell/templates/cell.tsx.template +34 -0
  84. package/dist/commands/generate/cell/templates/cellList.tsx.template +40 -0
  85. package/dist/commands/generate/cell/templates/mock.ts.template +7 -0
  86. package/dist/commands/generate/cell/templates/mockList.ts.template +14 -0
  87. package/dist/commands/generate/cell/templates/stories.tsx.template +35 -0
  88. package/dist/commands/generate/cell/templates/test.js.template +42 -0
  89. package/dist/commands/generate/cell/utils/utils.js +43 -0
  90. package/dist/commands/generate/component/component.js +15 -0
  91. package/dist/commands/generate/component/componentHandler.js +55 -0
  92. package/dist/commands/generate/component/templates/component.tsx.template +10 -0
  93. package/dist/commands/generate/component/templates/stories.jsx.template +17 -0
  94. package/dist/commands/generate/component/templates/stories.tsx.template +26 -0
  95. package/dist/commands/generate/component/templates/test.tsx.template +14 -0
  96. package/dist/commands/generate/dataMigration/dataMigration.js +105 -0
  97. package/dist/commands/generate/dataMigration/templates/dataMigration.js.template +7 -0
  98. package/dist/commands/generate/dataMigration/templates/dataMigration.ts.template +5 -0
  99. package/dist/commands/generate/dbAuth/dbAuth.js +55 -0
  100. package/dist/commands/generate/dbAuth/dbAuthHandler.js +375 -0
  101. package/dist/commands/generate/dbAuth/templates/forgotPassword.tsx.template +94 -0
  102. package/dist/commands/generate/dbAuth/templates/login.tsx.template +130 -0
  103. package/dist/commands/generate/dbAuth/templates/login.webAuthn.tsx.template +264 -0
  104. package/dist/commands/generate/dbAuth/templates/resetPassword.tsx.template +121 -0
  105. package/dist/commands/generate/dbAuth/templates/signup.tsx.template +123 -0
  106. package/dist/commands/generate/directive/directive.js +15 -0
  107. package/dist/commands/generate/directive/directiveHandler.js +159 -0
  108. package/dist/commands/generate/directive/templates/transformer.directive.test.ts.template +18 -0
  109. package/dist/commands/generate/directive/templates/transformer.directive.ts.template +38 -0
  110. package/dist/commands/generate/directive/templates/validator.directive.test.ts.template +17 -0
  111. package/dist/commands/generate/directive/templates/validator.directive.ts.template +39 -0
  112. package/dist/commands/generate/function/function.js +29 -0
  113. package/dist/commands/generate/function/functionHandler.js +131 -0
  114. package/dist/commands/generate/function/templates/function.ts.template +33 -0
  115. package/dist/commands/generate/function/templates/scenarios.ts.template +8 -0
  116. package/dist/commands/generate/function/templates/test.ts.template +30 -0
  117. package/dist/commands/generate/helpers.js +71 -0
  118. package/dist/commands/generate/job/job.js +39 -0
  119. package/dist/commands/generate/job/jobHandler.js +138 -0
  120. package/dist/commands/generate/job/templates/job.ts.template +8 -0
  121. package/dist/commands/generate/job/templates/scenarios.ts.template +8 -0
  122. package/dist/commands/generate/job/templates/test.ts.template +7 -0
  123. package/dist/commands/generate/layout/layout.js +25 -0
  124. package/dist/commands/generate/layout/layoutHandler.js +59 -0
  125. package/dist/commands/generate/layout/templates/layout.tsx.a11y.template +27 -0
  126. package/dist/commands/generate/layout/templates/layout.tsx.template +9 -0
  127. package/dist/commands/generate/layout/templates/stories.tsx.template +13 -0
  128. package/dist/commands/generate/layout/templates/test.tsx.template +14 -0
  129. package/dist/commands/generate/model/model.js +29 -0
  130. package/dist/commands/generate/model/modelHandler.js +63 -0
  131. package/dist/commands/generate/model/templates/model.js.template +3 -0
  132. package/dist/commands/generate/ogImage/ogImage.js +43 -0
  133. package/dist/commands/generate/ogImage/ogImageHandler.js +111 -0
  134. package/dist/commands/generate/ogImage/templates/ogImage.og.tsx.template +13 -0
  135. package/dist/commands/generate/page/page.js +22 -0
  136. package/dist/commands/generate/page/pageHandler.js +227 -0
  137. package/dist/commands/generate/page/templates/page.tsx.template +35 -0
  138. package/dist/commands/generate/page/templates/stories.tsx.parameters.template +13 -0
  139. package/dist/commands/generate/page/templates/stories.tsx.template +13 -0
  140. package/dist/commands/generate/page/templates/test.tsx.template +14 -0
  141. package/dist/commands/generate/realtime/realtime.js +41 -0
  142. package/dist/commands/generate/realtime/realtimeHandler.js +215 -0
  143. package/dist/commands/generate/realtime/templates/liveQueries/blank/blank.sdl.ts.template +27 -0
  144. package/dist/commands/generate/realtime/templates/liveQueries/blank/blank.service.ts.template +73 -0
  145. package/dist/commands/generate/realtime/templates/realtime.ts.template +42 -0
  146. package/dist/commands/generate/realtime/templates/subscriptions/blank/blank.sdl.ts.template +20 -0
  147. package/dist/commands/generate/realtime/templates/subscriptions/blank/blank.service.ts.template +19 -0
  148. package/dist/commands/generate/realtime/templates/subscriptions/blank/blank.ts.template +58 -0
  149. package/dist/commands/generate/scaffold/scaffold.js +38 -0
  150. package/dist/commands/generate/scaffold/scaffoldHandler.js +663 -0
  151. package/dist/commands/generate/scaffold/templates/assets/scaffold.css.template +398 -0
  152. package/dist/commands/generate/scaffold/templates/assets/scaffold.tailwind.css.template +243 -0
  153. package/dist/commands/generate/scaffold/templates/components/EditNameCell.tsx.template +74 -0
  154. package/dist/commands/generate/scaffold/templates/components/Name.tsx.template +79 -0
  155. package/dist/commands/generate/scaffold/templates/components/NameCell.tsx.template +32 -0
  156. package/dist/commands/generate/scaffold/templates/components/NameForm.tsx.template +123 -0
  157. package/dist/commands/generate/scaffold/templates/components/Names.tsx.template +88 -0
  158. package/dist/commands/generate/scaffold/templates/components/NamesCell.tsx.template +45 -0
  159. package/dist/commands/generate/scaffold/templates/components/NewName.tsx.template +55 -0
  160. package/dist/commands/generate/scaffold/templates/layouts/ScaffoldLayout.tsx.template +37 -0
  161. package/dist/commands/generate/scaffold/templates/lib/formatters.test.tsx.template +192 -0
  162. package/dist/commands/generate/scaffold/templates/lib/formatters.tsx.template +58 -0
  163. package/dist/commands/generate/scaffold/templates/pages/EditNamePage.tsx.template +11 -0
  164. package/dist/commands/generate/scaffold/templates/pages/NamePage.tsx.template +11 -0
  165. package/dist/commands/generate/scaffold/templates/pages/NamesPage.tsx.template +7 -0
  166. package/dist/commands/generate/scaffold/templates/pages/NewNamePage.tsx.template +7 -0
  167. package/dist/commands/generate/script/script.js +29 -0
  168. package/dist/commands/generate/script/scriptHandler.js +85 -0
  169. package/dist/commands/generate/script/templates/script.ts.template +15 -0
  170. package/dist/commands/generate/script/templates/tsconfig.json.template +33 -0
  171. package/dist/commands/generate/sdl/sdl.js +48 -0
  172. package/dist/commands/generate/sdl/sdlHandler.js +282 -0
  173. package/dist/commands/generate/sdl/templates/sdl.js.template +70 -0
  174. package/dist/commands/generate/sdl/templates/sdl.ts.template +70 -0
  175. package/dist/commands/generate/secret/secret.js +52 -0
  176. package/dist/commands/generate/service/service.js +50 -0
  177. package/dist/commands/generate/service/serviceHandler.js +301 -0
  178. package/dist/commands/generate/service/templates/scenarios.ts.template +7 -0
  179. package/dist/commands/generate/service/templates/service.ts.template +38 -0
  180. package/dist/commands/generate/service/templates/test.ts.template +84 -0
  181. package/dist/commands/generate/yargsCommandHelpers.js +77 -0
  182. package/dist/commands/generate/yargsHandlerHelpers.js +155 -0
  183. package/dist/commands/generate.js +44 -0
  184. package/dist/commands/info.js +36 -0
  185. package/dist/commands/jobs.js +17 -0
  186. package/dist/commands/jobsHandler.js +30 -0
  187. package/dist/commands/lint.js +57 -0
  188. package/dist/commands/prerender.js +34 -0
  189. package/dist/commands/prerenderHandler.js +282 -0
  190. package/dist/commands/prisma.js +17 -0
  191. package/dist/commands/prismaHandler.js +90 -0
  192. package/dist/commands/record/init.js +11 -0
  193. package/dist/commands/record.js +19 -0
  194. package/dist/commands/serve.js +139 -0
  195. package/dist/commands/serveApiHandler.js +15 -0
  196. package/dist/commands/serveBothHandler.js +95 -0
  197. package/dist/commands/serveWebHandler.js +17 -0
  198. package/dist/commands/setup/auth/auth.js +265 -0
  199. package/dist/commands/setup/cache/cache.js +37 -0
  200. package/dist/commands/setup/cache/cacheHandler.js +69 -0
  201. package/dist/commands/setup/cache/templates/memcached.ts.template +30 -0
  202. package/dist/commands/setup/cache/templates/redis.ts.template +24 -0
  203. package/dist/commands/setup/deploy/deploy.js +26 -0
  204. package/dist/commands/setup/deploy/helpers/helpers.js +9 -0
  205. package/dist/commands/setup/deploy/helpers/index.js +110 -0
  206. package/dist/commands/setup/deploy/providers/baremetal.js +9 -0
  207. package/dist/commands/setup/deploy/providers/baremetalHandler.js +64 -0
  208. package/dist/commands/setup/deploy/providers/coherence.js +24 -0
  209. package/dist/commands/setup/deploy/providers/coherenceHandler.js +203 -0
  210. package/dist/commands/setup/deploy/providers/flightcontrol.js +19 -0
  211. package/dist/commands/setup/deploy/providers/flightcontrolHandler.js +294 -0
  212. package/dist/commands/setup/deploy/providers/netlify.js +9 -0
  213. package/dist/commands/setup/deploy/providers/netlifyHandler.js +42 -0
  214. package/dist/commands/setup/deploy/providers/render.js +17 -0
  215. package/dist/commands/setup/deploy/providers/renderHandler.js +111 -0
  216. package/dist/commands/setup/deploy/providers/serverless.js +11 -0
  217. package/dist/commands/setup/deploy/providers/serverlessHandler.js +141 -0
  218. package/dist/commands/setup/deploy/providers/vercel.js +9 -0
  219. package/dist/commands/setup/deploy/providers/vercelHandler.js +56 -0
  220. package/dist/commands/setup/deploy/templates/baremetal.js +128 -0
  221. package/dist/commands/setup/deploy/templates/flightcontrol.js +85 -0
  222. package/dist/commands/setup/deploy/templates/netlify.js +32 -0
  223. package/dist/commands/setup/deploy/templates/render.js +72 -0
  224. package/dist/commands/setup/deploy/templates/serverless/api.js +78 -0
  225. package/dist/commands/setup/deploy/templates/serverless/web.js +32 -0
  226. package/dist/commands/setup/docker/docker.js +26 -0
  227. package/dist/commands/setup/docker/dockerHandler.js +265 -0
  228. package/dist/commands/setup/docker/templates/Dockerfile +154 -0
  229. package/dist/commands/setup/docker/templates/docker-compose.dev.yml +58 -0
  230. package/dist/commands/setup/docker/templates/docker-compose.prod.yml +63 -0
  231. package/dist/commands/setup/docker/templates/dockerignore +18 -0
  232. package/dist/commands/setup/generator/generator.js +49 -0
  233. package/dist/commands/setup/generator/generatorHandler.js +55 -0
  234. package/dist/commands/setup/graphql/features/fragments/appGqlConfigTransform.js +117 -0
  235. package/dist/commands/setup/graphql/features/fragments/appImportTransform.js +20 -0
  236. package/dist/commands/setup/graphql/features/fragments/fragments.js +25 -0
  237. package/dist/commands/setup/graphql/features/fragments/fragmentsHandler.js +89 -0
  238. package/dist/commands/setup/graphql/features/trustedDocuments/graphqlTransform.js +51 -0
  239. package/dist/commands/setup/graphql/features/trustedDocuments/trustedDocuments.js +25 -0
  240. package/dist/commands/setup/graphql/features/trustedDocuments/trustedDocumentsHandler.js +74 -0
  241. package/dist/commands/setup/graphql/graphql.js +18 -0
  242. package/dist/commands/setup/i18n/i18n.js +25 -0
  243. package/dist/commands/setup/i18n/i18nHandler.js +169 -0
  244. package/dist/commands/setup/i18n/templates/en.json.template +11 -0
  245. package/dist/commands/setup/i18n/templates/fr.json.template +11 -0
  246. package/dist/commands/setup/i18n/templates/i18n.js.template +52 -0
  247. package/dist/commands/setup/i18n/templates/storybook.preview.tsx.template +43 -0
  248. package/dist/commands/setup/jobs/jobs.js +31 -0
  249. package/dist/commands/setup/jobs/jobsHandler.js +122 -0
  250. package/dist/commands/setup/jobs/templates/jobs.ts.template +32 -0
  251. package/dist/commands/setup/mailer/mailer.js +30 -0
  252. package/dist/commands/setup/mailer/mailerHandler.js +106 -0
  253. package/dist/commands/setup/mailer/templates/mailer.ts.template +30 -0
  254. package/dist/commands/setup/mailer/templates/re-example.tsx.template +40 -0
  255. package/dist/commands/setup/middleware/middleware.js +17 -0
  256. package/dist/commands/setup/middleware/ogImage/__codemod_tests__/middleware.js +15 -0
  257. package/dist/commands/setup/middleware/ogImage/__codemod_tests__/vitePlugin.js +6 -0
  258. package/dist/commands/setup/middleware/ogImage/codemodMiddleware.js +97 -0
  259. package/dist/commands/setup/middleware/ogImage/codemodVitePlugin.js +65 -0
  260. package/dist/commands/setup/middleware/ogImage/ogImage.js +27 -0
  261. package/dist/commands/setup/middleware/ogImage/ogImageHandler.js +121 -0
  262. package/dist/commands/setup/monitoring/monitoring.js +17 -0
  263. package/dist/commands/setup/monitoring/sentry/sentry.js +25 -0
  264. package/dist/commands/setup/monitoring/sentry/sentryHandler.js +163 -0
  265. package/dist/commands/setup/monitoring/sentry/templates/sentryApi.ts.template +15 -0
  266. package/dist/commands/setup/monitoring/sentry/templates/sentryWeb.ts.template +31 -0
  267. package/dist/commands/setup/package/package.js +33 -0
  268. package/dist/commands/setup/package/packageHandler.js +134 -0
  269. package/dist/commands/setup/realtime/realtime.js +37 -0
  270. package/dist/commands/setup/realtime/realtimeHandler.js +309 -0
  271. package/dist/commands/setup/realtime/templates/defer/fastAndSlowFields/fastAndSlowFields.sdl.template +14 -0
  272. package/dist/commands/setup/realtime/templates/defer/fastAndSlowFields/fastAndSlowFields.ts.template +14 -0
  273. package/dist/commands/setup/realtime/templates/liveQueries/auctions/auctions.sdl.ts.template +27 -0
  274. package/dist/commands/setup/realtime/templates/liveQueries/auctions/auctions.ts.template +73 -0
  275. package/dist/commands/setup/realtime/templates/realtime.ts.template +46 -0
  276. package/dist/commands/setup/realtime/templates/stream/alphabet/alphabet.sdl.template +9 -0
  277. package/dist/commands/setup/realtime/templates/stream/alphabet/alphabet.ts.template +31 -0
  278. package/dist/commands/setup/realtime/templates/subscriptions/countdown/countdown.ts.template +58 -0
  279. package/dist/commands/setup/realtime/templates/subscriptions/newMessage/newMessage.ts.template +57 -0
  280. package/dist/commands/setup/realtime/templates/subscriptions/newMessage/rooms.sdl.ts.template +20 -0
  281. package/dist/commands/setup/realtime/templates/subscriptions/newMessage/rooms.ts.template +20 -0
  282. package/dist/commands/setup/server-file/serverFile.js +31 -0
  283. package/dist/commands/setup/server-file/serverFileHandler.js +56 -0
  284. package/dist/commands/setup/server-file/templates/server.ts.template +13 -0
  285. package/dist/commands/setup/tsconfig/tsconfig.js +25 -0
  286. package/dist/commands/setup/tsconfig/tsconfigHandler.js +59 -0
  287. package/dist/commands/setup/ui/helpers/helpers.js +9 -0
  288. package/dist/commands/setup/ui/libraries/chakra-ui.js +24 -0
  289. package/dist/commands/setup/ui/libraries/chakra-uiHandler.js +98 -0
  290. package/dist/commands/setup/ui/libraries/mantine.js +32 -0
  291. package/dist/commands/setup/ui/libraries/mantineHandler.js +138 -0
  292. package/dist/commands/setup/ui/libraries/tailwindcss.js +26 -0
  293. package/dist/commands/setup/ui/libraries/tailwindcssHandler.js +386 -0
  294. package/dist/commands/setup/ui/templates/chakra.storybook.preview.tsx.template +20 -0
  295. package/dist/commands/setup/ui/templates/mantine-postcss.config.js.template +35 -0
  296. package/dist/commands/setup/ui/templates/mantine.storybook.preview.tsx.template +18 -0
  297. package/dist/commands/setup/ui/templates/postcss.config.js.template +9 -0
  298. package/dist/commands/setup/ui/ui.js +17 -0
  299. package/dist/commands/setup/uploads/dbCodemod.js +28 -0
  300. package/dist/commands/setup/uploads/templates/signedUrl.ts.template +21 -0
  301. package/dist/commands/setup/uploads/templates/srcLibUploads.ts.template +25 -0
  302. package/dist/commands/setup/uploads/uploads.js +26 -0
  303. package/dist/commands/setup/uploads/uploadsHandler.js +147 -0
  304. package/dist/commands/setup/vite/templates/vite.config.ts.template +19 -0
  305. package/dist/commands/setup/vite/vite.js +38 -0
  306. package/dist/commands/setup/vite/viteHandler.js +83 -0
  307. package/dist/commands/setup.js +33 -0
  308. package/dist/commands/studio.js +23 -0
  309. package/dist/commands/studioHandler.js +61 -0
  310. package/dist/commands/test.js +44 -0
  311. package/dist/commands/testHandler.js +138 -0
  312. package/dist/commands/ts-to-js.js +20 -0
  313. package/dist/commands/type-check.js +41 -0
  314. package/dist/commands/type-checkHandler.js +71 -0
  315. package/dist/commands/upgrade.js +441 -0
  316. package/dist/index.d.js +0 -0
  317. package/dist/index.js +146 -0
  318. package/dist/lib/background.js +45 -0
  319. package/dist/lib/colors.js +18 -0
  320. package/dist/lib/configureStorybook.js +50 -0
  321. package/dist/lib/exec.js +85 -0
  322. package/dist/lib/exit.js +44 -0
  323. package/dist/lib/extendFile.js +114 -0
  324. package/dist/lib/generatePrismaClient.js +60 -0
  325. package/dist/lib/index.js +485 -0
  326. package/dist/lib/loadEnvFiles.js +12 -0
  327. package/dist/lib/locking.js +60 -0
  328. package/dist/lib/merge/algorithms.js +30 -0
  329. package/dist/lib/merge/index.js +163 -0
  330. package/dist/lib/merge/semanticIdentity.js +18 -0
  331. package/dist/lib/merge/strategy.js +136 -0
  332. package/dist/lib/mockTelemetry.js +7 -0
  333. package/dist/lib/packages.js +77 -0
  334. package/dist/lib/plugin.js +206 -0
  335. package/dist/lib/pluralHelpers.js +50 -0
  336. package/dist/lib/ports.js +17 -0
  337. package/dist/lib/project.js +30 -0
  338. package/dist/lib/rollback.js +72 -0
  339. package/dist/lib/runTransform.js +66 -0
  340. package/dist/lib/rwPluralize.js +56 -0
  341. package/dist/lib/schemaHelpers.js +95 -0
  342. package/dist/lib/templates/storybook.preview.tsx.template +19 -0
  343. package/dist/lib/test.js +106 -0
  344. package/dist/lib/updateCheck.js +202 -0
  345. package/dist/lib/updateCheckExecute.js +2 -0
  346. package/dist/middleware/checkNodeVersion.js +23 -0
  347. package/dist/middleware/detectProjectRxVersion.js +12 -0
  348. package/dist/plugin.js +223 -0
  349. package/dist/rwfw.js +47 -0
  350. package/dist/telemetry/exporter.js +63 -0
  351. package/dist/telemetry/index.js +84 -0
  352. package/dist/telemetry/resource.js +98 -0
  353. package/dist/telemetry/send.js +80 -0
  354. package/dist/testLib/cells.js +188 -0
  355. package/dist/testLib/fetchFileFromTemplate.js +9 -0
  356. package/dist/testLib/getFilesWithPattern.js +21 -0
  357. package/dist/testLib/getRootPackageJSON.js +14 -0
  358. package/dist/testLib/isTSProject.js +9 -0
  359. package/dist/testLib/runTransform.js +42 -0
  360. package/package.json +102 -0
@@ -0,0 +1,55 @@
1
+ import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api'
2
+ import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'
3
+ import { registerInstrumentations } from '@opentelemetry/instrumentation'
4
+ import { FastifyInstrumentation } from '@opentelemetry/instrumentation-fastify'
5
+ import { HttpInstrumentation } from '@opentelemetry/instrumentation-http'
6
+ import { Resource } from '@opentelemetry/resources'
7
+ import {
8
+ NodeTracerProvider,
9
+ SimpleSpanProcessor,
10
+ } from '@opentelemetry/sdk-trace-node'
11
+ import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'
12
+ import { PrismaInstrumentation } from '@prisma/instrumentation'
13
+
14
+ import { getConfig } from '@cedarjs/project-config'
15
+
16
+ // You may wish to set this to DiagLogLevel.DEBUG when you need to debug opentelemetry itself
17
+ diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.INFO)
18
+
19
+ const resource = Resource.default().merge(
20
+ new Resource({
21
+ [SemanticResourceAttributes.SERVICE_NAME]: 'redwood-app',
22
+ [SemanticResourceAttributes.SERVICE_VERSION]: '0.0.0',
23
+ })
24
+ )
25
+
26
+ const studioPort = getConfig().studio.basePort
27
+ const exporter = new OTLPTraceExporter({
28
+ // Update this URL to point to where your OTLP compatible collector is listening
29
+ // The redwood development studio (`yarn rw exp studio`) can collect your
30
+ // telemetry at `http://127.0.0.1:<PORT>/v1/traces` (default PORT is 4318)
31
+ url: `http://127.0.0.1:${studioPort}/.redwood/functions/otel-trace`,
32
+ concurrencyLimit: 64,
33
+ })
34
+
35
+ // You may wish to switch to BatchSpanProcessor in production as it is the recommended choice for performance reasons
36
+ const processor = new SimpleSpanProcessor(exporter)
37
+
38
+ const provider = new NodeTracerProvider({
39
+ resource: resource,
40
+ })
41
+ provider.addSpanProcessor(processor)
42
+
43
+ // Optionally register instrumentation libraries here
44
+ registerInstrumentations({
45
+ tracerProvider: provider,
46
+ instrumentations: [
47
+ new HttpInstrumentation(),
48
+ new FastifyInstrumentation(),
49
+ new PrismaInstrumentation({
50
+ middleware: true,
51
+ }),
52
+ ],
53
+ })
54
+
55
+ provider.register()
@@ -0,0 +1,20 @@
1
+ 'use client'
2
+
3
+ import React from 'react'
4
+
5
+ // @ts-expect-error no types
6
+ import styles from './Counter.module.css'
7
+ import './Counter.css'
8
+
9
+ export const AboutCounter = () => {
10
+ const [count, setCount] = React.useState(0)
11
+
12
+ return (
13
+ <div style={{ border: '3px blue dashed', margin: '1em', padding: '1em' }}>
14
+ <p>Count: {count}</p>
15
+ <button onClick={() => setCount((c) => c + 1)}>Increment</button>
16
+ <h3 className={styles.header}>This is a client component.</h3>
17
+ <p>RSC on client: {globalThis.RWJS_EXP_RSC ? 'enabled' : 'disabled'}</p>
18
+ </div>
19
+ )
20
+ }
@@ -0,0 +1,17 @@
1
+ import { AboutCounter } from 'src/components/Counter/AboutCounter'
2
+
3
+ import './AboutPage.css'
4
+
5
+ const AboutPage = () => {
6
+ return (
7
+ <div className="about-page">
8
+ <div style={{ border: '3px red dashed', margin: '1em', padding: '1em' }}>
9
+ <h1>About Redwood</h1>
10
+ <AboutCounter />
11
+ <p>RSC on server: {globalThis.RWJS_EXP_RSC ? 'enabled' : 'disabled'}</p>
12
+ </div>
13
+ </div>
14
+ )
15
+ }
16
+
17
+ export default AboutPage
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This should affect all h3 elements on the page, both server components and
3
+ * client components. This is just standard CSS stuff
4
+ */
5
+ h3 {
6
+ color: orange;
7
+ }
@@ -0,0 +1,3 @@
1
+ .header {
2
+ font-style: italic;
3
+ }
@@ -0,0 +1,18 @@
1
+ 'use client'
2
+
3
+ import React from 'react'
4
+
5
+ import styles from './Counter.module.css'
6
+ import './Counter.css'
7
+
8
+ export const Counter = () => {
9
+ const [count, setCount] = React.useState(0)
10
+
11
+ return (
12
+ <div style={{ border: '3px blue dashed', margin: '1em', padding: '1em' }}>
13
+ <p>Count: {count}</p>
14
+ <button onClick={() => setCount((c) => c + 1)}>Increment</button>
15
+ <h3 className={styles.header}>This is a client component.</h3>
16
+ </div>
17
+ )
18
+ }
@@ -0,0 +1,27 @@
1
+ import React from 'react'
2
+
3
+ import { Css, Meta } from '@cedarjs/web/htmlTags'
4
+ import type { TagDescriptor } from '@cedarjs/web/htmlTags'
5
+
6
+ interface DocumentProps {
7
+ children: React.ReactNode
8
+ css: string[] // array of css import strings
9
+ meta?: TagDescriptor[]
10
+ }
11
+
12
+ export const Document: React.FC<DocumentProps> = ({ children, css, meta }) => {
13
+ return (
14
+ <html lang="en">
15
+ <head>
16
+ <meta charSet="utf-8" />
17
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
18
+ <link rel="icon" type="image/png" href="/favicon.png" />
19
+ <Css css={css} />
20
+ <Meta tags={meta} />
21
+ </head>
22
+ <body>
23
+ <div id="redwood-app">{children}</div>
24
+ </body>
25
+ </html>
26
+ )
27
+ }
@@ -0,0 +1,3 @@
1
+ .title {
2
+ color: green;
3
+ }
@@ -0,0 +1,19 @@
1
+ import { Counter } from 'src/components/Counter/Counter'
2
+
3
+ import styles from './HomePage.module.css'
4
+
5
+ import './HomePage.css'
6
+
7
+ const HomePage = ({ name = 'Anonymous' }) => {
8
+ return (
9
+ <div className="home-page">
10
+ <div style={{ border: '3px red dashed', margin: '1em', padding: '1em' }}>
11
+ <h1 className={styles.title}>Hello {name}!!</h1>
12
+ <h3>This is a server component.</h3>
13
+ <Counter />
14
+ </div>
15
+ </div>
16
+ )
17
+ }
18
+
19
+ export default HomePage
@@ -0,0 +1,32 @@
1
+ .navigation-layout {
2
+ & nav {
3
+ display: flex;
4
+ justify-content: space-between;
5
+ align-items: center;
6
+ padding: 10px;
7
+ background-color: color-mix(in srgb, yellow 50%, transparent);
8
+ border-bottom: 2px dashed color-mix(in srgb, yellow 90%, black);
9
+ }
10
+
11
+ & ul {
12
+ list-style: none;
13
+ display: flex;
14
+ margin: 0;
15
+ padding: 0;
16
+ }
17
+
18
+ & li {
19
+ margin-right: 10px;
20
+ }
21
+
22
+ & a {
23
+ text-decoration: none;
24
+ color: #333;
25
+ padding: 5px;
26
+ border-bottom: 2px solid transparent;
27
+ }
28
+
29
+ & a:hover {
30
+ border-bottom: 2px solid #333;
31
+ }
32
+ }
@@ -0,0 +1,31 @@
1
+ import { namedRoutes as routes } from '@cedarjs/router/dist/namedRoutes'
2
+
3
+ import './NavigationLayout.css'
4
+
5
+ const Link = (props: any) => {
6
+ return <a href={props.to}>{props.children}</a>
7
+ }
8
+
9
+ type NavigationLayoutProps = {
10
+ children?: React.ReactNode
11
+ }
12
+
13
+ const NavigationLayout = ({ children }: NavigationLayoutProps) => {
14
+ return (
15
+ <div className="navigation-layout">
16
+ <nav>
17
+ <ul>
18
+ <li>
19
+ <Link to={routes.home()}>Home</Link>
20
+ </li>
21
+ <li>
22
+ <Link to={routes.about()}>About</Link>
23
+ </li>
24
+ </ul>
25
+ </nav>
26
+ <main>{children}</main>
27
+ </div>
28
+ )
29
+ }
30
+
31
+ export default NavigationLayout
@@ -0,0 +1,29 @@
1
+ // In this file, all Page components from 'src/pages` are auto-imported. Nested
2
+ // directories are supported, and should be uppercase. Each subdirectory will be
3
+ // prepended onto the component name.
4
+ //
5
+ // Examples:
6
+ //
7
+ // 'src/pages/HomePage/HomePage.js' -> HomePage
8
+ // 'src/pages/Admin/BooksPage/BooksPage.js' -> AdminBooksPage
9
+
10
+ import { Route } from '@cedarjs/router/Route'
11
+ import { Router } from '@cedarjs/router/RscRouter'
12
+ import { Set } from '@cedarjs/router/Set'
13
+
14
+ import NavigationLayout from 'src/layouts/NavigationLayout'
15
+ import NotFoundPage from 'src/pages/NotFoundPage'
16
+
17
+ const Routes = () => {
18
+ return (
19
+ <Router>
20
+ <Set wrap={NavigationLayout}>
21
+ <Route path="/" page={HomePage} name="home" />
22
+ <Route path="/about" page={AboutPage} name="about" />
23
+ </Set>
24
+ <Route notfound page={NotFoundPage} />
25
+ </Router>
26
+ )
27
+ }
28
+
29
+ export default Routes
@@ -0,0 +1,35 @@
1
+ import { hydrateRoot, createRoot } from 'react-dom/client'
2
+
3
+ import App from './App'
4
+ import Routes from './Routes'
5
+
6
+ /**
7
+ * When `#redwood-app` isn't empty then it's very likely that you're using
8
+ * pre-rendering. So React attaches event listeners to the existing markup
9
+ * rather than replacing it.
10
+ * https://react.dev/reference/react-dom/client/hydrateRoot
11
+ */
12
+ const redwoodAppElement = document.getElementById('redwood-app')
13
+
14
+ if (!redwoodAppElement) {
15
+ throw new Error(
16
+ "Could not find an element with ID 'redwood-app'. Please ensure it " +
17
+ "exists in your 'web/src/index.html' file."
18
+ )
19
+ }
20
+
21
+ if (redwoodAppElement.children?.length > 0) {
22
+ hydrateRoot(
23
+ redwoodAppElement,
24
+ <App>
25
+ <Routes />
26
+ </App>
27
+ )
28
+ } else {
29
+ const root = createRoot(redwoodAppElement)
30
+ root.render(
31
+ <App>
32
+ <Routes />
33
+ </App>
34
+ )
35
+ }
@@ -0,0 +1,20 @@
1
+ import type { TagDescriptor } from '@cedarjs/web/htmlTags'
2
+
3
+ import App from './App'
4
+ import { Document } from './Document'
5
+ import Routes from './Routes'
6
+
7
+ interface Props {
8
+ css: string[]
9
+ meta?: TagDescriptor[]
10
+ }
11
+
12
+ export const ServerEntry: React.FC<Props> = ({ css, meta }) => {
13
+ return (
14
+ <Document css={css} meta={meta}>
15
+ <App>
16
+ <Routes />
17
+ </App>
18
+ </Document>
19
+ )
20
+ }
@@ -0,0 +1,4 @@
1
+ html, body {
2
+ margin: 0;
3
+ padding: 0;
4
+ }
@@ -0,0 +1,27 @@
1
+ import React from 'react'
2
+
3
+ import { Css, Meta } from '@cedarjs/web/htmlTags'
4
+ import type { TagDescriptor } from '@cedarjs/web/htmlTags'
5
+
6
+ interface DocumentProps {
7
+ children: React.ReactNode
8
+ css: string[] // array of css import strings
9
+ meta?: TagDescriptor[]
10
+ }
11
+
12
+ export const Document: React.FC<DocumentProps> = ({ children, css, meta }) => {
13
+ return (
14
+ <html lang="en">
15
+ <head>
16
+ <meta charSet="utf-8" />
17
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
18
+ <link rel="icon" type="image/png" href="/favicon.png" />
19
+ <Css css={css} />
20
+ <Meta tags={meta} />
21
+ </head>
22
+ <body>
23
+ <div id="redwood-app">{children}</div>
24
+ </body>
25
+ </html>
26
+ )
27
+ }
@@ -0,0 +1,40 @@
1
+ import { hydrateRoot, createRoot } from 'react-dom/client'
2
+
3
+ import App from './App'
4
+ import { Document } from './Document'
5
+ import Routes from './Routes'
6
+
7
+ /**
8
+ * When `#redwood-app` isn't empty then it's very likely that you're using
9
+ * prerendering. So React attaches event listeners to the existing markup
10
+ * rather than replacing it.
11
+ * https://react.dev/reference/react-dom/client/hydrateRoot
12
+ */
13
+ const redwoodAppElement = document.getElementById('redwood-app')
14
+
15
+ if (!redwoodAppElement) {
16
+ throw new Error(
17
+ "Could not find an element with ID 'redwood-app'. Please ensure it " +
18
+ "exists in your 'web/src/index.html' file."
19
+ )
20
+ }
21
+
22
+ if (redwoodAppElement.children?.length > 0) {
23
+ hydrateRoot(
24
+ document,
25
+ <Document css={window.__assetMap?.()?.css}>
26
+ <App>
27
+ <Routes />
28
+ </App>
29
+ </Document>
30
+ )
31
+ } else {
32
+ const root = createRoot(document)
33
+ root.render(
34
+ <Document css={window.__assetMap?.()?.css}>
35
+ <App>
36
+ <Routes />
37
+ </App>
38
+ </Document>
39
+ )
40
+ }
@@ -0,0 +1,20 @@
1
+ import type { TagDescriptor } from '@cedarjs/web'
2
+
3
+ import App from './App'
4
+ import { Document } from './Document'
5
+ import Routes from './Routes'
6
+
7
+ interface Props {
8
+ css: string[]
9
+ meta?: TagDescriptor[]
10
+ }
11
+
12
+ export const ServerEntry: React.FC<Props> = ({ css, meta }) => {
13
+ return (
14
+ <Document css={css} meta={meta}>
15
+ <App>
16
+ <Routes />
17
+ </App>
18
+ </Document>
19
+ )
20
+ }
@@ -0,0 +1,54 @@
1
+ {
2
+ "compilerOptions": {
3
+ "noEmit": true,
4
+ "allowJs": true,
5
+ "esModuleInterop": true,
6
+ "target": "esnext",
7
+ "module": "NodeNext",
8
+ "moduleResolution": "NodeNext",
9
+ "skipLibCheck": false,
10
+ "rootDirs": [
11
+ "./src",
12
+ "../.redwood/types/mirror/web/src",
13
+ "../api/src",
14
+ "../.redwood/types/mirror/api/src"
15
+ ],
16
+ "paths": {
17
+ "src/*": [
18
+ "./src/*",
19
+ "../.redwood/types/mirror/web/src/*",
20
+ "../api/src/*",
21
+ "../.redwood/types/mirror/api/src/*"
22
+ ],
23
+ "$api/*": [
24
+ "../api/*"
25
+ ],
26
+ "types/*": [
27
+ "./types/*",
28
+ "../types/*"
29
+ ],
30
+ "@cedarjs/testing": [
31
+ "../node_modules/@cedarjs/testing/web"
32
+ ]
33
+ },
34
+ "typeRoots": [
35
+ "../node_modules/@types",
36
+ "./node_modules/@types",
37
+ "../node_modules/@testing-library"
38
+ ],
39
+ "types": [
40
+ "jest",
41
+ "jest-dom",
42
+ "react/experimental"
43
+ ],
44
+ "jsx": "preserve"
45
+ },
46
+ "include": [
47
+ "src",
48
+ "config",
49
+ "../.redwood/types/includes/all-*",
50
+ "../.redwood/types/includes/web-*",
51
+ "../types",
52
+ "./types"
53
+ ]
54
+ }
@@ -0,0 +1,69 @@
1
+ import path from "path";
2
+ import chalk from "chalk";
3
+ import fs from "fs-extra";
4
+ import terminalLink from "terminal-link";
5
+ import { getPaths } from "../../lib/index.js";
6
+ import { isTypeScriptProject, serverFileExists } from "../../lib/project.js";
7
+ const link = (topicId, isTerminal = false) => {
8
+ const communityLink = `https://community.redwoodjs.com/t/${topicId}`;
9
+ if (isTerminal) {
10
+ return terminalLink(communityLink, communityLink);
11
+ } else {
12
+ return communityLink;
13
+ }
14
+ };
15
+ const getEpilogue = (command, description, topicId, isTerminal = false) => `This is an experimental feature to: ${description}.
16
+
17
+ Please find documentation and links to provide feedback for ${command} at:
18
+ -> ${link(
19
+ topicId,
20
+ isTerminal
21
+ )}`;
22
+ const printTaskEpilogue = (command, description, topicId) => {
23
+ console.log(
24
+ `${chalk.hex("#ff845e")(
25
+ `------------------------------------------------------------------
26
+ \u{1F9EA} ${chalk.green(
27
+ "Experimental Feature"
28
+ )} \u{1F9EA}
29
+ ------------------------------------------------------------------`
30
+ )}`
31
+ );
32
+ console.log(getEpilogue(command, description, topicId, false));
33
+ console.log(
34
+ `${chalk.hex("#ff845e")(
35
+ "------------------------------------------------------------------"
36
+ )}
37
+ `
38
+ );
39
+ };
40
+ const isServerFileSetup = () => {
41
+ if (!serverFileExists()) {
42
+ throw new Error(
43
+ "RedwoodJS Realtime requires a serverful environment. Please run `yarn rw setup server-file` first."
44
+ );
45
+ }
46
+ return true;
47
+ };
48
+ const realtimeExists = () => {
49
+ const realtimePath = path.join(
50
+ getPaths().api.lib,
51
+ `realtime.${isTypeScriptProject() ? "ts" : "js"}`
52
+ );
53
+ return fs.existsSync(realtimePath);
54
+ };
55
+ const isRealtimeSetup = () => {
56
+ if (!realtimeExists) {
57
+ throw new Error(
58
+ "Adding realtime events requires that RedwoodJS Realtime be setup. Please run `yarn setup realtime` first."
59
+ );
60
+ }
61
+ return true;
62
+ };
63
+ export {
64
+ getEpilogue,
65
+ isRealtimeSetup,
66
+ isServerFileSetup,
67
+ printTaskEpilogue,
68
+ realtimeExists
69
+ };
@@ -0,0 +1,22 @@
1
+ import terminalLink from "terminal-link";
2
+ import detectRxVersion from "../middleware/detectProjectRxVersion.js";
3
+ import * as experimentalInngest from "./experimental/setupInngest.js";
4
+ import * as experimentalOpenTelemetry from "./experimental/setupOpentelemetry.js";
5
+ import * as experimentalReactCompiler from "./experimental/setupReactCompiler.js";
6
+ import * as experimentalRsc from "./experimental/setupRsc.js";
7
+ import * as experimentalStreamingSsr from "./experimental/setupStreamingSsr.js";
8
+ const command = "experimental <command>";
9
+ const aliases = ["exp"];
10
+ const description = "Run or setup experimental features";
11
+ const builder = (yargs) => yargs.command(experimentalInngest).command(experimentalOpenTelemetry).command(experimentalReactCompiler).command(experimentalRsc).command(experimentalStreamingSsr).demandCommand().middleware(detectRxVersion).epilogue(
12
+ `Also see the ${terminalLink(
13
+ "Redwood CLI Reference",
14
+ "https://redwoodjs.com/docs/cli-commands#experimental"
15
+ )}`
16
+ );
17
+ export {
18
+ aliases,
19
+ builder,
20
+ command,
21
+ description
22
+ };
@@ -0,0 +1,35 @@
1
+ import {
2
+ createCommand,
3
+ createDescription,
4
+ createBuilder,
5
+ getYargsDefaults,
6
+ createHandler
7
+ } from "../yargsCommandHelpers.js";
8
+ const command = createCommand("cell");
9
+ const description = createDescription("cell");
10
+ const builder = createBuilder({
11
+ componentName: "cell",
12
+ optionsObj: () => {
13
+ return {
14
+ ...getYargsDefaults(),
15
+ list: {
16
+ alias: "l",
17
+ default: false,
18
+ description: "Use when you want to generate a cell for a list of the model name.",
19
+ type: "boolean"
20
+ },
21
+ query: {
22
+ default: "",
23
+ description: "Use to enforce a specific query name within the generated cell - must be unique.",
24
+ type: "string"
25
+ }
26
+ };
27
+ }
28
+ });
29
+ const handler = createHandler("cell");
30
+ export {
31
+ builder,
32
+ command,
33
+ description,
34
+ handler
35
+ };