@wasp.sh/wasp-cli-darwin-arm64-unknown 0.20.0

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 (410) hide show
  1. package/data/Cli/starters/README.md +22 -0
  2. package/data/Cli/starters/basic/README.md +35 -0
  3. package/data/Cli/starters/basic/eslint.config.js +24 -0
  4. package/data/Cli/starters/basic/main.wasp +100 -0
  5. package/data/Cli/starters/basic/package.json +29 -0
  6. package/data/Cli/starters/basic/postcss.config.js +6 -0
  7. package/data/Cli/starters/basic/schema.prisma +42 -0
  8. package/data/Cli/starters/basic/src/App.css +13 -0
  9. package/data/Cli/starters/basic/src/App.tsx +12 -0
  10. package/data/Cli/starters/basic/src/assets/logo.svg +1 -0
  11. package/data/Cli/starters/basic/src/auth/AuthLayout.tsx +10 -0
  12. package/data/Cli/starters/basic/src/auth/email/EmailVerificationPage.tsx +19 -0
  13. package/data/Cli/starters/basic/src/auth/email/LoginPage.tsx +27 -0
  14. package/data/Cli/starters/basic/src/auth/email/PasswordResetPage.tsx +19 -0
  15. package/data/Cli/starters/basic/src/auth/email/RequestPasswordResetPage.tsx +10 -0
  16. package/data/Cli/starters/basic/src/auth/email/SignupPage.tsx +34 -0
  17. package/data/Cli/starters/basic/src/auth/email/userSignupFields.ts +13 -0
  18. package/data/Cli/starters/basic/src/shared/components/Button.tsx +90 -0
  19. package/data/Cli/starters/basic/src/shared/components/Dialog.tsx +85 -0
  20. package/data/Cli/starters/basic/src/shared/components/Header.tsx +39 -0
  21. package/data/Cli/starters/basic/src/shared/components/Input.tsx +36 -0
  22. package/data/Cli/starters/basic/src/shared/components/Portal.tsx +26 -0
  23. package/data/Cli/starters/basic/src/tags/actions.ts +23 -0
  24. package/data/Cli/starters/basic/src/tags/components/ColorRadioButton.tsx +44 -0
  25. package/data/Cli/starters/basic/src/tags/components/ColorRadioButtons.tsx +59 -0
  26. package/data/Cli/starters/basic/src/tags/components/CreateTagDialog.tsx +50 -0
  27. package/data/Cli/starters/basic/src/tags/components/CreateTagForm.tsx +100 -0
  28. package/data/Cli/starters/basic/src/tags/components/TagLabel.tsx +55 -0
  29. package/data/Cli/starters/basic/src/tags/components/colors.ts +8 -0
  30. package/data/Cli/starters/basic/src/tags/queries.ts +14 -0
  31. package/data/Cli/starters/basic/src/tasks/TasksPage.tsx +19 -0
  32. package/data/Cli/starters/basic/src/tasks/actions.ts +71 -0
  33. package/data/Cli/starters/basic/src/tasks/components/CreateTaskForm.tsx +103 -0
  34. package/data/Cli/starters/basic/src/tasks/components/TaskList.tsx +68 -0
  35. package/data/Cli/starters/basic/src/tasks/components/TaskListItem.tsx +56 -0
  36. package/data/Cli/starters/basic/src/tasks/queries.ts +21 -0
  37. package/data/Cli/starters/basic/tailwind.config.js +30 -0
  38. package/data/Cli/starters/basic/vite.config.ts +7 -0
  39. package/data/Cli/starters/minimal/main.wasp +14 -0
  40. package/data/Cli/starters/minimal/package.json +18 -0
  41. package/data/Cli/starters/minimal/schema.prisma +10 -0
  42. package/data/Cli/starters/minimal/src/Main.css +103 -0
  43. package/data/Cli/starters/minimal/src/MainPage.tsx +37 -0
  44. package/data/Cli/starters/minimal/src/assets/logo.svg +1 -0
  45. package/data/Cli/starters/minimal/vite.config.ts +7 -0
  46. package/data/Cli/starters/skeleton/public/favicon.ico +0 -0
  47. package/data/Cli/starters/skeleton/src/vite-env.d.ts +7 -0
  48. package/data/Cli/starters/skeleton/tsconfig.json +28 -0
  49. package/data/Generator/templates/Dockerfile +78 -0
  50. package/data/Generator/templates/db/schema.prisma +24 -0
  51. package/data/Generator/templates/dockerignore +2 -0
  52. package/data/Generator/templates/react-app/README.md +21 -0
  53. package/data/Generator/templates/react-app/gitignore +23 -0
  54. package/data/Generator/templates/react-app/index.html +22 -0
  55. package/data/Generator/templates/react-app/netlify.toml +8 -0
  56. package/data/Generator/templates/react-app/npmrc +1 -0
  57. package/data/Generator/templates/react-app/package.json +31 -0
  58. package/data/Generator/templates/react-app/public/manifest.json +15 -0
  59. package/data/Generator/templates/react-app/src/auth/pages/OAuthCallback.tsx +93 -0
  60. package/data/Generator/templates/react-app/src/auth/pages/createAuthRequiredPage.jsx +40 -0
  61. package/data/Generator/templates/react-app/src/components/DefaultRootErrorBoundary.tsx +16 -0
  62. package/data/Generator/templates/react-app/src/components/FullPageWrapper.tsx +21 -0
  63. package/data/Generator/templates/react-app/src/components/Loader.module.css +37 -0
  64. package/data/Generator/templates/react-app/src/components/Loader.tsx +12 -0
  65. package/data/Generator/templates/react-app/src/components/Message.tsx +86 -0
  66. package/data/Generator/templates/react-app/src/index.tsx +47 -0
  67. package/data/Generator/templates/react-app/src/logo.png +0 -0
  68. package/data/Generator/templates/react-app/src/router.tsx +59 -0
  69. package/data/Generator/templates/react-app/src/test/vitest/setup.ts +8 -0
  70. package/data/Generator/templates/react-app/src/utils.js +3 -0
  71. package/data/Generator/templates/react-app/src/vite-env.d.ts +1 -0
  72. package/data/Generator/templates/react-app/tsconfig.app.json +28 -0
  73. package/data/Generator/templates/react-app/tsconfig.json +11 -0
  74. package/data/Generator/templates/react-app/tsconfig.vite.json +16 -0
  75. package/data/Generator/templates/react-app/vite/detectServerImports.ts +53 -0
  76. package/data/Generator/templates/react-app/vite/validateEnv.ts +45 -0
  77. package/data/Generator/templates/react-app/vite.config.ts +74 -0
  78. package/data/Generator/templates/sdk/wasp/api/events.ts +11 -0
  79. package/data/Generator/templates/sdk/wasp/api/index.ts +136 -0
  80. package/data/Generator/templates/sdk/wasp/auth/email/actions/login.ts +13 -0
  81. package/data/Generator/templates/sdk/wasp/auth/email/actions/passwordReset.ts +22 -0
  82. package/data/Generator/templates/sdk/wasp/auth/email/actions/signup.ts +20 -0
  83. package/data/Generator/templates/sdk/wasp/auth/email/actions/verifyEmail.ts +14 -0
  84. package/data/Generator/templates/sdk/wasp/auth/email/index.ts +5 -0
  85. package/data/Generator/templates/sdk/wasp/auth/forms/Auth.module.css +16 -0
  86. package/data/Generator/templates/sdk/wasp/auth/forms/Auth.tsx +94 -0
  87. package/data/Generator/templates/sdk/wasp/auth/forms/ForgotPassword.tsx +18 -0
  88. package/data/Generator/templates/sdk/wasp/auth/forms/Login.tsx +18 -0
  89. package/data/Generator/templates/sdk/wasp/auth/forms/ResetPassword.tsx +18 -0
  90. package/data/Generator/templates/sdk/wasp/auth/forms/Signup.tsx +24 -0
  91. package/data/Generator/templates/sdk/wasp/auth/forms/VerifyEmail.tsx +18 -0
  92. package/data/Generator/templates/sdk/wasp/auth/forms/internal/Form.module.css +99 -0
  93. package/data/Generator/templates/sdk/wasp/auth/forms/internal/Form.tsx +74 -0
  94. package/data/Generator/templates/sdk/wasp/auth/forms/internal/Message.module.css +22 -0
  95. package/data/Generator/templates/sdk/wasp/auth/forms/internal/Message.tsx +34 -0
  96. package/data/Generator/templates/sdk/wasp/auth/forms/internal/auth-styles.css +30 -0
  97. package/data/Generator/templates/sdk/wasp/auth/forms/internal/common/LoginSignupForm.module.css +55 -0
  98. package/data/Generator/templates/sdk/wasp/auth/forms/internal/common/LoginSignupForm.tsx +291 -0
  99. package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/ForgotPasswordForm.tsx +52 -0
  100. package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/ResetPasswordForm.tsx +82 -0
  101. package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/VerifyEmailForm.tsx +43 -0
  102. package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/useEmail.ts +33 -0
  103. package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialButton.module.css +33 -0
  104. package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialButton.tsx +14 -0
  105. package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialIcons.module.css +4 -0
  106. package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialIcons.tsx +74 -0
  107. package/data/Generator/templates/sdk/wasp/auth/forms/internal/usernameAndPassword/useUsernameAndPassword.ts +29 -0
  108. package/data/Generator/templates/sdk/wasp/auth/forms/internal/util.ts +16 -0
  109. package/data/Generator/templates/sdk/wasp/auth/forms/types.ts +77 -0
  110. package/data/Generator/templates/sdk/wasp/auth/helpers/_Provider.tsx +17 -0
  111. package/data/Generator/templates/sdk/wasp/auth/helpers/user.ts +15 -0
  112. package/data/Generator/templates/sdk/wasp/auth/index.ts +9 -0
  113. package/data/Generator/templates/sdk/wasp/auth/jwt.ts +22 -0
  114. package/data/Generator/templates/sdk/wasp/auth/logout.ts +18 -0
  115. package/data/Generator/templates/sdk/wasp/auth/lucia.ts +53 -0
  116. package/data/Generator/templates/sdk/wasp/auth/password.ts +36 -0
  117. package/data/Generator/templates/sdk/wasp/auth/providers/index.ts +9 -0
  118. package/data/Generator/templates/sdk/wasp/auth/providers/types.ts +68 -0
  119. package/data/Generator/templates/sdk/wasp/auth/session.ts +78 -0
  120. package/data/Generator/templates/sdk/wasp/auth/types.ts +2 -0
  121. package/data/Generator/templates/sdk/wasp/auth/useAuth.ts +37 -0
  122. package/data/Generator/templates/sdk/wasp/auth/user.ts +63 -0
  123. package/data/Generator/templates/sdk/wasp/auth/username/actions/login.ts +13 -0
  124. package/data/Generator/templates/sdk/wasp/auth/username/actions/signup.ts +20 -0
  125. package/data/Generator/templates/sdk/wasp/auth/username/index.ts +2 -0
  126. package/data/Generator/templates/sdk/wasp/auth/utils.ts +369 -0
  127. package/data/Generator/templates/sdk/wasp/auth/validation.ts +83 -0
  128. package/data/Generator/templates/sdk/wasp/client/auth/discord.ts +2 -0
  129. package/data/Generator/templates/sdk/wasp/client/auth/email.ts +5 -0
  130. package/data/Generator/templates/sdk/wasp/client/auth/github.ts +2 -0
  131. package/data/Generator/templates/sdk/wasp/client/auth/google.ts +2 -0
  132. package/data/Generator/templates/sdk/wasp/client/auth/index.ts +29 -0
  133. package/data/Generator/templates/sdk/wasp/client/auth/keycloak.ts +2 -0
  134. package/data/Generator/templates/sdk/wasp/client/auth/slack.ts +2 -0
  135. package/data/Generator/templates/sdk/wasp/client/auth/ui.ts +32 -0
  136. package/data/Generator/templates/sdk/wasp/client/auth/username.ts +2 -0
  137. package/data/Generator/templates/sdk/wasp/client/config.ts +15 -0
  138. package/data/Generator/templates/sdk/wasp/client/crud/_crud.ts +89 -0
  139. package/data/Generator/templates/sdk/wasp/client/crud/index.ts +4 -0
  140. package/data/Generator/templates/sdk/wasp/client/crud/operationsHelpers.ts +21 -0
  141. package/data/Generator/templates/sdk/wasp/client/env/schema.ts +22 -0
  142. package/data/Generator/templates/sdk/wasp/client/env.ts +5 -0
  143. package/data/Generator/templates/sdk/wasp/client/hooks.ts +19 -0
  144. package/data/Generator/templates/sdk/wasp/client/index.ts +17 -0
  145. package/data/Generator/templates/sdk/wasp/client/operations/actions/core.ts +49 -0
  146. package/data/Generator/templates/sdk/wasp/client/operations/actions/index.ts +13 -0
  147. package/data/Generator/templates/sdk/wasp/client/operations/hooks.ts +347 -0
  148. package/data/Generator/templates/sdk/wasp/client/operations/index.ts +22 -0
  149. package/data/Generator/templates/sdk/wasp/client/operations/internal/index.ts +22 -0
  150. package/data/Generator/templates/sdk/wasp/client/operations/internal/resources.js +83 -0
  151. package/data/Generator/templates/sdk/wasp/client/operations/internal/updateHandlersMap.js +37 -0
  152. package/data/Generator/templates/sdk/wasp/client/operations/queries/core.ts +91 -0
  153. package/data/Generator/templates/sdk/wasp/client/operations/queries/index.ts +16 -0
  154. package/data/Generator/templates/sdk/wasp/client/operations/queryClient.ts +34 -0
  155. package/data/Generator/templates/sdk/wasp/client/operations/rpc.ts +96 -0
  156. package/data/Generator/templates/sdk/wasp/client/router/Link.tsx +21 -0
  157. package/data/Generator/templates/sdk/wasp/client/router/index.ts +53 -0
  158. package/data/Generator/templates/sdk/wasp/client/router/linkHelpers.ts +48 -0
  159. package/data/Generator/templates/sdk/wasp/client/router/types.ts +98 -0
  160. package/data/Generator/templates/sdk/wasp/client/test/index.ts +1 -0
  161. package/data/Generator/templates/sdk/wasp/client/test/vitest/helpers.tsx +95 -0
  162. package/data/Generator/templates/sdk/wasp/client/webSocket/WebSocketProvider.tsx +77 -0
  163. package/data/Generator/templates/sdk/wasp/client/webSocket/index.ts +39 -0
  164. package/data/Generator/templates/sdk/wasp/core/auth.ts +40 -0
  165. package/data/Generator/templates/sdk/wasp/core/serialization/custom-register.ts +21 -0
  166. package/data/Generator/templates/sdk/wasp/core/serialization/index.ts +56 -0
  167. package/data/Generator/templates/sdk/wasp/core/serialization/prisma.ts +54 -0
  168. package/data/Generator/templates/sdk/wasp/core/storage.ts +50 -0
  169. package/data/Generator/templates/sdk/wasp/dev/index.ts +19 -0
  170. package/data/Generator/templates/sdk/wasp/entities/index.ts +28 -0
  171. package/data/Generator/templates/sdk/wasp/env/index.ts +9 -0
  172. package/data/Generator/templates/sdk/wasp/env/validation.ts +38 -0
  173. package/data/Generator/templates/sdk/wasp/package.json +152 -0
  174. package/data/Generator/templates/sdk/wasp/prisma-runtime-library.d.ts +17 -0
  175. package/data/Generator/templates/sdk/wasp/scripts/copy-assets.js +14 -0
  176. package/data/Generator/templates/sdk/wasp/server/HttpError.ts +30 -0
  177. package/data/Generator/templates/sdk/wasp/server/_types/index.ts +105 -0
  178. package/data/Generator/templates/sdk/wasp/server/_types/taggedEntities.ts +26 -0
  179. package/data/Generator/templates/sdk/wasp/server/api/index.ts +44 -0
  180. package/data/Generator/templates/sdk/wasp/server/auth/email/index.ts +20 -0
  181. package/data/Generator/templates/sdk/wasp/server/auth/email/utils.ts +104 -0
  182. package/data/Generator/templates/sdk/wasp/server/auth/hooks.ts +188 -0
  183. package/data/Generator/templates/sdk/wasp/server/auth/index.ts +49 -0
  184. package/data/Generator/templates/sdk/wasp/server/auth/oauth/index.ts +38 -0
  185. package/data/Generator/templates/sdk/wasp/server/auth/oauth/oneTimeCode.ts +50 -0
  186. package/data/Generator/templates/sdk/wasp/server/auth/oauth/provider.ts +20 -0
  187. package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/discord.ts +22 -0
  188. package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/github.ts +20 -0
  189. package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/google.ts +22 -0
  190. package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/keycloak.ts +23 -0
  191. package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/slack.ts +22 -0
  192. package/data/Generator/templates/sdk/wasp/server/auth/oauth/redirect.ts +43 -0
  193. package/data/Generator/templates/sdk/wasp/server/auth/user.ts +148 -0
  194. package/data/Generator/templates/sdk/wasp/server/auth/username.ts +1 -0
  195. package/data/Generator/templates/sdk/wasp/server/config.ts +47 -0
  196. package/data/Generator/templates/sdk/wasp/server/crud/_operationTypes.ts +134 -0
  197. package/data/Generator/templates/sdk/wasp/server/crud/index.ts +5 -0
  198. package/data/Generator/templates/sdk/wasp/server/dbClient.ts +35 -0
  199. package/data/Generator/templates/sdk/wasp/server/email/core/helpers.ts +40 -0
  200. package/data/Generator/templates/sdk/wasp/server/email/core/index.ts +17 -0
  201. package/data/Generator/templates/sdk/wasp/server/email/core/providers/dummy.ts +34 -0
  202. package/data/Generator/templates/sdk/wasp/server/email/core/providers/mailgun.ts +31 -0
  203. package/data/Generator/templates/sdk/wasp/server/email/core/providers/sendgrid.ts +44 -0
  204. package/data/Generator/templates/sdk/wasp/server/email/core/providers/smtp.ts +29 -0
  205. package/data/Generator/templates/sdk/wasp/server/email/core/types.ts +59 -0
  206. package/data/Generator/templates/sdk/wasp/server/email/index.ts +39 -0
  207. package/data/Generator/templates/sdk/wasp/server/env.ts +173 -0
  208. package/data/Generator/templates/sdk/wasp/server/index.ts +17 -0
  209. package/data/Generator/templates/sdk/wasp/server/jobs/_job.ts +39 -0
  210. package/data/Generator/templates/sdk/wasp/server/jobs/core/job.ts +28 -0
  211. package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/index.ts +3 -0
  212. package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/pgBoss.ts +76 -0
  213. package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/pgBossJob.ts +230 -0
  214. package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/types.ts +9 -0
  215. package/data/Generator/templates/sdk/wasp/server/jobs/index.ts +5 -0
  216. package/data/Generator/templates/sdk/wasp/server/middleware/globalMiddleware.ts +8 -0
  217. package/data/Generator/templates/sdk/wasp/server/middleware/index.ts +1 -0
  218. package/data/Generator/templates/sdk/wasp/server/operations/actions/index.ts +41 -0
  219. package/data/Generator/templates/sdk/wasp/server/operations/actions/types.ts +35 -0
  220. package/data/Generator/templates/sdk/wasp/server/operations/index.ts +13 -0
  221. package/data/Generator/templates/sdk/wasp/server/operations/queries/index.ts +42 -0
  222. package/data/Generator/templates/sdk/wasp/server/operations/queries/types.ts +36 -0
  223. package/data/Generator/templates/sdk/wasp/server/operations/wrappers.ts +242 -0
  224. package/data/Generator/templates/sdk/wasp/server/types/index.ts +11 -0
  225. package/data/Generator/templates/sdk/wasp/server/utils.ts +38 -0
  226. package/data/Generator/templates/sdk/wasp/server/webSocket/index.ts +57 -0
  227. package/data/Generator/templates/sdk/wasp/tsconfig.json +102 -0
  228. package/data/Generator/templates/sdk/wasp/universal/ansiColors.ts +14 -0
  229. package/data/Generator/templates/sdk/wasp/universal/predicates.ts +3 -0
  230. package/data/Generator/templates/sdk/wasp/universal/types.ts +74 -0
  231. package/data/Generator/templates/sdk/wasp/universal/url.ts +9 -0
  232. package/data/Generator/templates/sdk/wasp/universal/validators.ts +21 -0
  233. package/data/Generator/templates/sdk/wasp/vite-env.d.ts +1 -0
  234. package/data/Generator/templates/server/README.md +1 -0
  235. package/data/Generator/templates/server/gitignore +6 -0
  236. package/data/Generator/templates/server/nodemon.json +13 -0
  237. package/data/Generator/templates/server/npmrc +1 -0
  238. package/data/Generator/templates/server/package.json +27 -0
  239. package/data/Generator/templates/server/rollup.config.js +44 -0
  240. package/data/Generator/templates/server/src/actions/_action.ts +18 -0
  241. package/data/Generator/templates/server/src/app.js +36 -0
  242. package/data/Generator/templates/server/src/auth/hooks.ts +135 -0
  243. package/data/Generator/templates/server/src/auth/providers/config/discord.ts +69 -0
  244. package/data/Generator/templates/server/src/auth/providers/config/email.ts +96 -0
  245. package/data/Generator/templates/server/src/auth/providers/config/github.ts +78 -0
  246. package/data/Generator/templates/server/src/auth/providers/config/google.ts +65 -0
  247. package/data/Generator/templates/server/src/auth/providers/config/keycloak.ts +67 -0
  248. package/data/Generator/templates/server/src/auth/providers/config/slack.ts +65 -0
  249. package/data/Generator/templates/server/src/auth/providers/config/username.ts +33 -0
  250. package/data/Generator/templates/server/src/auth/providers/email/login.ts +66 -0
  251. package/data/Generator/templates/server/src/auth/providers/email/requestPasswordReset.ts +74 -0
  252. package/data/Generator/templates/server/src/auth/providers/email/resetPassword.ts +48 -0
  253. package/data/Generator/templates/server/src/auth/providers/email/signup.ts +165 -0
  254. package/data/Generator/templates/server/src/auth/providers/email/verifyEmail.ts +42 -0
  255. package/data/Generator/templates/server/src/auth/providers/index.ts +32 -0
  256. package/data/Generator/templates/server/src/auth/providers/oauth/config.ts +19 -0
  257. package/data/Generator/templates/server/src/auth/providers/oauth/cookies.ts +35 -0
  258. package/data/Generator/templates/server/src/auth/providers/oauth/handler.ts +130 -0
  259. package/data/Generator/templates/server/src/auth/providers/oauth/oneTimeCode.ts +39 -0
  260. package/data/Generator/templates/server/src/auth/providers/oauth/state.ts +144 -0
  261. package/data/Generator/templates/server/src/auth/providers/oauth/types.ts +7 -0
  262. package/data/Generator/templates/server/src/auth/providers/oauth/user.ts +139 -0
  263. package/data/Generator/templates/server/src/auth/providers/username/login.ts +64 -0
  264. package/data/Generator/templates/server/src/auth/providers/username/signup.ts +59 -0
  265. package/data/Generator/templates/server/src/crud/_operations.ts +184 -0
  266. package/data/Generator/templates/server/src/dbSeed.ts +37 -0
  267. package/data/Generator/templates/server/src/jobs/_job.ts +9 -0
  268. package/data/Generator/templates/server/src/jobs/core/allJobs.ts +8 -0
  269. package/data/Generator/templates/server/src/middleware/globalMiddleware.ts +45 -0
  270. package/data/Generator/templates/server/src/middleware/index.ts +1 -0
  271. package/data/Generator/templates/server/src/middleware/operations.ts +28 -0
  272. package/data/Generator/templates/server/src/queries/_query.ts +18 -0
  273. package/data/Generator/templates/server/src/routes/apis/index.ts +67 -0
  274. package/data/Generator/templates/server/src/routes/auth/index.js +16 -0
  275. package/data/Generator/templates/server/src/routes/auth/logout.ts +12 -0
  276. package/data/Generator/templates/server/src/routes/auth/me.ts +10 -0
  277. package/data/Generator/templates/server/src/routes/crud/_crud.ts +46 -0
  278. package/data/Generator/templates/server/src/routes/crud/index.ts +12 -0
  279. package/data/Generator/templates/server/src/routes/index.js +55 -0
  280. package/data/Generator/templates/server/src/routes/operations/_action.js +5 -0
  281. package/data/Generator/templates/server/src/routes/operations/_query.js +5 -0
  282. package/data/Generator/templates/server/src/routes/operations/index.js +18 -0
  283. package/data/Generator/templates/server/src/server.ts +76 -0
  284. package/data/Generator/templates/server/src/views/wrong-port.ts +123 -0
  285. package/data/Generator/templates/server/src/webSocket/initialization.ts +59 -0
  286. package/data/Generator/templates/server/tsconfig.json +41 -0
  287. package/data/Lsp/templates/ts/action.fn.ts +12 -0
  288. package/data/Lsp/templates/ts/operation.fn.js +7 -0
  289. package/data/Lsp/templates/ts/page.component.jsx +9 -0
  290. package/data/Lsp/templates/ts/query.fn.ts +12 -0
  291. package/data/packages/deploy/dist/common/brandedTypes.js +2 -0
  292. package/data/packages/deploy/dist/common/clientApp.js +26 -0
  293. package/data/packages/deploy/dist/common/commander.js +8 -0
  294. package/data/packages/deploy/dist/common/random.js +5 -0
  295. package/data/packages/deploy/dist/common/terminal.js +24 -0
  296. package/data/packages/deploy/dist/common/typeUtils.js +2 -0
  297. package/data/packages/deploy/dist/common/validation.js +14 -0
  298. package/data/packages/deploy/dist/common/waspBuild.js +21 -0
  299. package/data/packages/deploy/dist/common/waspProject.js +43 -0
  300. package/data/packages/deploy/dist/common/zx.js +10 -0
  301. package/data/packages/deploy/dist/index.js +30 -0
  302. package/data/packages/deploy/dist/providers/fly/CommonCmdOptions.js +2 -0
  303. package/data/packages/deploy/dist/providers/fly/CommonOps.js +36 -0
  304. package/data/packages/deploy/dist/providers/fly/DeploymentInstructions.js +12 -0
  305. package/data/packages/deploy/dist/providers/fly/commands/cmd/CmdCmdOptions.js +2 -0
  306. package/data/packages/deploy/dist/providers/fly/commands/cmd/cmd.js +29 -0
  307. package/data/packages/deploy/dist/providers/fly/commands/createDb/CreateDbCmdOptions.js +2 -0
  308. package/data/packages/deploy/dist/providers/fly/commands/createDb/createDb.js +55 -0
  309. package/data/packages/deploy/dist/providers/fly/commands/deploy/DeployCmdOptions.js +2 -0
  310. package/data/packages/deploy/dist/providers/fly/commands/deploy/deploy.js +88 -0
  311. package/data/packages/deploy/dist/providers/fly/commands/launch/LaunchCmdOptions.js +2 -0
  312. package/data/packages/deploy/dist/providers/fly/commands/launch/launch.js +17 -0
  313. package/data/packages/deploy/dist/providers/fly/commands/setup/SetupCmdOptions.js +2 -0
  314. package/data/packages/deploy/dist/providers/fly/commands/setup/setup.js +141 -0
  315. package/data/packages/deploy/dist/providers/fly/flyAppUrl.js +4 -0
  316. package/data/packages/deploy/dist/providers/fly/flyCli.js +74 -0
  317. package/data/packages/deploy/dist/providers/fly/index.js +121 -0
  318. package/data/packages/deploy/dist/providers/fly/jsonOutputSchemas.js +37 -0
  319. package/data/packages/deploy/dist/providers/fly/tomlFile.js +65 -0
  320. package/data/packages/deploy/dist/providers/railway/DeploymentInstructions.js +11 -0
  321. package/data/packages/deploy/dist/providers/railway/brandedTypes.js +2 -0
  322. package/data/packages/deploy/dist/providers/railway/commands/deploy/DeployCmdOptions.js +2 -0
  323. package/data/packages/deploy/dist/providers/railway/commands/deploy/client.js +22 -0
  324. package/data/packages/deploy/dist/providers/railway/commands/deploy/common.js +40 -0
  325. package/data/packages/deploy/dist/providers/railway/commands/deploy/index.js +57 -0
  326. package/data/packages/deploy/dist/providers/railway/commands/deploy/server.js +17 -0
  327. package/data/packages/deploy/dist/providers/railway/commands/launch/LaunchCmdOptions.js +2 -0
  328. package/data/packages/deploy/dist/providers/railway/commands/launch/launch.js +9 -0
  329. package/data/packages/deploy/dist/providers/railway/commands/setup/SetupCmdOptions.js +2 -0
  330. package/data/packages/deploy/dist/providers/railway/commands/setup/setup.js +146 -0
  331. package/data/packages/deploy/dist/providers/railway/index.js +83 -0
  332. package/data/packages/deploy/dist/providers/railway/jsonOutputSchemas.js +19 -0
  333. package/data/packages/deploy/dist/providers/railway/ports.js +6 -0
  334. package/data/packages/deploy/dist/providers/railway/railwayCli.js +85 -0
  335. package/data/packages/deploy/dist/providers/railway/railwayProject/RailwayProject.js +14 -0
  336. package/data/packages/deploy/dist/providers/railway/railwayProject/cli.js +80 -0
  337. package/data/packages/deploy/dist/providers/railway/railwayProject/index.js +48 -0
  338. package/data/packages/deploy/dist/providers/railway/railwayService/nameGenerator.js +24 -0
  339. package/data/packages/deploy/dist/providers/railway/railwayService/url.js +32 -0
  340. package/data/packages/deploy/package-lock.json +3536 -0
  341. package/data/packages/deploy/package.json +29 -0
  342. package/data/packages/prisma/dist/format.js +35 -0
  343. package/data/packages/prisma/dist/index.js +33 -0
  344. package/data/packages/prisma/package-lock.json +5101 -0
  345. package/data/packages/prisma/package.json +30 -0
  346. package/data/packages/studio/dist/index.js +48 -0
  347. package/data/packages/studio/dist/public/assets/Flow-b5112d3d.js +26 -0
  348. package/data/packages/studio/dist/public/assets/index-17ce6ed4.css +1 -0
  349. package/data/packages/studio/dist/public/assets/index-62a9d21a.js +120 -0
  350. package/data/packages/studio/dist/public/index.html +14 -0
  351. package/data/packages/studio/package-lock.json +1866 -0
  352. package/data/packages/studio/package.json +33 -0
  353. package/data/packages/ts-inspect/dist/exports.js +82 -0
  354. package/data/packages/ts-inspect/dist/index.js +28 -0
  355. package/data/packages/ts-inspect/package-lock.json +4947 -0
  356. package/data/packages/ts-inspect/package.json +31 -0
  357. package/data/packages/wasp-config/dist/__tests__/appAnalyzer.unit.test.d.ts +2 -0
  358. package/data/packages/wasp-config/dist/__tests__/appAnalyzer.unit.test.d.ts.map +1 -0
  359. package/data/packages/wasp-config/dist/__tests__/appAnalyzer.unit.test.js +59 -0
  360. package/data/packages/wasp-config/dist/__tests__/cli.unit.test.d.ts +2 -0
  361. package/data/packages/wasp-config/dist/__tests__/cli.unit.test.d.ts.map +1 -0
  362. package/data/packages/wasp-config/dist/__tests__/cli.unit.test.js +65 -0
  363. package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.integration.test.d.ts +2 -0
  364. package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.integration.test.d.ts.map +1 -0
  365. package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.integration.test.js +126 -0
  366. package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.unit.test.d.ts +2 -0
  367. package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.unit.test.d.ts.map +1 -0
  368. package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.unit.test.js +743 -0
  369. package/data/packages/wasp-config/dist/__tests__/testFixtures.d.ts +224 -0
  370. package/data/packages/wasp-config/dist/__tests__/testFixtures.d.ts.map +1 -0
  371. package/data/packages/wasp-config/dist/__tests__/testFixtures.js +656 -0
  372. package/data/packages/wasp-config/dist/__tests__/testFixtures.test-d.d.ts +2 -0
  373. package/data/packages/wasp-config/dist/__tests__/testFixtures.test-d.d.ts.map +1 -0
  374. package/data/packages/wasp-config/dist/__tests__/testFixtures.test-d.js +57 -0
  375. package/data/packages/wasp-config/dist/src/_private.d.ts +2 -0
  376. package/data/packages/wasp-config/dist/src/_private.d.ts.map +1 -0
  377. package/data/packages/wasp-config/dist/src/_private.js +1 -0
  378. package/data/packages/wasp-config/dist/src/appAnalyzer.d.ts +16 -0
  379. package/data/packages/wasp-config/dist/src/appAnalyzer.d.ts.map +1 -0
  380. package/data/packages/wasp-config/dist/src/appAnalyzer.js +34 -0
  381. package/data/packages/wasp-config/dist/src/appSpec.d.ts +223 -0
  382. package/data/packages/wasp-config/dist/src/appSpec.d.ts.map +1 -0
  383. package/data/packages/wasp-config/dist/src/appSpec.js +6 -0
  384. package/data/packages/wasp-config/dist/src/branded.d.ts +7 -0
  385. package/data/packages/wasp-config/dist/src/branded.d.ts.map +1 -0
  386. package/data/packages/wasp-config/dist/src/branded.js +1 -0
  387. package/data/packages/wasp-config/dist/src/cli.d.ts +6 -0
  388. package/data/packages/wasp-config/dist/src/cli.d.ts.map +1 -0
  389. package/data/packages/wasp-config/dist/src/cli.js +24 -0
  390. package/data/packages/wasp-config/dist/src/index.d.ts +8 -0
  391. package/data/packages/wasp-config/dist/src/index.d.ts.map +1 -0
  392. package/data/packages/wasp-config/dist/src/index.js +1 -0
  393. package/data/packages/wasp-config/dist/src/mapTsAppSpecToAppSpecDecls.d.ts +38 -0
  394. package/data/packages/wasp-config/dist/src/mapTsAppSpecToAppSpecDecls.d.ts.map +1 -0
  395. package/data/packages/wasp-config/dist/src/mapTsAppSpecToAppSpecDecls.js +294 -0
  396. package/data/packages/wasp-config/dist/src/publicApi/App.d.ts +24 -0
  397. package/data/packages/wasp-config/dist/src/publicApi/App.d.ts.map +1 -0
  398. package/data/packages/wasp-config/dist/src/publicApi/App.js +75 -0
  399. package/data/packages/wasp-config/dist/src/publicApi/tsAppSpec.d.ts +171 -0
  400. package/data/packages/wasp-config/dist/src/publicApi/tsAppSpec.d.ts.map +1 -0
  401. package/data/packages/wasp-config/dist/src/publicApi/tsAppSpec.js +1 -0
  402. package/data/packages/wasp-config/dist/src/run.d.ts +3 -0
  403. package/data/packages/wasp-config/dist/src/run.d.ts.map +1 -0
  404. package/data/packages/wasp-config/dist/src/run.js +18 -0
  405. package/data/packages/wasp-config/package-lock.json +3992 -0
  406. package/data/packages/wasp-config/package.json +39 -0
  407. package/main.js +9 -0
  408. package/package.json +1 -0
  409. package/readme.md +3 -0
  410. package/wasp-bin +0 -0
