@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,558 @@
1
+ import path from "path";
2
+ import boxen from "boxen";
3
+ import fs from "fs-extra";
4
+ import { Listr } from "listr2";
5
+ import * as toml from "smol-toml";
6
+ import { env as envInterpolation } from "string-env-interpolation";
7
+ import { titleCase } from "title-case";
8
+ import { recordTelemetryAttributes } from "@redmix/cli-helpers";
9
+ import c from "../../../lib/colors.js";
10
+ import { getPaths } from "../../../lib/index.js";
11
+ import { SshExecutor } from "./SshExecutor.js";
12
+ const CONFIG_FILENAME = "deploy.toml";
13
+ const SYMLINK_FLAGS = "-nsf";
14
+ const CURRENT_RELEASE_SYMLINK_NAME = "current";
15
+ const LIFECYCLE_HOOKS = ["before", "after"];
16
+ const DEFAULT_SERVER_CONFIG = {
17
+ port: 22,
18
+ branch: "main",
19
+ packageManagerCommand: "yarn",
20
+ monitorCommand: "pm2",
21
+ sides: ["api", "web"],
22
+ keepReleases: 5
23
+ };
24
+ const pathJoin = path.posix.join;
25
+ const throwMissingConfig = (name) => {
26
+ throw new Error(
27
+ `"${name}" config option not set. See https://redwoodjs.com/docs/deployment/baremetal#deploytoml`
28
+ );
29
+ };
30
+ const verifyConfig = (config, yargs) => {
31
+ if (!yargs.environment) {
32
+ throw new Error(
33
+ "Must specify an environment to deploy to, ex: `yarn rw deploy baremetal production`"
34
+ );
35
+ }
36
+ if (!config[yargs.environment]) {
37
+ throw new Error(`No servers found for environment "${yargs.environment}"`);
38
+ }
39
+ return true;
40
+ };
41
+ const verifyServerConfig = (config) => {
42
+ if (!config.host) {
43
+ throwMissingConfig("host");
44
+ }
45
+ if (!config.path) {
46
+ throwMissingConfig("path");
47
+ }
48
+ if (!config.repo) {
49
+ throwMissingConfig("repo");
50
+ }
51
+ if (config.freeSpaceRequired && !/^\d+$/.test(config.freeSpaceRequired)) {
52
+ throw new Error('"freeSpaceRequired" must be an integer >= 0');
53
+ }
54
+ return true;
55
+ };
56
+ const symlinkCurrentCommand = async (dir, ssh, path2) => {
57
+ return await ssh.exec(path2, "ln", [
58
+ SYMLINK_FLAGS,
59
+ dir,
60
+ CURRENT_RELEASE_SYMLINK_NAME
61
+ ]);
62
+ };
63
+ const restartProcessCommand = async (processName, ssh, serverConfig, path2) => {
64
+ return await ssh.exec(path2, serverConfig.monitorCommand, [
65
+ "restart",
66
+ processName
67
+ ]);
68
+ };
69
+ const serverConfigWithDefaults = (serverConfig, yargs) => {
70
+ return {
71
+ ...DEFAULT_SERVER_CONFIG,
72
+ ...serverConfig,
73
+ branch: yargs.branch || serverConfig.branch || DEFAULT_SERVER_CONFIG.branch
74
+ };
75
+ };
76
+ const maintenanceTasks = (status, ssh, serverConfig) => {
77
+ const deployPath = pathJoin(serverConfig.path, CURRENT_RELEASE_SYMLINK_NAME);
78
+ const tasks = [];
79
+ if (status === "up") {
80
+ tasks.push({
81
+ title: `Enabling maintenance page...`,
82
+ task: async () => {
83
+ await ssh.exec(deployPath, "cp", [
84
+ pathJoin("web", "dist", "200.html"),
85
+ pathJoin("web", "dist", "200.html.orig")
86
+ ]);
87
+ await ssh.exec(deployPath, "ln", [
88
+ SYMLINK_FLAGS,
89
+ pathJoin("..", "src", "maintenance.html"),
90
+ pathJoin("web", "dist", "200.html")
91
+ ]);
92
+ }
93
+ });
94
+ if (serverConfig.processNames) {
95
+ tasks.push({
96
+ title: `Stopping ${serverConfig.processNames.join(", ")} processes...`,
97
+ task: async () => {
98
+ await ssh.exec(serverConfig.path, serverConfig.monitorCommand, [
99
+ "stop",
100
+ serverConfig.processNames.join(" ")
101
+ ]);
102
+ }
103
+ });
104
+ }
105
+ } else if (status === "down") {
106
+ tasks.push({
107
+ title: `Starting ${serverConfig.processNames.join(", ")} processes...`,
108
+ task: async () => {
109
+ await ssh.exec(serverConfig.path, serverConfig.monitorCommand, [
110
+ "start",
111
+ serverConfig.processNames.join(" ")
112
+ ]);
113
+ }
114
+ });
115
+ if (serverConfig.processNames) {
116
+ tasks.push({
117
+ title: `Disabling maintenance page...`,
118
+ task: async () => {
119
+ await ssh.exec(deployPath, "rm", [
120
+ pathJoin("web", "dist", "200.html")
121
+ ]);
122
+ await ssh.exec(deployPath, "cp", [
123
+ pathJoin("web", "dist", "200.html.orig"),
124
+ pathJoin("web", "dist", "200.html")
125
+ ]);
126
+ }
127
+ });
128
+ }
129
+ }
130
+ return tasks;
131
+ };
132
+ const rollbackTasks = (count, ssh, serverConfig) => {
133
+ let rollbackCount = 1;
134
+ if (parseInt(count) === count) {
135
+ rollbackCount = count;
136
+ }
137
+ const tasks = [
138
+ {
139
+ title: `Rolling back ${rollbackCount} release(s)...`,
140
+ task: async () => {
141
+ const currentLink = (await ssh.exec(serverConfig.path, "readlink", ["-f", "current"])).stdout.split("/").pop();
142
+ const dirs = (await ssh.exec(serverConfig.path, "ls", ["-t"])).stdout.split("\n").filter((dirs2) => !dirs2.match(/current/));
143
+ const deployedIndex = dirs.indexOf(currentLink);
144
+ const rollbackIndex = deployedIndex + rollbackCount;
145
+ if (dirs[rollbackIndex]) {
146
+ console.info("Setting symlink");
147
+ await symlinkCurrentCommand(
148
+ dirs[rollbackIndex],
149
+ ssh,
150
+ serverConfig.path
151
+ );
152
+ } else {
153
+ throw new Error(
154
+ `Cannot rollback ${rollbackCount} release(s): ${dirs.length - dirs.indexOf(currentLink) - 1} previous release(s) available`
155
+ );
156
+ }
157
+ }
158
+ }
159
+ ];
160
+ if (serverConfig.processNames) {
161
+ for (const processName of serverConfig.processNames) {
162
+ tasks.push({
163
+ title: `Restarting ${processName} process...`,
164
+ task: async () => {
165
+ await restartProcessCommand(
166
+ processName,
167
+ ssh,
168
+ serverConfig,
169
+ serverConfig.path
170
+ );
171
+ }
172
+ });
173
+ }
174
+ }
175
+ return tasks;
176
+ };
177
+ const lifecycleTask = (lifecycle, task, skip, { serverLifecycle, ssh, cmdPath }) => {
178
+ if (serverLifecycle[lifecycle]?.[task]) {
179
+ const tasks = [];
180
+ for (const command of serverLifecycle[lifecycle][task]) {
181
+ tasks.push({
182
+ title: `${titleCase(lifecycle)} ${task}: \`${command}\``,
183
+ task: async () => {
184
+ await ssh.exec(cmdPath, command);
185
+ },
186
+ skip: () => skip
187
+ });
188
+ }
189
+ return tasks;
190
+ }
191
+ };
192
+ const commandWithLifecycleEvents = ({ name, config, skip, command }) => {
193
+ const tasks = [];
194
+ tasks.push(lifecycleTask("before", name, skip, config));
195
+ tasks.push({ ...command, skip: () => skip });
196
+ tasks.push(lifecycleTask("after", name, skip, config));
197
+ return tasks.flat().filter((t) => t);
198
+ };
199
+ const deployTasks = (yargs, ssh, serverConfig, serverLifecycle) => {
200
+ const cmdPath = pathJoin(serverConfig.path, yargs.releaseDir);
201
+ const config = { yargs, ssh, serverConfig, serverLifecycle, cmdPath };
202
+ const tasks = [];
203
+ tasks.push(
204
+ commandWithLifecycleEvents({
205
+ name: "df",
206
+ config: { ...config, cmdPath: serverConfig.path },
207
+ skip: !yargs.df || serverConfig.freeSpaceRequired === 0 || serverConfig.freeSpaceRequired === "0",
208
+ command: {
209
+ title: `Checking available disk space...`,
210
+ task: async (_ctx, task) => {
211
+ const { stdout } = await ssh.exec(serverConfig.path, "df", [
212
+ serverConfig.path,
213
+ "|",
214
+ "awk",
215
+ `'NR == 2 {print "df:"$4}'`
216
+ ]);
217
+ const df = stdout.split("\n").find((line) => line.startsWith("df:"));
218
+ if (!df || !df.startsWith("df:") || df === "df:") {
219
+ return task.skip(
220
+ c.warning("Warning: Could not get disk space information")
221
+ );
222
+ }
223
+ const dfMb = parseInt(df.replace("df:", ""), 10) / 1024;
224
+ if (isNaN(dfMb)) {
225
+ return task.skip(
226
+ c.warning("Warning: Could not parse disk space information")
227
+ );
228
+ }
229
+ task.output = `Available disk space: ${dfMb}MB`;
230
+ const freeSpaceRequired = parseInt(
231
+ serverConfig.freeSpaceRequired ?? 2048,
232
+ 10
233
+ );
234
+ if (dfMb < freeSpaceRequired) {
235
+ if (typeof serverConfig.freeSpaceRequired === "undefined") {
236
+ return task.skip(
237
+ c.warning(
238
+ `Warning: Your server is running low on disk space. (${Math.round(dfMb)}MB available)`
239
+ )
240
+ );
241
+ }
242
+ throw new Error(
243
+ `Not enough disk space. You need at least ${freeSpaceRequired}MB free space to continue.`
244
+ );
245
+ }
246
+ }
247
+ }
248
+ })
249
+ );
250
+ tasks.push(
251
+ commandWithLifecycleEvents({
252
+ name: "update",
253
+ config: { ...config, cmdPath: serverConfig.path },
254
+ skip: !yargs.update,
255
+ command: {
256
+ title: `Cloning \`${serverConfig.branch}\` branch...`,
257
+ task: async () => {
258
+ await ssh.exec(serverConfig.path, "git", [
259
+ "clone",
260
+ `--branch=${serverConfig.branch}`,
261
+ `--depth=1`,
262
+ serverConfig.repo,
263
+ yargs.releaseDir
264
+ ]);
265
+ }
266
+ }
267
+ })
268
+ );
269
+ tasks.push(
270
+ commandWithLifecycleEvents({
271
+ name: "symlinkEnv",
272
+ config,
273
+ skip: !yargs.update,
274
+ command: {
275
+ title: `Symlink .env...`,
276
+ task: async () => {
277
+ await ssh.exec(cmdPath, "ln", [SYMLINK_FLAGS, "../.env", ".env"]);
278
+ }
279
+ }
280
+ })
281
+ );
282
+ tasks.push(
283
+ commandWithLifecycleEvents({
284
+ name: "install",
285
+ config,
286
+ skip: !yargs.install,
287
+ command: {
288
+ title: `Installing dependencies...`,
289
+ task: async () => {
290
+ await ssh.exec(cmdPath, serverConfig.packageManagerCommand, [
291
+ "install"
292
+ ]);
293
+ }
294
+ }
295
+ })
296
+ );
297
+ tasks.push(
298
+ commandWithLifecycleEvents({
299
+ name: "migrate",
300
+ config,
301
+ skip: !yargs.migrate || serverConfig?.migrate === false,
302
+ command: {
303
+ title: `DB Migrations...`,
304
+ task: async () => {
305
+ await ssh.exec(cmdPath, serverConfig.packageManagerCommand, [
306
+ "rw",
307
+ "prisma",
308
+ "migrate",
309
+ "deploy"
310
+ ]);
311
+ await ssh.exec(cmdPath, serverConfig.packageManagerCommand, [
312
+ "rw",
313
+ "prisma",
314
+ "generate"
315
+ ]);
316
+ await ssh.exec(cmdPath, serverConfig.packageManagerCommand, [
317
+ "rw",
318
+ "dataMigrate",
319
+ "up"
320
+ ]);
321
+ }
322
+ }
323
+ })
324
+ );
325
+ for (const side of serverConfig.sides) {
326
+ tasks.push(
327
+ commandWithLifecycleEvents({
328
+ name: "build",
329
+ config,
330
+ skip: !yargs.build,
331
+ command: {
332
+ title: `Building ${side}...`,
333
+ task: async () => {
334
+ await ssh.exec(cmdPath, serverConfig.packageManagerCommand, [
335
+ "rw",
336
+ "build",
337
+ side
338
+ ]);
339
+ }
340
+ }
341
+ })
342
+ );
343
+ }
344
+ tasks.push(
345
+ commandWithLifecycleEvents({
346
+ name: "symlinkCurrent",
347
+ config,
348
+ skip: !yargs.update,
349
+ command: {
350
+ title: `Symlinking current release...`,
351
+ task: async () => {
352
+ await symlinkCurrentCommand(yargs.releaseDir, ssh, serverConfig.path);
353
+ },
354
+ skip: () => !yargs.update
355
+ }
356
+ })
357
+ );
358
+ if (serverConfig.processNames) {
359
+ for (const processName of serverConfig.processNames) {
360
+ if (yargs.firstRun) {
361
+ tasks.push(
362
+ commandWithLifecycleEvents({
363
+ name: "restart",
364
+ config,
365
+ skip: !yargs.restart,
366
+ command: {
367
+ title: `Starting ${processName} process for the first time...`,
368
+ task: async () => {
369
+ await ssh.exec(serverConfig.path, serverConfig.monitorCommand, [
370
+ "start",
371
+ pathJoin(CURRENT_RELEASE_SYMLINK_NAME, "ecosystem.config.js"),
372
+ "--only",
373
+ processName
374
+ ]);
375
+ }
376
+ }
377
+ })
378
+ );
379
+ tasks.push({
380
+ title: `Saving ${processName} state for future startup...`,
381
+ task: async () => {
382
+ await ssh.exec(serverConfig.path, serverConfig.monitorCommand, [
383
+ "save"
384
+ ]);
385
+ },
386
+ skip: () => !yargs.restart
387
+ });
388
+ } else {
389
+ tasks.push(
390
+ commandWithLifecycleEvents({
391
+ name: "restart",
392
+ config,
393
+ skip: !yargs.restart,
394
+ command: {
395
+ title: `Restarting ${processName} process...`,
396
+ task: async () => {
397
+ await restartProcessCommand(
398
+ processName,
399
+ ssh,
400
+ serverConfig,
401
+ serverConfig.path
402
+ );
403
+ }
404
+ }
405
+ })
406
+ );
407
+ }
408
+ }
409
+ }
410
+ tasks.push(
411
+ commandWithLifecycleEvents({
412
+ name: "cleanup",
413
+ config: { ...config, cmdPath: serverConfig.path },
414
+ skip: !yargs.cleanup,
415
+ command: {
416
+ title: `Cleaning up old deploys...`,
417
+ task: async () => {
418
+ const fileStartIndex = serverConfig.keepReleases + 2;
419
+ await ssh.exec(
420
+ serverConfig.path,
421
+ `ls -t | tail -n +${fileStartIndex} | xargs rm -rf`
422
+ );
423
+ }
424
+ }
425
+ })
426
+ );
427
+ return tasks.flat().filter((e) => e);
428
+ };
429
+ const mergeLifecycleEvents = (lifecycle, other) => {
430
+ let lifecycleCopy = JSON.parse(JSON.stringify(lifecycle));
431
+ for (const hook of LIFECYCLE_HOOKS) {
432
+ for (const key in other[hook]) {
433
+ lifecycleCopy[hook][key] = (lifecycleCopy[hook][key] || []).concat(
434
+ other[hook][key]
435
+ );
436
+ }
437
+ }
438
+ return lifecycleCopy;
439
+ };
440
+ const parseConfig = (yargs, rawConfigToml) => {
441
+ const configToml = envInterpolation(rawConfigToml);
442
+ const config = toml.parse(configToml);
443
+ let envConfig;
444
+ const emptyLifecycle = {};
445
+ verifyConfig(config, yargs);
446
+ for (const hook of LIFECYCLE_HOOKS) {
447
+ emptyLifecycle[hook] = {};
448
+ }
449
+ let envLifecycle = mergeLifecycleEvents(emptyLifecycle, config);
450
+ envConfig = config[yargs.environment];
451
+ envLifecycle = mergeLifecycleEvents(envLifecycle, envConfig);
452
+ return { envConfig, envLifecycle };
453
+ };
454
+ const commands = (yargs, ssh) => {
455
+ const deployConfig = fs.readFileSync(pathJoin(getPaths().base, CONFIG_FILENAME)).toString();
456
+ let { envConfig, envLifecycle } = parseConfig(yargs, deployConfig);
457
+ let servers = [];
458
+ let tasks = [];
459
+ for (const config of envConfig.servers) {
460
+ const serverConfig = serverConfigWithDefaults(config, yargs);
461
+ verifyServerConfig(serverConfig);
462
+ const serverLifecycle = mergeLifecycleEvents(envLifecycle, serverConfig);
463
+ tasks.push({
464
+ title: "Connecting...",
465
+ task: () => ssh.connect({
466
+ host: serverConfig.host,
467
+ port: serverConfig.port,
468
+ username: serverConfig.username,
469
+ password: serverConfig.password,
470
+ privateKey: serverConfig.privateKey,
471
+ privateKeyPath: serverConfig.privateKeyPath,
472
+ passphrase: serverConfig.passphrase,
473
+ agent: serverConfig.agentForward && process.env.SSH_AUTH_SOCK,
474
+ agentForward: serverConfig.agentForward
475
+ })
476
+ });
477
+ if (yargs.maintenance) {
478
+ tasks = tasks.concat(
479
+ maintenanceTasks(yargs.maintenance, ssh, serverConfig)
480
+ );
481
+ } else if (yargs.rollback) {
482
+ tasks = tasks.concat(rollbackTasks(yargs.rollback, ssh, serverConfig));
483
+ } else {
484
+ tasks = tasks.concat(
485
+ deployTasks(yargs, ssh, serverConfig, serverLifecycle)
486
+ );
487
+ }
488
+ tasks.push({
489
+ title: "Disconnecting...",
490
+ task: () => ssh.dispose()
491
+ });
492
+ servers.push({
493
+ title: serverConfig.host,
494
+ task: () => {
495
+ return new Listr(tasks);
496
+ }
497
+ });
498
+ }
499
+ return servers;
500
+ };
501
+ const handler = async (yargs) => {
502
+ recordTelemetryAttributes({
503
+ command: "deploy baremetal",
504
+ firstRun: yargs.firstRun,
505
+ df: yargs.df,
506
+ update: yargs.update,
507
+ install: yargs.install,
508
+ migrate: yargs.migrate,
509
+ build: yargs.build,
510
+ restart: yargs.restart,
511
+ cleanup: yargs.cleanup,
512
+ maintenance: yargs.maintenance,
513
+ rollback: yargs.rollback,
514
+ verbose: yargs.verbose
515
+ });
516
+ const tomlPath = path.join(getPaths().base, "deploy.toml");
517
+ const ecosystemPath = path.join(getPaths().base, "ecosystem.config.js");
518
+ if (!fs.existsSync(tomlPath) || !fs.existsSync(ecosystemPath)) {
519
+ console.error(
520
+ c.error("\nError: Baremetal deploy has not been properly setup.\n") + "Please run `yarn rw setup deploy baremetal` before deploying"
521
+ );
522
+ process.exit(1);
523
+ }
524
+ const ssh = new SshExecutor(yargs.verbose);
525
+ try {
526
+ const tasks = new Listr(commands(yargs, ssh), {
527
+ concurrent: true,
528
+ exitOnError: true,
529
+ renderer: yargs.verbose && "verbose"
530
+ });
531
+ await tasks.run();
532
+ } catch (e) {
533
+ console.error(c.error("\nDeploy failed:"));
534
+ console.error(
535
+ boxen(e.stderr || e.message, {
536
+ padding: { top: 0, bottom: 0, right: 1, left: 1 },
537
+ margin: 0,
538
+ borderColor: "red"
539
+ })
540
+ );
541
+ process.exit(e?.exitCode || 1);
542
+ }
543
+ };
544
+ export {
545
+ DEFAULT_SERVER_CONFIG,
546
+ commandWithLifecycleEvents,
547
+ commands,
548
+ deployTasks,
549
+ handler,
550
+ lifecycleTask,
551
+ maintenanceTasks,
552
+ parseConfig,
553
+ rollbackTasks,
554
+ serverConfigWithDefaults,
555
+ throwMissingConfig,
556
+ verifyConfig,
557
+ verifyServerConfig
558
+ };
@@ -0,0 +1,89 @@
1
+ import terminalLink from "terminal-link";
2
+ const command = "baremetal [environment]";
3
+ const description = "Deploy to baremetal server(s)";
4
+ const builder = (yargs) => {
5
+ yargs.positional("environment", {
6
+ describe: "The environment to deploy to",
7
+ type: "string"
8
+ });
9
+ yargs.option("first-run", {
10
+ describe: "Set this flag the first time you deploy: starts server processes from scratch",
11
+ default: false,
12
+ type: "boolean"
13
+ });
14
+ yargs.option("df", {
15
+ describe: "Check available disk space",
16
+ default: true,
17
+ type: "boolean"
18
+ });
19
+ yargs.option("update", {
20
+ describe: "Update code to latest revision",
21
+ default: true,
22
+ type: "boolean"
23
+ });
24
+ yargs.option("install", {
25
+ describe: "Run `yarn install`",
26
+ default: true,
27
+ type: "boolean"
28
+ });
29
+ yargs.option("migrate", {
30
+ describe: "Run database migration tasks",
31
+ default: true,
32
+ type: "boolean"
33
+ });
34
+ yargs.option("build", {
35
+ describe: "Run build process for the deployed `sides`",
36
+ default: true,
37
+ type: "boolean"
38
+ });
39
+ yargs.option("restart", {
40
+ describe: "Restart server processes",
41
+ default: true,
42
+ type: "boolean"
43
+ });
44
+ yargs.option("cleanup", {
45
+ describe: "Remove old deploy directories",
46
+ default: true,
47
+ type: "boolean"
48
+ });
49
+ yargs.option("releaseDir", {
50
+ describe: "Directory to create for the latest release, defaults to timestamp",
51
+ default: (/* @__PURE__ */ new Date()).toISOString().replace(/[:\-TZ]/g, "").replace(/\.\d+$/, ""),
52
+ type: "string"
53
+ });
54
+ yargs.option("branch", {
55
+ describe: "The branch to deploy",
56
+ type: "string"
57
+ });
58
+ yargs.option("maintenance", {
59
+ describe: "Add/remove the maintenance page",
60
+ choices: ["up", "down"],
61
+ help: "Put up a maintenance page by replacing the content of web/dist/index.html with the content of web/src/maintenance.html"
62
+ });
63
+ yargs.option("rollback", {
64
+ describe: "Add/remove the maintenance page",
65
+ help: "Rollback [count] number of releases"
66
+ });
67
+ yargs.option("verbose", {
68
+ describe: "Verbose mode, for debugging purposes",
69
+ default: false,
70
+ type: "boolean"
71
+ });
72
+ yargs.epilogue(
73
+ `Also see the ${terminalLink(
74
+ "Redwood Baremetal Deploy Reference",
75
+ "https://redwoodjs.com/docs/cli-commands#deploy"
76
+ )}
77
+ `
78
+ );
79
+ };
80
+ async function handler(yargs) {
81
+ const { handler: importedHandler } = await import("./baremetal/baremetalHandler.js");
82
+ return importedHandler(yargs);
83
+ }
84
+ export {
85
+ builder,
86
+ command,
87
+ description,
88
+ handler
89
+ };
@@ -0,0 +1,40 @@
1
+ import terminalLink from "terminal-link";
2
+ const command = "flightcontrol <side>";
3
+ const alias = "fc";
4
+ const description = "Build, Migrate, and Serve commands for Flightcontrol deploy";
5
+ const builder = (yargs) => {
6
+ yargs.positional("side", {
7
+ choices: ["api", "web"],
8
+ description: "Side to deploy",
9
+ type: "string"
10
+ }).option("prisma", {
11
+ description: "Apply database migrations",
12
+ type: "boolean",
13
+ default: true
14
+ }).option("serve", {
15
+ description: "Run server for api in production",
16
+ type: "boolean",
17
+ default: false
18
+ }).option("data-migrate", {
19
+ description: "Apply data migrations",
20
+ type: "boolean",
21
+ default: true,
22
+ alias: "dm"
23
+ }).epilogue(
24
+ `For more commands, options, and examples, see ${terminalLink(
25
+ "Redwood CLI Reference",
26
+ "https://redwoodjs.com/docs/cli-commands#deploy"
27
+ )}`
28
+ );
29
+ };
30
+ async function handler(yargs) {
31
+ const { handler: importedHandler } = await import("./flightcontrolHandler.js");
32
+ return importedHandler(yargs);
33
+ }
34
+ export {
35
+ alias,
36
+ builder,
37
+ command,
38
+ description,
39
+ handler
40
+ };