@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,264 @@
1
+ import { useEffect, useRef, useState } from 'react'
2
+
3
+ import {
4
+ Form,
5
+ Label,
6
+ TextField,
7
+ PasswordField,
8
+ Submit,
9
+ FieldError,
10
+ } from '@cedarjs/forms'
11
+ import { Link, navigate, routes } from '@cedarjs/router'
12
+ import { Metadata } from '@cedarjs/web'
13
+ import { toast, Toaster } from '@cedarjs/web/toast'
14
+
15
+ import { useAuth } from 'src/auth'
16
+
17
+ const WELCOME_MESSAGE = 'Welcome back!'
18
+ const REDIRECT = routes.home()
19
+
20
+ const LoginPage = ({ type }) => {
21
+ const {
22
+ isAuthenticated,
23
+ client: webAuthn,
24
+ loading,
25
+ logIn,
26
+ reauthenticate,
27
+ } = useAuth()
28
+ const [shouldShowWebAuthn, setShouldShowWebAuthn] = useState(false)
29
+ const [showWebAuthn, setShowWebAuthn] = useState(
30
+ webAuthn.isEnabled() && type !== 'password'
31
+ )
32
+
33
+ // should redirect right after login or wait to show the webAuthn prompts?
34
+ useEffect(() => {
35
+ if (isAuthenticated && (!shouldShowWebAuthn || webAuthn.isEnabled())) {
36
+ navigate(REDIRECT)
37
+ }
38
+ }, [isAuthenticated, shouldShowWebAuthn])
39
+
40
+ // if WebAuthn is enabled, show the prompt as soon as the page loads
41
+ useEffect(() => {
42
+ if (!loading && !isAuthenticated && showWebAuthn) {
43
+ onAuthenticate()
44
+ }
45
+ }, [loading, isAuthenticated])
46
+
47
+ // focus on the ${usernameLowerCase} field as soon as the page loads
48
+ const ${usernameCamelCase}Ref = useRef()
49
+ useEffect(() => {
50
+ ${usernameCamelCase}Ref.current && ${usernameCamelCase}Ref.current.focus()
51
+ }, [])
52
+
53
+ const onSubmit = async (data) => {
54
+ const webAuthnSupported = await webAuthn.isSupported()
55
+
56
+ if (webAuthnSupported) {
57
+ setShouldShowWebAuthn(true)
58
+ }
59
+ const response = await logIn({ username: data.${usernameCamelCase}, password: data.${passwordCamelCase} })
60
+
61
+ if (response.message) {
62
+ // auth details good, but user not logged in
63
+ toast(response.message)
64
+ } else if (response.error) {
65
+ // error while authenticating
66
+ toast.error(response.error)
67
+ } else {
68
+ // user logged in
69
+ if (webAuthnSupported) {
70
+ setShowWebAuthn(true)
71
+ } else {
72
+ toast.success(WELCOME_MESSAGE)
73
+ }
74
+ }
75
+ }
76
+
77
+ const onAuthenticate = async () => {
78
+ try {
79
+ await webAuthn.authenticate()
80
+ await reauthenticate()
81
+ toast.success(WELCOME_MESSAGE)
82
+ navigate(REDIRECT)
83
+ } catch (e) {
84
+ if (e.name === 'WebAuthnDeviceNotFoundError') {
85
+ toast.error(
86
+ 'Device not found, log in with ${usernameTitleCase}/${passwordTitleCase} to continue'
87
+ )
88
+ setShowWebAuthn(false)
89
+ } else {
90
+ toast.error(e.message)
91
+ }
92
+ }
93
+ }
94
+
95
+ const onRegister = async () => {
96
+ try {
97
+ await webAuthn.register()
98
+ toast.success(WELCOME_MESSAGE)
99
+ navigate(REDIRECT)
100
+ } catch (e) {
101
+ toast.error(e.message)
102
+ }
103
+ }
104
+
105
+ const onSkip = () => {
106
+ toast.success(WELCOME_MESSAGE)
107
+ setShouldShowWebAuthn(false)
108
+ }
109
+
110
+ const AuthWebAuthnPrompt = () => {
111
+ return (
112
+ <div className="rw-webauthn-wrapper">
113
+ <h2>WebAuthn Login Enabled</h2>
114
+ <p>Log in with your fingerprint, face or PIN</p>
115
+ <div className="rw-button-group">
116
+ <button className="rw-button rw-button-blue" onClick={onAuthenticate}>
117
+ Open Authenticator
118
+ </button>
119
+ </div>
120
+ </div>
121
+ )
122
+ }
123
+
124
+ const RegisterWebAuthnPrompt = () => (
125
+ <div className="rw-webauthn-wrapper">
126
+ <h2>No more ${passwordTitleCase}s!</h2>
127
+ <p>
128
+ Depending on your device you can log in with your fingerprint, face or
129
+ PIN next time.
130
+ </p>
131
+ <div className="rw-button-group">
132
+ <button className="rw-button rw-button-blue" onClick={onRegister}>
133
+ Turn On
134
+ </button>
135
+ <button className="rw-button" onClick={onSkip}>
136
+ Skip for now
137
+ </button>
138
+ </div>
139
+ </div>
140
+ )
141
+
142
+ const PasswordForm = () => (
143
+ <Form onSubmit={onSubmit} className="rw-form-wrapper">
144
+ <Label
145
+ name="${usernameCamelCase}"
146
+ className="rw-label"
147
+ errorClassName="rw-label rw-label-error"
148
+ >
149
+ ${usernameTitleCase}
150
+ </Label>
151
+ <TextField
152
+ name="${usernameCamelCase}"
153
+ className="rw-input"
154
+ errorClassName="rw-input rw-input-error"
155
+ ref={${usernameCamelCase}Ref}
156
+ autoFocus
157
+ validation={{
158
+ required: {
159
+ value: true,
160
+ message: '${usernameTitleCase} is required',
161
+ },
162
+ }}
163
+ />
164
+
165
+ <FieldError name="${usernameCamelCase}" className="rw-field-error" />
166
+
167
+ <Label
168
+ name="${passwordCamelCase}"
169
+ className="rw-label"
170
+ errorClassName="rw-label rw-label-error"
171
+ >
172
+ ${passwordTitleCase}
173
+ </Label>
174
+ <PasswordField
175
+ name="${passwordCamelCase}"
176
+ className="rw-input"
177
+ errorClassName="rw-input rw-input-error"
178
+ autoComplete="current-password"
179
+ validation={{
180
+ required: {
181
+ value: true,
182
+ message: '${passwordTitleCase} is required',
183
+ },
184
+ }}
185
+ />
186
+
187
+ <div className="rw-forgot-link">
188
+ <Link to={routes.forgotPassword()} className="rw-forgot-link">
189
+ Forgot ${passwordTitleCase}?
190
+ </Link>
191
+ </div>
192
+
193
+ <FieldError name="${passwordCamelCase}" className="rw-field-error" />
194
+
195
+ <div className="rw-button-group">
196
+ <Submit className="rw-button rw-button-blue">Login</Submit>
197
+ </div>
198
+ </Form>
199
+ )
200
+
201
+ const formToRender = () => {
202
+ if (showWebAuthn) {
203
+ if (webAuthn.isEnabled()) {
204
+ return <AuthWebAuthnPrompt />
205
+ } else {
206
+ return <RegisterWebAuthnPrompt />
207
+ }
208
+ } else {
209
+ return <PasswordForm />
210
+ }
211
+ }
212
+
213
+ const linkToRender = () => {
214
+ if (showWebAuthn) {
215
+ if (webAuthn.isEnabled()) {
216
+ return (
217
+ <div className="rw-login-link">
218
+ <span>or login with </span>{' '}
219
+ <a href="?type=password" className="rw-link">
220
+ ${usernameLowerCase} and ${passwordLowerCase}
221
+ </a>
222
+ </div>
223
+ )
224
+ }
225
+ } else {
226
+ return (
227
+ <div className="rw-login-link">
228
+ <span>Don&apos;t have an account?</span>{' '}
229
+ <Link to={routes.signup()} className="rw-link">
230
+ Sign up!
231
+ </Link>
232
+ </div>
233
+ )
234
+ }
235
+ }
236
+
237
+ if (loading) {
238
+ return null
239
+ }
240
+
241
+ return (
242
+ <>
243
+ <Metadata title="Login" />
244
+
245
+ <main className="rw-main">
246
+ <Toaster toastOptions={{ className: 'rw-toast', duration: 6000 }} />
247
+ <div className="rw-scaffold rw-login-container">
248
+ <div className="rw-segment">
249
+ <header className="rw-segment-header">
250
+ <h2 className="rw-heading rw-heading-secondary">Login</h2>
251
+ </header>
252
+
253
+ <div className="rw-segment-main">
254
+ <div className="rw-form-wrapper">{formToRender()}</div>
255
+ </div>
256
+ </div>
257
+ {linkToRender()}
258
+ </div>
259
+ </main>
260
+ </>
261
+ )
262
+ }
263
+
264
+ export default LoginPage
@@ -0,0 +1,121 @@
1
+ import { useEffect, useRef, useState } from 'react'
2
+
3
+ import {
4
+ Form,
5
+ Label,
6
+ PasswordField,
7
+ Submit,
8
+ FieldError,
9
+ } from '@cedarjs/forms'
10
+ import { navigate, routes } from '@cedarjs/router'
11
+ import { Metadata } from '@cedarjs/web'
12
+ import { toast, Toaster } from '@cedarjs/web/toast'
13
+
14
+ import { useAuth } from 'src/auth'
15
+
16
+ const ResetPasswordPage = ({ resetToken }: { resetToken: string }) => {
17
+ const { isAuthenticated, reauthenticate, validateResetToken, resetPassword } =
18
+ useAuth()
19
+ const [enabled, setEnabled] = useState(true)
20
+
21
+ useEffect(() => {
22
+ if (isAuthenticated) {
23
+ navigate(routes.home())
24
+ }
25
+ }, [isAuthenticated])
26
+
27
+ useEffect(() => {
28
+ const validateToken = async () => {
29
+ const response = await validateResetToken(resetToken)
30
+ if (response.error) {
31
+ setEnabled(false)
32
+ toast.error(response.error)
33
+ } else {
34
+ setEnabled(true)
35
+ }
36
+ }
37
+ validateToken()
38
+ }, [resetToken, validateResetToken])
39
+
40
+ const ${passwordCamelCase}Ref = useRef<HTMLInputElement>(null)
41
+ useEffect(() => {
42
+ ${passwordCamelCase}Ref.current?.focus()
43
+ }, [])
44
+
45
+ const onSubmit = async (data: Record<string, string>) => {
46
+ const response = await resetPassword({
47
+ resetToken,
48
+ password: data.${passwordCamelCase},
49
+ })
50
+
51
+ if (response.error) {
52
+ toast.error(response.error)
53
+ } else {
54
+ toast.success('${passwordTitleCase} changed!')
55
+ await reauthenticate()
56
+ navigate(routes.login())
57
+ }
58
+ }
59
+
60
+ return (
61
+ <>
62
+ <Metadata title="Reset ${passwordTitleCase}" />
63
+
64
+ <main className="rw-main">
65
+ <Toaster toastOptions={{ className: 'rw-toast', duration: 6000 }} />
66
+ <div className="rw-scaffold rw-login-container">
67
+ <div className="rw-segment">
68
+ <header className="rw-segment-header">
69
+ <h2 className="rw-heading rw-heading-secondary">
70
+ Reset ${passwordTitleCase}
71
+ </h2>
72
+ </header>
73
+
74
+ <div className="rw-segment-main">
75
+ <div className="rw-form-wrapper">
76
+ <Form onSubmit={onSubmit} className="rw-form-wrapper">
77
+ <div className="text-left">
78
+ <Label
79
+ name="${passwordCamelCase}"
80
+ className="rw-label"
81
+ errorClassName="rw-label rw-label-error"
82
+ >
83
+ New ${passwordTitleCase}
84
+ </Label>
85
+ <PasswordField
86
+ name="${passwordCamelCase}"
87
+ autoComplete="new-password"
88
+ className="rw-input"
89
+ errorClassName="rw-input rw-input-error"
90
+ disabled={!enabled}
91
+ ref={${passwordCamelCase}Ref}
92
+ validation={{
93
+ required: {
94
+ value: true,
95
+ message: 'New ${passwordTitleCase} is required',
96
+ },
97
+ }}
98
+ />
99
+
100
+ <FieldError name="${passwordCamelCase}" className="rw-field-error" />
101
+ </div>
102
+
103
+ <div className="rw-button-group">
104
+ <Submit
105
+ className="rw-button rw-button-blue"
106
+ disabled={!enabled}
107
+ >
108
+ Submit
109
+ </Submit>
110
+ </div>
111
+ </Form>
112
+ </div>
113
+ </div>
114
+ </div>
115
+ </div>
116
+ </main>
117
+ </>
118
+ )
119
+ }
120
+
121
+ export default ResetPasswordPage
@@ -0,0 +1,123 @@
1
+ import { useEffect, useRef } from 'react'
2
+
3
+ import {
4
+ Form,
5
+ Label,
6
+ TextField,
7
+ PasswordField,
8
+ FieldError,
9
+ Submit,
10
+ } from '@cedarjs/forms'
11
+ import { Link, navigate, routes } from '@cedarjs/router'
12
+ import { Metadata } from '@cedarjs/web'
13
+ import { toast, Toaster } from '@cedarjs/web/toast'
14
+
15
+ import { useAuth } from 'src/auth'
16
+
17
+ const SignupPage = () => {
18
+ const { isAuthenticated, signUp } = useAuth()
19
+
20
+ useEffect(() => {
21
+ if (isAuthenticated) {
22
+ navigate(routes.home())
23
+ }
24
+ }, [isAuthenticated])
25
+
26
+ // focus on ${usernameLowerCase} box on page load
27
+ const ${usernameCamelCase}Ref = useRef<HTMLInputElement>(null)
28
+ useEffect(() => {
29
+ ${usernameCamelCase}Ref.current?.focus()
30
+ }, [])
31
+
32
+ const onSubmit = async (data: Record<string, string>) => {
33
+ const response = await signUp({ username: data.${usernameCamelCase}, password: data.${passwordCamelCase} })
34
+
35
+ if (response.message) {
36
+ toast(response.message)
37
+ } else if (response.error) {
38
+ toast.error(response.error)
39
+ } else {
40
+ // user is signed in automatically
41
+ toast.success('Welcome!')
42
+ }
43
+ }
44
+
45
+ return (
46
+ <>
47
+ <Metadata title="Signup" />
48
+
49
+ <main className="rw-main">
50
+ <Toaster toastOptions={{ className: 'rw-toast', duration: 6000 }} />
51
+ <div className="rw-scaffold rw-login-container">
52
+ <div className="rw-segment">
53
+ <header className="rw-segment-header">
54
+ <h2 className="rw-heading rw-heading-secondary">Signup</h2>
55
+ </header>
56
+
57
+ <div className="rw-segment-main">
58
+ <div className="rw-form-wrapper">
59
+ <Form onSubmit={onSubmit} className="rw-form-wrapper">
60
+ <Label
61
+ name="${usernameCamelCase}"
62
+ className="rw-label"
63
+ errorClassName="rw-label rw-label-error"
64
+ >
65
+ ${usernameTitleCase}
66
+ </Label>
67
+ <TextField
68
+ name="${usernameCamelCase}"
69
+ className="rw-input"
70
+ errorClassName="rw-input rw-input-error"
71
+ ref={${usernameCamelCase}Ref}
72
+ validation={{
73
+ required: {
74
+ value: true,
75
+ message: '${usernameTitleCase} is required',
76
+ },
77
+ }}
78
+ />
79
+ <FieldError name="${usernameCamelCase}" className="rw-field-error" />
80
+
81
+ <Label
82
+ name="${passwordCamelCase}"
83
+ className="rw-label"
84
+ errorClassName="rw-label rw-label-error"
85
+ >
86
+ ${passwordTitleCase}
87
+ </Label>
88
+ <PasswordField
89
+ name="${passwordCamelCase}"
90
+ className="rw-input"
91
+ errorClassName="rw-input rw-input-error"
92
+ autoComplete="current-password"
93
+ validation={{
94
+ required: {
95
+ value: true,
96
+ message: '${passwordTitleCase} is required',
97
+ },
98
+ }}
99
+ />
100
+ <FieldError name="${passwordCamelCase}" className="rw-field-error" />
101
+
102
+ <div className="rw-button-group">
103
+ <Submit className="rw-button rw-button-blue">
104
+ Sign Up
105
+ </Submit>
106
+ </div>
107
+ </Form>
108
+ </div>
109
+ </div>
110
+ </div>
111
+ <div className="rw-login-link">
112
+ <span>Already have an account?</span>{' '}
113
+ <Link to={routes.login()} className="rw-link">
114
+ Log in!
115
+ </Link>
116
+ </div>
117
+ </div>
118
+ </main>
119
+ </>
120
+ )
121
+ }
122
+
123
+ export default SignupPage
@@ -0,0 +1,15 @@
1
+ import {
2
+ createBuilder,
3
+ createCommand,
4
+ createHandler
5
+ } from "../yargsCommandHelpers.js";
6
+ const command = createCommand("directive");
7
+ const description = "Generate a new GraphQL directive";
8
+ const builder = createBuilder({ componentName: "directive" });
9
+ const handler = createHandler("directive");
10
+ export {
11
+ builder,
12
+ command,
13
+ description,
14
+ handler
15
+ };
@@ -0,0 +1,159 @@
1
+ import path from "path";
2
+ import camelcase from "camelcase";
3
+ import execa from "execa";
4
+ import { Listr } from "listr2";
5
+ import prompts from "prompts";
6
+ import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
7
+ import { getConfig } from "@cedarjs/project-config";
8
+ import c from "../../../lib/colors.js";
9
+ import {
10
+ getPaths,
11
+ writeFilesTask,
12
+ transformTSToJS
13
+ } from "../../../lib/index.js";
14
+ import {
15
+ prepareForRollback,
16
+ addFunctionToRollback
17
+ } from "../../../lib/rollback.js";
18
+ import { validateName } from "../helpers.js";
19
+ import { templateForComponentFile } from "../yargsHandlerHelpers.js";
20
+ const files = async ({ name, typescript = false, type, tests }) => {
21
+ if (tests === void 0) {
22
+ tests = getConfig().generate.tests;
23
+ }
24
+ if (!type) {
25
+ throw new Error("You must specify a directive type");
26
+ }
27
+ const camelName = camelcase(name);
28
+ const outputFilename = `${camelName}.${typescript ? "ts" : "js"}`;
29
+ const directiveFile = await templateForComponentFile({
30
+ name,
31
+ extension: typescript ? ".ts" : ".js",
32
+ generator: "directive",
33
+ templatePath: `${type}.directive.ts.template`,
34
+ outputPath: path.join(getPaths().api.directives, camelName, outputFilename),
35
+ templateVars: { camelName }
36
+ });
37
+ const files2 = [directiveFile];
38
+ if (tests) {
39
+ const testOutputFilename = `${camelcase(name)}.test.${typescript ? "ts" : "js"}`;
40
+ const testFile = await templateForComponentFile({
41
+ name,
42
+ extension: typescript ? ".test.ts" : ".test.js",
43
+ generator: "directive",
44
+ templatePath: `${type}.directive.test.ts.template`,
45
+ outputPath: path.join(
46
+ getPaths().api.directives,
47
+ camelName,
48
+ testOutputFilename
49
+ ),
50
+ templateVars: { camelName }
51
+ });
52
+ files2.push(testFile);
53
+ }
54
+ return files2.reduce(async (accP, [outputPath, content]) => {
55
+ const acc = await accP;
56
+ const template = typescript ? content : await transformTSToJS(outputPath, content);
57
+ return {
58
+ [outputPath]: template,
59
+ ...acc
60
+ };
61
+ }, Promise.resolve({}));
62
+ };
63
+ const handler = async (args) => {
64
+ recordTelemetryAttributes({
65
+ command: "generate directive",
66
+ type: args.type,
67
+ force: args.force,
68
+ rollback: args.rollback
69
+ });
70
+ let notes = "";
71
+ const POST_RUN_INSTRUCTIONS = `
72
+ ${c.note("After modifying your directive, you can add it to your SDLs e.g.:")}
73
+
74
+ ${c.info("// example todo.sdl.js")}
75
+ ${c.info("# Option A: Add it to a field")}
76
+ type Todo {
77
+ id: Int!
78
+ body: String! ${c.tip(`@${args.name}`)}
79
+ }
80
+
81
+ ${c.info("# Option B: Add it to query/mutation")}
82
+ type Query {
83
+ todos: [Todo] ${c.tip(`@${args.name}`)}
84
+ }
85
+ `;
86
+ validateName(args.name);
87
+ let directiveType = args.type;
88
+ if (!directiveType) {
89
+ const response = await prompts({
90
+ type: "select",
91
+ name: "directiveType",
92
+ choices: [
93
+ {
94
+ value: "validator",
95
+ title: "Validator",
96
+ description: "Implement a validation: throw an error if criteria not met to stop execution"
97
+ },
98
+ {
99
+ value: "transformer",
100
+ title: "Transformer",
101
+ description: "Modify values of fields or query responses"
102
+ }
103
+ ],
104
+ message: "What type of directive would you like to generate?"
105
+ });
106
+ directiveType = response.directiveType;
107
+ }
108
+ const tasks = new Listr(
109
+ [
110
+ {
111
+ title: "Generating directive file ...",
112
+ task: async () => {
113
+ const f = await files({ ...args, type: directiveType });
114
+ return writeFilesTask(f, {
115
+ overwriteExisting: args.force
116
+ });
117
+ }
118
+ },
119
+ {
120
+ title: "Generating TypeScript definitions and GraphQL schemas ...",
121
+ task: () => {
122
+ addFunctionToRollback(async () => {
123
+ await execa("yarn rw-gen", [], {
124
+ stdio: "pipe",
125
+ shell: true
126
+ });
127
+ }, true);
128
+ return execa("yarn rw-gen", [], {
129
+ stdio: "inherit",
130
+ shell: true
131
+ });
132
+ }
133
+ },
134
+ {
135
+ title: "Next steps...",
136
+ task: () => {
137
+ notes = POST_RUN_INSTRUCTIONS;
138
+ }
139
+ }
140
+ ].filter(Boolean),
141
+ { rendererOptions: { collapseSubtasks: false } }
142
+ );
143
+ try {
144
+ if (args.rollback && !args.force) {
145
+ prepareForRollback(tasks);
146
+ }
147
+ await tasks.run();
148
+ if (notes) {
149
+ console.log(notes);
150
+ }
151
+ } catch (e) {
152
+ console.log(c.error(e.message));
153
+ process.exit(1);
154
+ }
155
+ };
156
+ export {
157
+ files,
158
+ handler
159
+ };
@@ -0,0 +1,18 @@
1
+ import { mockRedwoodDirective, getDirectiveName } from '@cedarjs/testing/api'
2
+
3
+ import ${camelName} from './${camelName}'
4
+
5
+ describe('${camelName} directive', () => {
6
+ it('declares the directive sdl as schema, with the correct name', () => {
7
+ expect(${camelName}.schema).toBeTruthy()
8
+ expect(getDirectiveName(${camelName}.schema)).toBe('${camelName}')
9
+ })
10
+
11
+ it('has a ${camelName} implementation transforms the value', () => {
12
+ const mockExecution = mockRedwoodDirective(${camelName}, {
13
+ mockedResolvedValue: 'foo',
14
+ })
15
+
16
+ expect(mockExecution()).toBe('bar')
17
+ })
18
+ })