@@ -0,0 +1,88 @@
1
+ import { $, cd, fs } from "zx";
2
+ import { buildClient } from "../../../../common/clientApp.js";
3
+ import { getFullCommandName } from "../../../../common/commander.js";
4
+ import { displayWaspRocketImage, waspSays, } from "../../../../common/terminal.js";
5
+ import { ensureWaspProjectIsBuilt } from "../../../../common/waspBuild.js";
6
+ import { getClientBuildDir, getServerBuildDir, } from "../../../../common/waspProject.js";
7
+ import { createDeploymentInstructions, } from "../../DeploymentInstructions.js";
8
+ import { getFlyAppUrl } from "../../flyAppUrl.js";
9
+ import { secretExists } from "../../flyCli.js";
10
+ import { flySetupCommand } from "../../index.js";
11
+ import { clientTomlExistsInProject, copyLocalClientTomlToProject, copyLocalServerTomlToProject, copyProjectClientTomlLocally, copyProjectServerTomlLocally, getInferredBasenameFromClientToml, getInferredBasenameFromServerToml, getTomlFilePaths, serverTomlExistsInProject, } from "../../tomlFile.js";
12
+ export async function deploy(cmdOptions) {
13
+ waspSays("Deploying your Wasp app to Fly.io!");
14
+ await ensureWaspProjectIsBuilt(cmdOptions);
15
+ const tomlFilePaths = getTomlFilePaths(cmdOptions);
16
+ // NOTE: Below, it would be nice if we could store the client, server, and DB names somewhere.
17
+ // For now we just rely on the suffix naming convention and infer from toml files.
18
+ if (!serverTomlExistsInProject(tomlFilePaths)) {
19
+ waspSays(`${tomlFilePaths.serverTomlPath} missing. Skipping server deploy. Perhaps you need to run "${getFullCommandName(flySetupCommand)}" first?`);
20
+ }
21
+ else if (cmdOptions.skipServer) {
22
+ waspSays("Skipping server deploy due to CLI option.");
23
+ }
24
+ else {
25
+ const inferredBaseName = getInferredBasenameFromServerToml(tomlFilePaths);
26
+ const deploymentInstructions = createDeploymentInstructions({
27
+ baseName: inferredBaseName,
28
+ cmdOptions,
29
+ tomlFilePaths,
30
+ });
31
+ await deployServer(deploymentInstructions, cmdOptions);
32
+ }
33
+ if (!clientTomlExistsInProject(tomlFilePaths)) {
34
+ waspSays(`${tomlFilePaths.clientTomlPath} missing. Skipping client deploy. Perhaps you need to run "${getFullCommandName(flySetupCommand)}" first?`);
35
+ }
36
+ else if (cmdOptions.skipClient) {
37
+ waspSays("Skipping client deploy due to CLI option.");
38
+ }
39
+ else {
40
+ const inferredBaseName = getInferredBasenameFromClientToml(tomlFilePaths);
41
+ const deploymentInstructions = createDeploymentInstructions({
42
+ baseName: inferredBaseName,
43
+ cmdOptions,
44
+ tomlFilePaths,
45
+ });
46
+ await deployClient(deploymentInstructions, cmdOptions);
47
+ }
48
+ }
49
+ async function deployServer(deploymentInstructions, { buildLocally }) {
50
+ waspSays("Deploying your server now...");
51
+ cd(getServerBuildDir(deploymentInstructions.cmdOptions.waspProjectDir));
52
+ copyProjectServerTomlLocally(deploymentInstructions.tomlFilePaths);
53
+ // Make sure we have a DATABASE_URL present. If not, they need to create/attach their DB first.
54
+ const databaseUrlSet = await secretExists("DATABASE_URL");
55
+ if (!databaseUrlSet) {
56
+ throw new Error("Your server app does not have a DATABASE_URL secret set. Perhaps you need to create or attach your database?");
57
+ }
58
+ const deployArgs = [buildLocally ? "--local-only" : "--remote-only"];
59
+ await $ `flyctl deploy ${deployArgs}`;
60
+ // NOTE: Deploy is not expected to update the toml file, but doing this just in case.
61
+ // However, if it does and we fail to copy it back, we would be in an inconsistent state.
62
+ // TOOD: Consider how to best handle this situation across all operations.
63
+ copyLocalServerTomlToProject(deploymentInstructions.tomlFilePaths);
64
+ waspSays("Server has been deployed!");
65
+ }
66
+ async function deployClient(deploymentInstructions, { buildLocally }) {
67
+ waspSays("Deploying your client now...");
68
+ cd(getClientBuildDir(deploymentInstructions.cmdOptions.waspProjectDir));
69
+ copyProjectClientTomlLocally(deploymentInstructions.tomlFilePaths);
70
+ const serverFlyAppUrl = getFlyAppUrl(deploymentInstructions.serverFlyAppName);
71
+ await buildClient(serverFlyAppUrl, deploymentInstructions.cmdOptions);
72
+ // Creates the necessary Dockerfile for deploying static websites to Fly.io.
73
+ // Adds dummy .dockerignore to supress CLI question.
74
+ // Ref: https://fly.io/docs/languages-and-frameworks/static/
75
+ const dockerfileContents = `
76
+ FROM pierrezemb/gostatic
77
+ CMD [ "-fallback", "index.html" ]
78
+ COPY ./build/ /srv/http/
79
+ `;
80
+ fs.writeFileSync("Dockerfile", dockerfileContents);
81
+ fs.writeFileSync(".dockerignore", "");
82
+ const deployArgs = [buildLocally ? "--local-only" : "--remote-only"];
83
+ await $ `flyctl deploy ${deployArgs}`;
84
+ copyLocalClientTomlToProject(deploymentInstructions.tomlFilePaths);
85
+ displayWaspRocketImage();
86
+ waspSays(`Client has been deployed! Your Wasp app is accessible at: ${getFlyAppUrl(deploymentInstructions.clientFlyAppName)}`);
87
+ }
88
+ //# sourceMappingURL=deploy.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=LaunchCmdOptions.js.map
@@ -0,0 +1,17 @@
1
+ import { waspSays } from "../../../../common/terminal.js";
2
+ import { clientTomlExistsInProject, getTomlFilePaths, serverTomlExistsInProject, } from "../../tomlFile.js";
3
+ import { createDb } from "../createDb/createDb.js";
4
+ import { deploy } from "../deploy/deploy.js";
5
+ import { setup } from "../setup/setup.js";
6
+ export async function launch(basename, region, cmdOptions) {
7
+ waspSays("Launching your Wasp app to Fly.io!");
8
+ const tomlFilePaths = getTomlFilePaths(cmdOptions);
9
+ if (serverTomlExistsInProject(tomlFilePaths) ||
10
+ clientTomlExistsInProject(tomlFilePaths)) {
11
+ throw new Error("You already have Fly toml files. The launch command is intended to be run one time on a new Fly project. Please try a different command.");
12
+ }
13
+ await setup(basename, region, cmdOptions);
14
+ await createDb(region, cmdOptions);
15
+ await deploy(cmdOptions);
16
+ }
17
+ //# sourceMappingURL=launch.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SetupCmdOptions.js.map
@@ -0,0 +1,141 @@
1
+ import { $, cd, chalk, question } from "zx";
2
+ import { getFullCommandName } from "../../../../common/commander.js";
3
+ import { generateRandomHexString } from "../../../../common/random.js";
4
+ import { waspSays } from "../../../../common/terminal.js";
5
+ import { ensureWaspProjectIsBuilt } from "../../../../common/waspBuild.js";
6
+ import { getClientBuildDir, getServerBuildDir, } from "../../../../common/waspProject.js";
7
+ import { createDeploymentInstructions, } from "../../DeploymentInstructions.js";
8
+ import { getFlyAppUrl } from "../../flyAppUrl.js";
9
+ import { createFlyDbCommand } from "../../index.js";
10
+ import { clientTomlExistsInProject, copyLocalClientTomlToProject, copyLocalServerTomlToProject, deleteLocalToml, doesLocalTomlContainLine, getTomlFilePaths, replaceLineInLocalToml, serverTomlExistsInProject, } from "../../tomlFile.js";
11
+ const internalPortOptionRegex = /internal_port = \d+/g;
12
+ const serverAppPort = 8080;
13
+ const clientAppPort = 8043;
14
+ export async function setup(baseName, region, cmdOptions) {
15
+ waspSays("Setting up your Wasp app with Fly.io!");
16
+ await ensureWaspProjectIsBuilt(cmdOptions);
17
+ const tomlFilePaths = getTomlFilePaths(cmdOptions);
18
+ const deploymentInstructions = createDeploymentInstructions({
19
+ baseName,
20
+ region,
21
+ cmdOptions,
22
+ tomlFilePaths,
23
+ });
24
+ if (serverTomlExistsInProject(tomlFilePaths)) {
25
+ waspSays(`${tomlFilePaths.serverTomlPath} exists. Skipping server setup.`);
26
+ }
27
+ else {
28
+ await setupServer(deploymentInstructions);
29
+ }
30
+ if (clientTomlExistsInProject(tomlFilePaths)) {
31
+ waspSays(`${tomlFilePaths.clientTomlPath} exists. Skipping client setup.`);
32
+ }
33
+ else {
34
+ await setupClient(deploymentInstructions);
35
+ }
36
+ waspSays(`Don't forget to create your database by running "${getFullCommandName(createFlyDbCommand)}".`);
37
+ }
38
+ async function setupServer(deploymentInstructions) {
39
+ waspSays(`Setting up server app with name ${deploymentInstructions.serverFlyAppName}`);
40
+ cd(getServerBuildDir(deploymentInstructions.cmdOptions.waspProjectDir));
41
+ deleteLocalToml();
42
+ const launchArgs = [
43
+ "--name",
44
+ deploymentInstructions.serverFlyAppName,
45
+ "--region",
46
+ deploymentInstructions.region,
47
+ ];
48
+ if (deploymentInstructions.cmdOptions.org) {
49
+ launchArgs.push("--org", deploymentInstructions.cmdOptions.org);
50
+ }
51
+ // This creates the fly.toml file, but does not attempt to deploy.
52
+ await $ `flyctl launch --no-deploy ${launchArgs}`;
53
+ const minMachinesOptionRegex = /min_machines_running = 0/g;
54
+ if (!doesLocalTomlContainLine(minMachinesOptionRegex)) {
55
+ await question(`\n⚠️ There was a possible issue setting up your server app.
56
+ We tried modifying your server fly.toml to set ${chalk.bold("min_machines_running = 1")}, but couldn't find the option ${chalk.bold("min_machines_running")} in the fly.toml.
57
+
58
+ We advise that you additionaly check what is the value for "minimal number of machines running" on Fly
59
+ for this server app and confirm that it is set to the value you are OK with.
60
+
61
+ Be aware that if it is set to 0, your server will shut down when there are no requests from the client,
62
+ which might be an issue for you if you have recurring Jobs or some other processes that need to keep
63
+ running on the server even without external input, in which case we advise keeping "minimal number
64
+ of machines running" setting at a number larger than zero.
65
+
66
+ Contact the Wasp Team at our Discord server if you need help with this: https://discord.gg/rzdnErX
67
+
68
+ Press any key to continue or Ctrl+C to cancel.`);
69
+ }
70
+ else {
71
+ replaceLineInLocalToml(minMachinesOptionRegex, "min_machines_running = 1");
72
+ }
73
+ if (!doesLocalTomlContainLine(internalPortOptionRegex)) {
74
+ await question(`\n⚠️ There was an issue setting up your server app.
75
+ We tried modifying your server fly.toml to set ${chalk.bold(`internal_port = ${serverAppPort}`)}, but couldn't find the option ${chalk.bold("internal_port")} in the fly.toml.
76
+
77
+ This means your server app might not be accessible.
78
+
79
+ Contact the Wasp Team at our Discord server if you need help with this: https://discord.gg/rzdnErX
80
+
81
+ Press any key to continue or Ctrl+C to cancel.`);
82
+ }
83
+ else {
84
+ replaceLineInLocalToml(internalPortOptionRegex, `internal_port = ${serverAppPort}`);
85
+ }
86
+ copyLocalServerTomlToProject(deploymentInstructions.tomlFilePaths);
87
+ const jwtSecret = generateRandomHexString();
88
+ const secretsArgs = [
89
+ `JWT_SECRET=${jwtSecret}`,
90
+ // NOTE: Normally these would just be envars, but flyctl
91
+ // doesn't provide a way to set envars that persist to fly.toml.
92
+ `PORT=${serverAppPort}`,
93
+ `WASP_WEB_CLIENT_URL=${getFlyAppUrl(deploymentInstructions.clientFlyAppName)}`,
94
+ `WASP_SERVER_URL=${getFlyAppUrl(deploymentInstructions.serverFlyAppName)}`,
95
+ ];
96
+ if (deploymentInstructions.cmdOptions.serverSecret.length > 0) {
97
+ deploymentInstructions.cmdOptions.serverSecret.forEach((secret) => {
98
+ secretsArgs.push(secret);
99
+ });
100
+ }
101
+ await $ `flyctl secrets set ${secretsArgs}`;
102
+ console.log(""); // `flyctl secrets` does not produce it's own newline.
103
+ waspSays("Server setup complete!");
104
+ }
105
+ async function setupClient(deploymentInstructions) {
106
+ waspSays(`Setting up client app with name ${deploymentInstructions.clientFlyAppName}`);
107
+ cd(getClientBuildDir(deploymentInstructions.cmdOptions.waspProjectDir));
108
+ deleteLocalToml();
109
+ const launchArgs = [
110
+ "--name",
111
+ deploymentInstructions.clientFlyAppName,
112
+ "--region",
113
+ deploymentInstructions.region,
114
+ ];
115
+ if (deploymentInstructions.cmdOptions.org) {
116
+ launchArgs.push("--org", deploymentInstructions.cmdOptions.org);
117
+ }
118
+ // This creates the fly.toml file, but does not attempt to deploy.
119
+ await $ `flyctl launch --no-deploy ${launchArgs}`;
120
+ if (!doesLocalTomlContainLine(internalPortOptionRegex)) {
121
+ await question(`\n⚠️ There was an issue setting up your client app.
122
+ We tried modifying your client fly.toml to set ${chalk.bold(`internal_port = ${clientAppPort}`)}, but couldn't find the option ${chalk.bold("internal_port")} in the fly.toml.
123
+
124
+ This means your client app might not be accessible.
125
+
126
+ Contact the Wasp Team at our Discord server if you need help with this: https://discord.gg/rzdnErX
127
+
128
+ Press any key to continue or Ctrl+C to cancel.`);
129
+ }
130
+ else {
131
+ // goStatic listens on port 8043 by default, but the default fly.toml
132
+ // assumes port 8080 (or 3000, depending on flyctl version).
133
+ replaceLineInLocalToml(internalPortOptionRegex, `internal_port = ${clientAppPort}`);
134
+ }
135
+ copyLocalClientTomlToProject(deploymentInstructions.tomlFilePaths);
136
+ if (deploymentInstructions.cmdOptions.clientSecret.length > 0) {
137
+ await $ `flyctl secrets set ${deploymentInstructions.cmdOptions.clientSecret}`;
138
+ }
139
+ waspSays("Client setup complete!");
140
+ }
141
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1,4 @@
1
+ export function getFlyAppUrl(flyAppName) {
2
+ return `https://${flyAppName}.fly.dev`;
3
+ }
4
+ //# sourceMappingURL=flyAppUrl.js.map
@@ -0,0 +1,74 @@
1
+ import { confirm } from "@inquirer/prompts";
2
+ import { $ } from "zx";
3
+ import { getFullCommandName } from "../../common/commander.js";
4
+ import { executeFlyCommand } from "./index.js";
5
+ import { FlyRegionListSchema, FlySecretListSchema, } from "./jsonOutputSchemas.js";
6
+ export async function flyctlExists() {
7
+ try {
8
+ await $ `flyctl version`;
9
+ return true;
10
+ }
11
+ catch {
12
+ return false;
13
+ }
14
+ }
15
+ export async function isUserLoggedIn() {
16
+ try {
17
+ await $ `flyctl auth whoami`;
18
+ return true;
19
+ }
20
+ catch {
21
+ return false;
22
+ }
23
+ }
24
+ async function ensureUserLoggedIn() {
25
+ const userLoggedIn = await isUserLoggedIn();
26
+ if (userLoggedIn) {
27
+ return;
28
+ }
29
+ const wantsToLogin = await confirm({
30
+ message: "flyctl is not logged into Fly.io. Would you like to log in now?",
31
+ });
32
+ if (!wantsToLogin) {
33
+ throw new Error("Unable to continue without logging in to Fly.io.");
34
+ }
35
+ try {
36
+ await $ `flyctl auth login`;
37
+ }
38
+ catch {
39
+ throw new Error('It seems there was a problem logging in. Please run "flyctl auth login" and try again.');
40
+ }
41
+ }
42
+ export async function ensureFlyReady() {
43
+ const doesFlyctlExist = await flyctlExists();
44
+ if (!doesFlyctlExist) {
45
+ throw new Error(`The Fly.io CLI is not available on this system.\nPlease install the flyctl here: https://fly.io/docs/hands-on/install-flyctl`);
46
+ }
47
+ await ensureUserLoggedIn();
48
+ }
49
+ export async function assertRegionIsValid(region) {
50
+ const validRegion = await regionExists(region);
51
+ if (!validRegion) {
52
+ const flyRegionsCommand = `${getFullCommandName(executeFlyCommand)} platform regions --context server`;
53
+ throw new Error([
54
+ `Invalid region code ${region}. Please specify a valid 3 character region id: https://fly.io/docs/reference/regions`,
55
+ `You can also run "${flyRegionsCommand}".`,
56
+ ].join("\n"));
57
+ }
58
+ }
59
+ async function regionExists(regionCode) {
60
+ const proc = await $ `flyctl platform regions -j`.verbose(false);
61
+ const regions = FlyRegionListSchema.parse(proc.json());
62
+ return regions.some((r) => {
63
+ return r.code === regionCode;
64
+ });
65
+ }
66
+ export async function secretExists(secretName) {
67
+ const proc = await $ `flyctl secrets list -j`;
68
+ const secrets = FlySecretListSchema.parse(proc.json());
69
+ return secrets.some((s) => {
70
+ const name = "name" in s ? s.name : s.Name;
71
+ return name === secretName;
72
+ });
73
+ }
74
+ //# sourceMappingURL=flyCli.js.map
@@ -0,0 +1,121 @@
1
+ import { Command, Option } from "commander";
2
+ import { assertValidWaspProject, assertWaspProjectDirIsAbsoluteAndPresent, } from "../../common/waspProject.js";
3
+ import { cmd as cmdFn } from "./commands/cmd/cmd.js";
4
+ import { createDb as createDbFn } from "./commands/createDb/createDb.js";
5
+ import { deploy as deployFn } from "./commands/deploy/deploy.js";
6
+ import { launch as launchFn } from "./commands/launch/launch.js";
7
+ import { setup as setupFn } from "./commands/setup/setup.js";
8
+ import { ContextOption } from "./CommonOps.js";
9
+ import { assertRegionIsValid, ensureFlyReady } from "./flyCli.js";
10
+ import { assertFlyTomlDirIsAbsoluteAndPresent } from "./tomlFile.js";
11
+ class FlyCommand extends Command {
12
+ addBasenameArgument() {
13
+ return this.argument("<basename>", "base app name to use on Fly.io (must be unique)");
14
+ }
15
+ addRegionArgument() {
16
+ return this.argument("<region>", "3 letter deployment region to use on Fly.io");
17
+ }
18
+ addDbOptions() {
19
+ return this.option("--vm-size <vmSize>", "flyctl postgres create option", "shared-cpu-1x")
20
+ .option("--initial-cluster-size <initialClusterSize>", "flyctl postgres create option", "1")
21
+ .option("--volume-size <volumeSize>", "flyctl postgres create option", "1")
22
+ .option("--db-image <dbImage>", "custom Docker image for the PostgreSQL database");
23
+ }
24
+ addLocalBuildOption() {
25
+ return this.option("--build-locally", "build Docker containers locally instead of remotely", false);
26
+ }
27
+ addSecretsOptions() {
28
+ function collect(value, previous) {
29
+ return previous.concat([value]);
30
+ }
31
+ return this.option("--server-secret <serverSecret>", "secret to set on the server app (of form FOO=BAR)", collect, []).option("--client-secret <clientSecret>", "secret to set on the client app (of form FOO=BAR)", collect, []);
32
+ }
33
+ }
34
+ const flyLaunchCommand = makeFlyLaunchCommand();
35
+ export const flySetupCommand = makeFlySetupCommand();
36
+ export const createFlyDbCommand = makeCreateFlyDbCommand();
37
+ export const flyDeployCommand = makeFlyDeployCommand();
38
+ export const executeFlyCommand = makeExecuteFlyCommand();
39
+ export function createFlyCommand() {
40
+ const fly = new Command("fly")
41
+ .description("Create and deploy Wasp apps on Fly.io")
42
+ .addCommand(flyLaunchCommand)
43
+ .addCommand(flySetupCommand)
44
+ .addCommand(createFlyDbCommand)
45
+ .addCommand(flyDeployCommand)
46
+ .addCommand(executeFlyCommand)
47
+ .allowUnknownOption();
48
+ // Add global options and hooks to all commands.
49
+ // Add these hooks before any command-specific ones so they run first.
50
+ // NOTE: When we add another provider, consider pulling `--wasp-exe` and `--wasp-project-dir`
51
+ // up as a global option that every provider can use (if possible).
52
+ fly.commands.forEach((cmd) => {
53
+ cmd
54
+ .addOption(new Option("--wasp-exe <path>", "Wasp executable (either on PATH or absolute path)")
55
+ .hideHelp()
56
+ .makeOptionMandatory())
57
+ .addOption(new Option("--wasp-project-dir <dir>", "absolute path to Wasp project dir")
58
+ .hideHelp()
59
+ .makeOptionMandatory())
60
+ .option("--fly-toml-dir <dir>", "absolute path to dir where fly.toml files live")
61
+ .option("--org <org>", "Fly org to use (with commands that support it)")
62
+ .hook("preAction", async (cmd) => {
63
+ const { waspProjectDir, waspExe, flyTomlDir } = cmd.opts();
64
+ await ensureFlyReady();
65
+ assertWaspProjectDirIsAbsoluteAndPresent(waspProjectDir);
66
+ if (flyTomlDir !== undefined) {
67
+ assertFlyTomlDirIsAbsoluteAndPresent(flyTomlDir);
68
+ }
69
+ await assertValidWaspProject(waspProjectDir, waspExe);
70
+ });
71
+ });
72
+ // Add command-specific hooks.
73
+ flyLaunchCommand.hook("preAction", (_thisCommand, actionCommand) => assertRegionIsValid(actionCommand.args[1]));
74
+ flySetupCommand.hook("preAction", (_thisCommand, actionCommand) => assertRegionIsValid(actionCommand.args[1]));
75
+ createFlyDbCommand.hook("preAction", (_thisCommand, actionCommand) => assertRegionIsValid(actionCommand.args[0]));
76
+ return fly;
77
+ }
78
+ function makeFlyLaunchCommand() {
79
+ return new FlyCommand("launch")
80
+ .description("Launch a new app on Fly.io (calls setup, create-db, and deploy)")
81
+ .addBasenameArgument()
82
+ .addRegionArgument()
83
+ .addDbOptions()
84
+ .addLocalBuildOption()
85
+ .addSecretsOptions()
86
+ .action(launchFn);
87
+ }
88
+ function makeFlySetupCommand() {
89
+ return new FlyCommand("setup")
90
+ .description("Set up a new app on Fly.io (this does not deploy it)")
91
+ .addBasenameArgument()
92
+ .addRegionArgument()
93
+ .addSecretsOptions()
94
+ .action(setupFn);
95
+ }
96
+ function makeFlyDeployCommand() {
97
+ return new FlyCommand("deploy")
98
+ .description("(Re-)Deploy existing app to Fly.io")
99
+ .option("--skip-client", "do not deploy the web client")
100
+ .option("--skip-server", "do not deploy the server")
101
+ .addLocalBuildOption()
102
+ .action(deployFn);
103
+ }
104
+ function makeExecuteFlyCommand() {
105
+ return new FlyCommand("cmd")
106
+ .description("Run arbitrary flyctl commands for server or client")
107
+ .argument("<cmd...>", "flyctl command to run in server/client context")
108
+ .addOption(new Option("--context <context>", "client or server context")
109
+ .choices(Object.values(ContextOption))
110
+ .makeOptionMandatory())
111
+ .action(cmdFn)
112
+ .allowUnknownOption();
113
+ }
114
+ function makeCreateFlyDbCommand() {
115
+ return new FlyCommand("create-db")
116
+ .description("Creates a Postgres DB and attaches it to the server app")
117
+ .addRegionArgument()
118
+ .addDbOptions()
119
+ .action(createDbFn);
120
+ }
121
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,37 @@
1
+ import * as z from "zod";
2
+ const FlyRegionSchema = z.object({
3
+ code: z.string(),
4
+ name: z.string(),
5
+ });
6
+ const FlyRegionSchemaLegacy = z
7
+ .object({
8
+ Code: z.string(),
9
+ Name: z.string(),
10
+ })
11
+ .transform((data) => ({
12
+ code: data.Code,
13
+ name: data.Name,
14
+ }));
15
+ export const FlyRegionListSchema = z.union([
16
+ // version before flyctl v0.3.121
17
+ z.array(FlyRegionSchemaLegacy),
18
+ // version as of flyctl v0.3.121
19
+ z.array(FlyRegionSchema),
20
+ // version as of flyctl v0.3.214
21
+ z
22
+ .object({
23
+ Regions: z.array(FlyRegionSchema),
24
+ })
25
+ .transform((data) => data.Regions),
26
+ ]);
27
+ export const FlySecretListSchema = z.union([
28
+ // current version
29
+ z.array(z.object({
30
+ Name: z.string(),
31
+ })),
32
+ // not the output yet, but just in case they update the command in the future
33
+ z.array(z.object({
34
+ name: z.string(),
35
+ })),
36
+ ]);
37
+ //# sourceMappingURL=jsonOutputSchemas.js.map
@@ -0,0 +1,65 @@
1
+ import fs from "fs";
2
+ import path from "node:path";
3
+ import toml from "toml";
4
+ import { assertDirExists, assertDirPathIsAbsolute, } from "../../common/validation.js";
5
+ export function getTomlFilePaths(cmdOptions) {
6
+ const baseDir = cmdOptions.flyTomlDir || cmdOptions.waspProjectDir;
7
+ return {
8
+ serverTomlPath: path.join(baseDir, "fly-server.toml"),
9
+ clientTomlPath: path.join(baseDir, "fly-client.toml"),
10
+ };
11
+ }
12
+ export function serverTomlExistsInProject(paths) {
13
+ return fs.existsSync(paths.serverTomlPath);
14
+ }
15
+ export function copyLocalServerTomlToProject(paths) {
16
+ fs.copyFileSync("fly.toml", paths.serverTomlPath);
17
+ }
18
+ export function copyProjectServerTomlLocally(paths) {
19
+ fs.copyFileSync(paths.serverTomlPath, "fly.toml");
20
+ }
21
+ export function clientTomlExistsInProject(paths) {
22
+ return fs.existsSync(paths.clientTomlPath);
23
+ }
24
+ export function copyLocalClientTomlToProject(paths) {
25
+ fs.copyFileSync("fly.toml", paths.clientTomlPath);
26
+ }
27
+ export function copyProjectClientTomlLocally(paths) {
28
+ fs.copyFileSync(paths.clientTomlPath, "fly.toml");
29
+ }
30
+ export function localTomlExists() {
31
+ return fs.existsSync("fly.toml");
32
+ }
33
+ export function deleteLocalToml() {
34
+ if (localTomlExists()) {
35
+ fs.unlinkSync("fly.toml");
36
+ }
37
+ }
38
+ export function getAppNameFromToml(path) {
39
+ const content = fs.readFileSync(path, "utf8");
40
+ const data = toml.parse(content);
41
+ return data.app;
42
+ }
43
+ export function getInferredBasenameFromServerToml(paths) {
44
+ const serverFlyAppName = getAppNameFromToml(paths.serverTomlPath);
45
+ return serverFlyAppName.replace("-server", "");
46
+ }
47
+ export function getInferredBasenameFromClientToml(paths) {
48
+ const clientFlyAppName = getAppNameFromToml(paths.clientTomlPath);
49
+ return clientFlyAppName.replace("-client", "");
50
+ }
51
+ export function replaceLineInLocalToml(searchValue, replaceValue) {
52
+ const content = fs.readFileSync("fly.toml", "utf8");
53
+ const updatedContent = content.replace(searchValue, replaceValue);
54
+ fs.writeFileSync("fly.toml", updatedContent);
55
+ }
56
+ export function doesLocalTomlContainLine(searchValue) {
57
+ const content = fs.readFileSync("fly.toml", "utf8");
58
+ return content.search(searchValue) !== -1;
59
+ }
60
+ export function assertFlyTomlDirIsAbsoluteAndPresent(flyTomlDirPath) {
61
+ const dirNameInError = "TOML directory";
62
+ assertDirPathIsAbsolute(flyTomlDirPath, dirNameInError);
63
+ assertDirExists(flyTomlDirPath, dirNameInError);
64
+ }
65
+ //# sourceMappingURL=tomlFile.js.map
@@ -0,0 +1,11 @@
1
+ import { createRailwayClientServiceName, createRailwayDbServiceName, createRailwayServerServiceName, } from "./railwayService/nameGenerator.js";
2
+ export function createDeploymentInstructions(projectName, cmdOptions) {
3
+ return Object.freeze({
4
+ projectName,
5
+ cmdOptions,
6
+ clientServiceName: createRailwayClientServiceName(projectName),
7
+ serverServiceName: createRailwayServerServiceName(projectName),
8
+ dbServiceName: createRailwayDbServiceName(),
9
+ });
10
+ }
11
+ //# sourceMappingURL=DeploymentInstructions.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=brandedTypes.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DeployCmdOptions.js.map
@@ -0,0 +1,22 @@
1
+ import { buildClient } from "../../../../common/clientApp.js";
2
+ import { displayWaspRocketImage, waspSays, } from "../../../../common/terminal.js";
3
+ import { clientAppPort, serverAppPort } from "../../ports.js";
4
+ import { generateServiceUrl } from "../../railwayService/url.js";
5
+ import { deployServiceWithStreamingLogs, ServiceDeploymentStatus, } from "./common.js";
6
+ export async function deployClient({ cmdOptions: options, serverServiceName, clientServiceName, }) {
7
+ waspSays("Deploying your client now...");
8
+ const serverServiceUrl = await generateServiceUrl(serverServiceName, serverAppPort, options);
9
+ const clientBuildArtefactsDir = await buildClient(serverServiceUrl, options);
10
+ const deploymentStatus = await deployServiceWithStreamingLogs({
11
+ name: clientServiceName,
12
+ dirToDeploy: clientBuildArtefactsDir,
13
+ }, options);
14
+ displayWaspRocketImage();
15
+ const clientUrl = await generateServiceUrl(clientServiceName, clientAppPort, options);
16
+ const messages = {
17
+ [ServiceDeploymentStatus.SUCCESS]: `Client has been deployed! Your Wasp app is accessible at: ${clientUrl}`,
18
+ [ServiceDeploymentStatus.FAILED_TO_STREAM_LOGS]: `Client deployment started, but failed to stream build logs. Your Wasp app should be accessible at: ${clientUrl}`,
19
+ };
20
+ waspSays(messages[deploymentStatus]);
21
+ }
22
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1,40 @@
1
+ import { ProcessOutput } from "zx";
2
+ import { waspSays } from "../../../../common/terminal.js";
3
+ import { createCommandWithCwd } from "../../../../common/zx.js";
4
+ export var ServiceDeploymentStatus;
5
+ (function (ServiceDeploymentStatus) {
6
+ ServiceDeploymentStatus["SUCCESS"] = "SUCCESS";
7
+ ServiceDeploymentStatus["FAILED_TO_STREAM_LOGS"] = "FAILED_TO_STREAM_LOGS";
8
+ })(ServiceDeploymentStatus || (ServiceDeploymentStatus = {}));
9
+ export async function deployServiceWithStreamingLogs(service, options) {
10
+ try {
11
+ const railwayCli = createCommandWithCwd(options.railwayExe, options.waspProjectDir);
12
+ await railwayCli([
13
+ "up",
14
+ service.dirToDeploy,
15
+ "--service",
16
+ service.name,
17
+ "--no-gitignore",
18
+ // This option fixes a Railway CLI quirk to package the
19
+ // service directory as the root of the deployment.
20
+ "--path-as-root",
21
+ // This option enables service build logs streaming.
22
+ "--ci",
23
+ ]);
24
+ return ServiceDeploymentStatus.SUCCESS;
25
+ }
26
+ catch (e) {
27
+ if (isFailedToStreamLogsError(e)) {
28
+ // The deployment most likely didn't fail, we only failed to stream the logs.
29
+ // This can happen with the Railway CLI, and the deployment might still be successful.
30
+ waspSays(`Failed to stream build log for service "${service.name}". This sometimes happens with the Railway CLI. Please check the Railway dashboard for build logs.`);
31
+ return ServiceDeploymentStatus.FAILED_TO_STREAM_LOGS;
32
+ }
33
+ throw new Error(`Error deploying service "${service.name}", please check the command output.`);
34
+ }
35
+ }
36
+ function isFailedToStreamLogsError(error) {
37
+ return (error instanceof ProcessOutput &&
38
+ error.stderr.includes("Failed to stream build log"));
39
+ }
40
+ //# sourceMappingURL=common.js.map