@wasp.sh/wasp-cli-darwin-x64-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.
- package/data/Cli/starters/README.md +22 -0
- package/data/Cli/starters/basic/README.md +35 -0
- package/data/Cli/starters/basic/eslint.config.js +24 -0
- package/data/Cli/starters/basic/main.wasp +100 -0
- package/data/Cli/starters/basic/package.json +29 -0
- package/data/Cli/starters/basic/postcss.config.js +6 -0
- package/data/Cli/starters/basic/schema.prisma +42 -0
- package/data/Cli/starters/basic/src/App.css +13 -0
- package/data/Cli/starters/basic/src/App.tsx +12 -0
- package/data/Cli/starters/basic/src/assets/logo.svg +1 -0
- package/data/Cli/starters/basic/src/auth/AuthLayout.tsx +10 -0
- package/data/Cli/starters/basic/src/auth/email/EmailVerificationPage.tsx +19 -0
- package/data/Cli/starters/basic/src/auth/email/LoginPage.tsx +27 -0
- package/data/Cli/starters/basic/src/auth/email/PasswordResetPage.tsx +19 -0
- package/data/Cli/starters/basic/src/auth/email/RequestPasswordResetPage.tsx +10 -0
- package/data/Cli/starters/basic/src/auth/email/SignupPage.tsx +34 -0
- package/data/Cli/starters/basic/src/auth/email/userSignupFields.ts +13 -0
- package/data/Cli/starters/basic/src/shared/components/Button.tsx +90 -0
- package/data/Cli/starters/basic/src/shared/components/Dialog.tsx +85 -0
- package/data/Cli/starters/basic/src/shared/components/Header.tsx +39 -0
- package/data/Cli/starters/basic/src/shared/components/Input.tsx +36 -0
- package/data/Cli/starters/basic/src/shared/components/Portal.tsx +26 -0
- package/data/Cli/starters/basic/src/tags/actions.ts +23 -0
- package/data/Cli/starters/basic/src/tags/components/ColorRadioButton.tsx +44 -0
- package/data/Cli/starters/basic/src/tags/components/ColorRadioButtons.tsx +59 -0
- package/data/Cli/starters/basic/src/tags/components/CreateTagDialog.tsx +50 -0
- package/data/Cli/starters/basic/src/tags/components/CreateTagForm.tsx +100 -0
- package/data/Cli/starters/basic/src/tags/components/TagLabel.tsx +55 -0
- package/data/Cli/starters/basic/src/tags/components/colors.ts +8 -0
- package/data/Cli/starters/basic/src/tags/queries.ts +14 -0
- package/data/Cli/starters/basic/src/tasks/TasksPage.tsx +19 -0
- package/data/Cli/starters/basic/src/tasks/actions.ts +71 -0
- package/data/Cli/starters/basic/src/tasks/components/CreateTaskForm.tsx +103 -0
- package/data/Cli/starters/basic/src/tasks/components/TaskList.tsx +68 -0
- package/data/Cli/starters/basic/src/tasks/components/TaskListItem.tsx +56 -0
- package/data/Cli/starters/basic/src/tasks/queries.ts +21 -0
- package/data/Cli/starters/basic/tailwind.config.js +30 -0
- package/data/Cli/starters/basic/vite.config.ts +7 -0
- package/data/Cli/starters/minimal/main.wasp +14 -0
- package/data/Cli/starters/minimal/package.json +18 -0
- package/data/Cli/starters/minimal/schema.prisma +10 -0
- package/data/Cli/starters/minimal/src/Main.css +103 -0
- package/data/Cli/starters/minimal/src/MainPage.tsx +37 -0
- package/data/Cli/starters/minimal/src/assets/logo.svg +1 -0
- package/data/Cli/starters/minimal/vite.config.ts +7 -0
- package/data/Cli/starters/skeleton/public/favicon.ico +0 -0
- package/data/Cli/starters/skeleton/src/vite-env.d.ts +7 -0
- package/data/Cli/starters/skeleton/tsconfig.json +28 -0
- package/data/Generator/templates/Dockerfile +78 -0
- package/data/Generator/templates/db/schema.prisma +24 -0
- package/data/Generator/templates/dockerignore +2 -0
- package/data/Generator/templates/react-app/README.md +21 -0
- package/data/Generator/templates/react-app/gitignore +23 -0
- package/data/Generator/templates/react-app/index.html +22 -0
- package/data/Generator/templates/react-app/netlify.toml +8 -0
- package/data/Generator/templates/react-app/npmrc +1 -0
- package/data/Generator/templates/react-app/package.json +31 -0
- package/data/Generator/templates/react-app/public/manifest.json +15 -0
- package/data/Generator/templates/react-app/src/auth/pages/OAuthCallback.tsx +93 -0
- package/data/Generator/templates/react-app/src/auth/pages/createAuthRequiredPage.jsx +40 -0
- package/data/Generator/templates/react-app/src/components/DefaultRootErrorBoundary.tsx +16 -0
- package/data/Generator/templates/react-app/src/components/FullPageWrapper.tsx +21 -0
- package/data/Generator/templates/react-app/src/components/Loader.module.css +37 -0
- package/data/Generator/templates/react-app/src/components/Loader.tsx +12 -0
- package/data/Generator/templates/react-app/src/components/Message.tsx +86 -0
- package/data/Generator/templates/react-app/src/index.tsx +47 -0
- package/data/Generator/templates/react-app/src/logo.png +0 -0
- package/data/Generator/templates/react-app/src/router.tsx +59 -0
- package/data/Generator/templates/react-app/src/test/vitest/setup.ts +8 -0
- package/data/Generator/templates/react-app/src/utils.js +3 -0
- package/data/Generator/templates/react-app/src/vite-env.d.ts +1 -0
- package/data/Generator/templates/react-app/tsconfig.app.json +28 -0
- package/data/Generator/templates/react-app/tsconfig.json +11 -0
- package/data/Generator/templates/react-app/tsconfig.vite.json +16 -0
- package/data/Generator/templates/react-app/vite/detectServerImports.ts +53 -0
- package/data/Generator/templates/react-app/vite/validateEnv.ts +45 -0
- package/data/Generator/templates/react-app/vite.config.ts +74 -0
- package/data/Generator/templates/sdk/wasp/api/events.ts +11 -0
- package/data/Generator/templates/sdk/wasp/api/index.ts +136 -0
- package/data/Generator/templates/sdk/wasp/auth/email/actions/login.ts +13 -0
- package/data/Generator/templates/sdk/wasp/auth/email/actions/passwordReset.ts +22 -0
- package/data/Generator/templates/sdk/wasp/auth/email/actions/signup.ts +20 -0
- package/data/Generator/templates/sdk/wasp/auth/email/actions/verifyEmail.ts +14 -0
- package/data/Generator/templates/sdk/wasp/auth/email/index.ts +5 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/Auth.module.css +16 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/Auth.tsx +94 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/ForgotPassword.tsx +18 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/Login.tsx +18 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/ResetPassword.tsx +18 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/Signup.tsx +24 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/VerifyEmail.tsx +18 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/Form.module.css +99 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/Form.tsx +74 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/Message.module.css +22 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/Message.tsx +34 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/auth-styles.css +30 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/common/LoginSignupForm.module.css +55 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/common/LoginSignupForm.tsx +291 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/ForgotPasswordForm.tsx +52 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/ResetPasswordForm.tsx +82 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/VerifyEmailForm.tsx +43 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/useEmail.ts +33 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialButton.module.css +33 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialButton.tsx +14 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialIcons.module.css +4 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialIcons.tsx +74 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/usernameAndPassword/useUsernameAndPassword.ts +29 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/util.ts +16 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/types.ts +77 -0
- package/data/Generator/templates/sdk/wasp/auth/helpers/_Provider.tsx +17 -0
- package/data/Generator/templates/sdk/wasp/auth/helpers/user.ts +15 -0
- package/data/Generator/templates/sdk/wasp/auth/index.ts +9 -0
- package/data/Generator/templates/sdk/wasp/auth/jwt.ts +22 -0
- package/data/Generator/templates/sdk/wasp/auth/logout.ts +18 -0
- package/data/Generator/templates/sdk/wasp/auth/lucia.ts +53 -0
- package/data/Generator/templates/sdk/wasp/auth/password.ts +36 -0
- package/data/Generator/templates/sdk/wasp/auth/providers/index.ts +9 -0
- package/data/Generator/templates/sdk/wasp/auth/providers/types.ts +68 -0
- package/data/Generator/templates/sdk/wasp/auth/session.ts +78 -0
- package/data/Generator/templates/sdk/wasp/auth/types.ts +2 -0
- package/data/Generator/templates/sdk/wasp/auth/useAuth.ts +37 -0
- package/data/Generator/templates/sdk/wasp/auth/user.ts +63 -0
- package/data/Generator/templates/sdk/wasp/auth/username/actions/login.ts +13 -0
- package/data/Generator/templates/sdk/wasp/auth/username/actions/signup.ts +20 -0
- package/data/Generator/templates/sdk/wasp/auth/username/index.ts +2 -0
- package/data/Generator/templates/sdk/wasp/auth/utils.ts +369 -0
- package/data/Generator/templates/sdk/wasp/auth/validation.ts +83 -0
- package/data/Generator/templates/sdk/wasp/client/auth/discord.ts +2 -0
- package/data/Generator/templates/sdk/wasp/client/auth/email.ts +5 -0
- package/data/Generator/templates/sdk/wasp/client/auth/github.ts +2 -0
- package/data/Generator/templates/sdk/wasp/client/auth/google.ts +2 -0
- package/data/Generator/templates/sdk/wasp/client/auth/index.ts +29 -0
- package/data/Generator/templates/sdk/wasp/client/auth/keycloak.ts +2 -0
- package/data/Generator/templates/sdk/wasp/client/auth/slack.ts +2 -0
- package/data/Generator/templates/sdk/wasp/client/auth/ui.ts +32 -0
- package/data/Generator/templates/sdk/wasp/client/auth/username.ts +2 -0
- package/data/Generator/templates/sdk/wasp/client/config.ts +15 -0
- package/data/Generator/templates/sdk/wasp/client/crud/_crud.ts +89 -0
- package/data/Generator/templates/sdk/wasp/client/crud/index.ts +4 -0
- package/data/Generator/templates/sdk/wasp/client/crud/operationsHelpers.ts +21 -0
- package/data/Generator/templates/sdk/wasp/client/env/schema.ts +22 -0
- package/data/Generator/templates/sdk/wasp/client/env.ts +5 -0
- package/data/Generator/templates/sdk/wasp/client/hooks.ts +19 -0
- package/data/Generator/templates/sdk/wasp/client/index.ts +17 -0
- package/data/Generator/templates/sdk/wasp/client/operations/actions/core.ts +49 -0
- package/data/Generator/templates/sdk/wasp/client/operations/actions/index.ts +13 -0
- package/data/Generator/templates/sdk/wasp/client/operations/hooks.ts +347 -0
- package/data/Generator/templates/sdk/wasp/client/operations/index.ts +22 -0
- package/data/Generator/templates/sdk/wasp/client/operations/internal/index.ts +22 -0
- package/data/Generator/templates/sdk/wasp/client/operations/internal/resources.js +83 -0
- package/data/Generator/templates/sdk/wasp/client/operations/internal/updateHandlersMap.js +37 -0
- package/data/Generator/templates/sdk/wasp/client/operations/queries/core.ts +91 -0
- package/data/Generator/templates/sdk/wasp/client/operations/queries/index.ts +16 -0
- package/data/Generator/templates/sdk/wasp/client/operations/queryClient.ts +34 -0
- package/data/Generator/templates/sdk/wasp/client/operations/rpc.ts +96 -0
- package/data/Generator/templates/sdk/wasp/client/router/Link.tsx +21 -0
- package/data/Generator/templates/sdk/wasp/client/router/index.ts +53 -0
- package/data/Generator/templates/sdk/wasp/client/router/linkHelpers.ts +48 -0
- package/data/Generator/templates/sdk/wasp/client/router/types.ts +98 -0
- package/data/Generator/templates/sdk/wasp/client/test/index.ts +1 -0
- package/data/Generator/templates/sdk/wasp/client/test/vitest/helpers.tsx +95 -0
- package/data/Generator/templates/sdk/wasp/client/webSocket/WebSocketProvider.tsx +77 -0
- package/data/Generator/templates/sdk/wasp/client/webSocket/index.ts +39 -0
- package/data/Generator/templates/sdk/wasp/core/auth.ts +40 -0
- package/data/Generator/templates/sdk/wasp/core/serialization/custom-register.ts +21 -0
- package/data/Generator/templates/sdk/wasp/core/serialization/index.ts +56 -0
- package/data/Generator/templates/sdk/wasp/core/serialization/prisma.ts +54 -0
- package/data/Generator/templates/sdk/wasp/core/storage.ts +50 -0
- package/data/Generator/templates/sdk/wasp/dev/index.ts +19 -0
- package/data/Generator/templates/sdk/wasp/entities/index.ts +28 -0
- package/data/Generator/templates/sdk/wasp/env/index.ts +9 -0
- package/data/Generator/templates/sdk/wasp/env/validation.ts +38 -0
- package/data/Generator/templates/sdk/wasp/package.json +152 -0
- package/data/Generator/templates/sdk/wasp/prisma-runtime-library.d.ts +17 -0
- package/data/Generator/templates/sdk/wasp/scripts/copy-assets.js +14 -0
- package/data/Generator/templates/sdk/wasp/server/HttpError.ts +30 -0
- package/data/Generator/templates/sdk/wasp/server/_types/index.ts +105 -0
- package/data/Generator/templates/sdk/wasp/server/_types/taggedEntities.ts +26 -0
- package/data/Generator/templates/sdk/wasp/server/api/index.ts +44 -0
- package/data/Generator/templates/sdk/wasp/server/auth/email/index.ts +20 -0
- package/data/Generator/templates/sdk/wasp/server/auth/email/utils.ts +104 -0
- package/data/Generator/templates/sdk/wasp/server/auth/hooks.ts +188 -0
- package/data/Generator/templates/sdk/wasp/server/auth/index.ts +49 -0
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/index.ts +38 -0
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/oneTimeCode.ts +50 -0
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/provider.ts +20 -0
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/discord.ts +22 -0
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/github.ts +20 -0
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/google.ts +22 -0
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/keycloak.ts +23 -0
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/slack.ts +22 -0
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/redirect.ts +43 -0
- package/data/Generator/templates/sdk/wasp/server/auth/user.ts +148 -0
- package/data/Generator/templates/sdk/wasp/server/auth/username.ts +1 -0
- package/data/Generator/templates/sdk/wasp/server/config.ts +47 -0
- package/data/Generator/templates/sdk/wasp/server/crud/_operationTypes.ts +134 -0
- package/data/Generator/templates/sdk/wasp/server/crud/index.ts +5 -0
- package/data/Generator/templates/sdk/wasp/server/dbClient.ts +35 -0
- package/data/Generator/templates/sdk/wasp/server/email/core/helpers.ts +40 -0
- package/data/Generator/templates/sdk/wasp/server/email/core/index.ts +17 -0
- package/data/Generator/templates/sdk/wasp/server/email/core/providers/dummy.ts +34 -0
- package/data/Generator/templates/sdk/wasp/server/email/core/providers/mailgun.ts +31 -0
- package/data/Generator/templates/sdk/wasp/server/email/core/providers/sendgrid.ts +44 -0
- package/data/Generator/templates/sdk/wasp/server/email/core/providers/smtp.ts +29 -0
- package/data/Generator/templates/sdk/wasp/server/email/core/types.ts +59 -0
- package/data/Generator/templates/sdk/wasp/server/email/index.ts +39 -0
- package/data/Generator/templates/sdk/wasp/server/env.ts +173 -0
- package/data/Generator/templates/sdk/wasp/server/index.ts +17 -0
- package/data/Generator/templates/sdk/wasp/server/jobs/_job.ts +39 -0
- package/data/Generator/templates/sdk/wasp/server/jobs/core/job.ts +28 -0
- package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/index.ts +3 -0
- package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/pgBoss.ts +76 -0
- package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/pgBossJob.ts +230 -0
- package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/types.ts +9 -0
- package/data/Generator/templates/sdk/wasp/server/jobs/index.ts +5 -0
- package/data/Generator/templates/sdk/wasp/server/middleware/globalMiddleware.ts +8 -0
- package/data/Generator/templates/sdk/wasp/server/middleware/index.ts +1 -0
- package/data/Generator/templates/sdk/wasp/server/operations/actions/index.ts +41 -0
- package/data/Generator/templates/sdk/wasp/server/operations/actions/types.ts +35 -0
- package/data/Generator/templates/sdk/wasp/server/operations/index.ts +13 -0
- package/data/Generator/templates/sdk/wasp/server/operations/queries/index.ts +42 -0
- package/data/Generator/templates/sdk/wasp/server/operations/queries/types.ts +36 -0
- package/data/Generator/templates/sdk/wasp/server/operations/wrappers.ts +242 -0
- package/data/Generator/templates/sdk/wasp/server/types/index.ts +11 -0
- package/data/Generator/templates/sdk/wasp/server/utils.ts +38 -0
- package/data/Generator/templates/sdk/wasp/server/webSocket/index.ts +57 -0
- package/data/Generator/templates/sdk/wasp/tsconfig.json +102 -0
- package/data/Generator/templates/sdk/wasp/universal/ansiColors.ts +14 -0
- package/data/Generator/templates/sdk/wasp/universal/predicates.ts +3 -0
- package/data/Generator/templates/sdk/wasp/universal/types.ts +74 -0
- package/data/Generator/templates/sdk/wasp/universal/url.ts +9 -0
- package/data/Generator/templates/sdk/wasp/universal/validators.ts +21 -0
- package/data/Generator/templates/sdk/wasp/vite-env.d.ts +1 -0
- package/data/Generator/templates/server/README.md +1 -0
- package/data/Generator/templates/server/gitignore +6 -0
- package/data/Generator/templates/server/nodemon.json +13 -0
- package/data/Generator/templates/server/npmrc +1 -0
- package/data/Generator/templates/server/package.json +27 -0
- package/data/Generator/templates/server/rollup.config.js +44 -0
- package/data/Generator/templates/server/src/actions/_action.ts +18 -0
- package/data/Generator/templates/server/src/app.js +36 -0
- package/data/Generator/templates/server/src/auth/hooks.ts +135 -0
- package/data/Generator/templates/server/src/auth/providers/config/discord.ts +69 -0
- package/data/Generator/templates/server/src/auth/providers/config/email.ts +96 -0
- package/data/Generator/templates/server/src/auth/providers/config/github.ts +78 -0
- package/data/Generator/templates/server/src/auth/providers/config/google.ts +65 -0
- package/data/Generator/templates/server/src/auth/providers/config/keycloak.ts +67 -0
- package/data/Generator/templates/server/src/auth/providers/config/slack.ts +65 -0
- package/data/Generator/templates/server/src/auth/providers/config/username.ts +33 -0
- package/data/Generator/templates/server/src/auth/providers/email/login.ts +66 -0
- package/data/Generator/templates/server/src/auth/providers/email/requestPasswordReset.ts +74 -0
- package/data/Generator/templates/server/src/auth/providers/email/resetPassword.ts +48 -0
- package/data/Generator/templates/server/src/auth/providers/email/signup.ts +165 -0
- package/data/Generator/templates/server/src/auth/providers/email/verifyEmail.ts +42 -0
- package/data/Generator/templates/server/src/auth/providers/index.ts +32 -0
- package/data/Generator/templates/server/src/auth/providers/oauth/config.ts +19 -0
- package/data/Generator/templates/server/src/auth/providers/oauth/cookies.ts +35 -0
- package/data/Generator/templates/server/src/auth/providers/oauth/handler.ts +130 -0
- package/data/Generator/templates/server/src/auth/providers/oauth/oneTimeCode.ts +39 -0
- package/data/Generator/templates/server/src/auth/providers/oauth/state.ts +144 -0
- package/data/Generator/templates/server/src/auth/providers/oauth/types.ts +7 -0
- package/data/Generator/templates/server/src/auth/providers/oauth/user.ts +139 -0
- package/data/Generator/templates/server/src/auth/providers/username/login.ts +64 -0
- package/data/Generator/templates/server/src/auth/providers/username/signup.ts +59 -0
- package/data/Generator/templates/server/src/crud/_operations.ts +184 -0
- package/data/Generator/templates/server/src/dbSeed.ts +37 -0
- package/data/Generator/templates/server/src/jobs/_job.ts +9 -0
- package/data/Generator/templates/server/src/jobs/core/allJobs.ts +8 -0
- package/data/Generator/templates/server/src/middleware/globalMiddleware.ts +45 -0
- package/data/Generator/templates/server/src/middleware/index.ts +1 -0
- package/data/Generator/templates/server/src/middleware/operations.ts +28 -0
- package/data/Generator/templates/server/src/queries/_query.ts +18 -0
- package/data/Generator/templates/server/src/routes/apis/index.ts +67 -0
- package/data/Generator/templates/server/src/routes/auth/index.js +16 -0
- package/data/Generator/templates/server/src/routes/auth/logout.ts +12 -0
- package/data/Generator/templates/server/src/routes/auth/me.ts +10 -0
- package/data/Generator/templates/server/src/routes/crud/_crud.ts +46 -0
- package/data/Generator/templates/server/src/routes/crud/index.ts +12 -0
- package/data/Generator/templates/server/src/routes/index.js +55 -0
- package/data/Generator/templates/server/src/routes/operations/_action.js +5 -0
- package/data/Generator/templates/server/src/routes/operations/_query.js +5 -0
- package/data/Generator/templates/server/src/routes/operations/index.js +18 -0
- package/data/Generator/templates/server/src/server.ts +76 -0
- package/data/Generator/templates/server/src/views/wrong-port.ts +123 -0
- package/data/Generator/templates/server/src/webSocket/initialization.ts +59 -0
- package/data/Generator/templates/server/tsconfig.json +41 -0
- package/data/Lsp/templates/ts/action.fn.ts +12 -0
- package/data/Lsp/templates/ts/operation.fn.js +7 -0
- package/data/Lsp/templates/ts/page.component.jsx +9 -0
- package/data/Lsp/templates/ts/query.fn.ts +12 -0
- package/data/packages/deploy/dist/common/brandedTypes.js +2 -0
- package/data/packages/deploy/dist/common/clientApp.js +26 -0
- package/data/packages/deploy/dist/common/commander.js +8 -0
- package/data/packages/deploy/dist/common/random.js +5 -0
- package/data/packages/deploy/dist/common/terminal.js +24 -0
- package/data/packages/deploy/dist/common/typeUtils.js +2 -0
- package/data/packages/deploy/dist/common/validation.js +14 -0
- package/data/packages/deploy/dist/common/waspBuild.js +21 -0
- package/data/packages/deploy/dist/common/waspProject.js +43 -0
- package/data/packages/deploy/dist/common/zx.js +10 -0
- package/data/packages/deploy/dist/index.js +30 -0
- package/data/packages/deploy/dist/providers/fly/CommonCmdOptions.js +2 -0
- package/data/packages/deploy/dist/providers/fly/CommonOps.js +36 -0
- package/data/packages/deploy/dist/providers/fly/DeploymentInstructions.js +12 -0
- package/data/packages/deploy/dist/providers/fly/commands/cmd/CmdCmdOptions.js +2 -0
- package/data/packages/deploy/dist/providers/fly/commands/cmd/cmd.js +29 -0
- package/data/packages/deploy/dist/providers/fly/commands/createDb/CreateDbCmdOptions.js +2 -0
- package/data/packages/deploy/dist/providers/fly/commands/createDb/createDb.js +55 -0
- package/data/packages/deploy/dist/providers/fly/commands/deploy/DeployCmdOptions.js +2 -0
- package/data/packages/deploy/dist/providers/fly/commands/deploy/deploy.js +88 -0
- package/data/packages/deploy/dist/providers/fly/commands/launch/LaunchCmdOptions.js +2 -0
- package/data/packages/deploy/dist/providers/fly/commands/launch/launch.js +17 -0
- package/data/packages/deploy/dist/providers/fly/commands/setup/SetupCmdOptions.js +2 -0
- package/data/packages/deploy/dist/providers/fly/commands/setup/setup.js +141 -0
- package/data/packages/deploy/dist/providers/fly/flyAppUrl.js +4 -0
- package/data/packages/deploy/dist/providers/fly/flyCli.js +74 -0
- package/data/packages/deploy/dist/providers/fly/index.js +121 -0
- package/data/packages/deploy/dist/providers/fly/jsonOutputSchemas.js +37 -0
- package/data/packages/deploy/dist/providers/fly/tomlFile.js +65 -0
- package/data/packages/deploy/dist/providers/railway/DeploymentInstructions.js +11 -0
- package/data/packages/deploy/dist/providers/railway/brandedTypes.js +2 -0
- package/data/packages/deploy/dist/providers/railway/commands/deploy/DeployCmdOptions.js +2 -0
- package/data/packages/deploy/dist/providers/railway/commands/deploy/client.js +22 -0
- package/data/packages/deploy/dist/providers/railway/commands/deploy/common.js +40 -0
- package/data/packages/deploy/dist/providers/railway/commands/deploy/index.js +57 -0
- package/data/packages/deploy/dist/providers/railway/commands/deploy/server.js +17 -0
- package/data/packages/deploy/dist/providers/railway/commands/launch/LaunchCmdOptions.js +2 -0
- package/data/packages/deploy/dist/providers/railway/commands/launch/launch.js +9 -0
- package/data/packages/deploy/dist/providers/railway/commands/setup/SetupCmdOptions.js +2 -0
- package/data/packages/deploy/dist/providers/railway/commands/setup/setup.js +146 -0
- package/data/packages/deploy/dist/providers/railway/index.js +83 -0
- package/data/packages/deploy/dist/providers/railway/jsonOutputSchemas.js +19 -0
- package/data/packages/deploy/dist/providers/railway/ports.js +6 -0
- package/data/packages/deploy/dist/providers/railway/railwayCli.js +85 -0
- package/data/packages/deploy/dist/providers/railway/railwayProject/RailwayProject.js +14 -0
- package/data/packages/deploy/dist/providers/railway/railwayProject/cli.js +80 -0
- package/data/packages/deploy/dist/providers/railway/railwayProject/index.js +48 -0
- package/data/packages/deploy/dist/providers/railway/railwayService/nameGenerator.js +24 -0
- package/data/packages/deploy/dist/providers/railway/railwayService/url.js +32 -0
- package/data/packages/deploy/package-lock.json +3536 -0
- package/data/packages/deploy/package.json +29 -0
- package/data/packages/prisma/dist/format.js +35 -0
- package/data/packages/prisma/dist/index.js +33 -0
- package/data/packages/prisma/package-lock.json +5101 -0
- package/data/packages/prisma/package.json +30 -0
- package/data/packages/studio/dist/index.js +48 -0
- package/data/packages/studio/dist/public/assets/Flow-b5112d3d.js +26 -0
- package/data/packages/studio/dist/public/assets/index-17ce6ed4.css +1 -0
- package/data/packages/studio/dist/public/assets/index-62a9d21a.js +120 -0
- package/data/packages/studio/dist/public/index.html +14 -0
- package/data/packages/studio/package-lock.json +1866 -0
- package/data/packages/studio/package.json +33 -0
- package/data/packages/ts-inspect/dist/exports.js +82 -0
- package/data/packages/ts-inspect/dist/index.js +28 -0
- package/data/packages/ts-inspect/package-lock.json +4947 -0
- package/data/packages/ts-inspect/package.json +31 -0
- package/data/packages/wasp-config/dist/__tests__/appAnalyzer.unit.test.d.ts +2 -0
- package/data/packages/wasp-config/dist/__tests__/appAnalyzer.unit.test.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/__tests__/appAnalyzer.unit.test.js +59 -0
- package/data/packages/wasp-config/dist/__tests__/cli.unit.test.d.ts +2 -0
- package/data/packages/wasp-config/dist/__tests__/cli.unit.test.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/__tests__/cli.unit.test.js +65 -0
- package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.integration.test.d.ts +2 -0
- package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.integration.test.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.integration.test.js +126 -0
- package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.unit.test.d.ts +2 -0
- package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.unit.test.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.unit.test.js +743 -0
- package/data/packages/wasp-config/dist/__tests__/testFixtures.d.ts +224 -0
- package/data/packages/wasp-config/dist/__tests__/testFixtures.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/__tests__/testFixtures.js +656 -0
- package/data/packages/wasp-config/dist/__tests__/testFixtures.test-d.d.ts +2 -0
- package/data/packages/wasp-config/dist/__tests__/testFixtures.test-d.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/__tests__/testFixtures.test-d.js +57 -0
- package/data/packages/wasp-config/dist/src/_private.d.ts +2 -0
- package/data/packages/wasp-config/dist/src/_private.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/_private.js +1 -0
- package/data/packages/wasp-config/dist/src/appAnalyzer.d.ts +16 -0
- package/data/packages/wasp-config/dist/src/appAnalyzer.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/appAnalyzer.js +34 -0
- package/data/packages/wasp-config/dist/src/appSpec.d.ts +223 -0
- package/data/packages/wasp-config/dist/src/appSpec.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/appSpec.js +6 -0
- package/data/packages/wasp-config/dist/src/branded.d.ts +7 -0
- package/data/packages/wasp-config/dist/src/branded.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/branded.js +1 -0
- package/data/packages/wasp-config/dist/src/cli.d.ts +6 -0
- package/data/packages/wasp-config/dist/src/cli.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/cli.js +24 -0
- package/data/packages/wasp-config/dist/src/index.d.ts +8 -0
- package/data/packages/wasp-config/dist/src/index.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/index.js +1 -0
- package/data/packages/wasp-config/dist/src/mapTsAppSpecToAppSpecDecls.d.ts +38 -0
- package/data/packages/wasp-config/dist/src/mapTsAppSpecToAppSpecDecls.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/mapTsAppSpecToAppSpecDecls.js +294 -0
- package/data/packages/wasp-config/dist/src/publicApi/App.d.ts +24 -0
- package/data/packages/wasp-config/dist/src/publicApi/App.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/publicApi/App.js +75 -0
- package/data/packages/wasp-config/dist/src/publicApi/tsAppSpec.d.ts +171 -0
- package/data/packages/wasp-config/dist/src/publicApi/tsAppSpec.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/publicApi/tsAppSpec.js +1 -0
- package/data/packages/wasp-config/dist/src/run.d.ts +3 -0
- package/data/packages/wasp-config/dist/src/run.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/run.js +18 -0
- package/data/packages/wasp-config/package-lock.json +3992 -0
- package/data/packages/wasp-config/package.json +39 -0
- package/main.js +9 -0
- package/package.json +1 -0
- package/readme.md +3 -0
- package/wasp-bin +0 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This template gets rendered when you visit the root route on the server (i.e.
|
|
3
|
+
http://localhost:3001/) in development mode.
|
|
4
|
+
|
|
5
|
+
Some of the data passed to this template is known at runtime and not compile
|
|
6
|
+
time, so we need to craft the string at runtime with a JS template string. We
|
|
7
|
+
explicitly do not use Wasp mustaches here so we don't have to reason about two
|
|
8
|
+
different templating systems.
|
|
9
|
+
|
|
10
|
+
For now, we don't serve any other static files in our routes, so all the
|
|
11
|
+
resources needed (CSS, images, etc.) must be inlined into the file.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// The /* HTML */ comment is a hint to `prettier` to format this string as HTML.
|
|
15
|
+
export const makeWrongPortPage = ({
|
|
16
|
+
appName,
|
|
17
|
+
frontendUrl,
|
|
18
|
+
}: {
|
|
19
|
+
appName: string;
|
|
20
|
+
frontendUrl: string;
|
|
21
|
+
}): string => /* HTML */ `
|
|
22
|
+
<!doctype html>
|
|
23
|
+
<html lang="en">
|
|
24
|
+
<head>
|
|
25
|
+
<meta charset="UTF-8" />
|
|
26
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
27
|
+
<title>${appName} API Server</title>
|
|
28
|
+
|
|
29
|
+
<style>
|
|
30
|
+
:root {
|
|
31
|
+
--page-background: #f0f0f0;
|
|
32
|
+
--wrapper-background: white;
|
|
33
|
+
--wasp-yellow: #f5cc05;
|
|
34
|
+
--main-link-color: #1a73e8;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.wrapper {
|
|
38
|
+
font-family: system-ui, sans-serif;
|
|
39
|
+
width: 90%;
|
|
40
|
+
max-width: 600px;
|
|
41
|
+
margin: 2em auto;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
h1,
|
|
45
|
+
h2 {
|
|
46
|
+
margin: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.main-link {
|
|
50
|
+
text-align: center;
|
|
51
|
+
font-size: 1.5em;
|
|
52
|
+
font-weight: bold;
|
|
53
|
+
font-family: ui-monospace, monospace;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.icon {
|
|
57
|
+
width: 1em;
|
|
58
|
+
height: 1em;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.wasp-title {
|
|
62
|
+
margin: 0.5em 0;
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
gap: 0.2em;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
body {
|
|
69
|
+
background-color: var(--page-background);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
main {
|
|
73
|
+
background-color: var(--wrapper-background);
|
|
74
|
+
padding: 1.5em;
|
|
75
|
+
border-radius: 10px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
a,
|
|
79
|
+
a:visited {
|
|
80
|
+
color: var(--main-link-color);
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
83
|
+
</head>
|
|
84
|
+
<body>
|
|
85
|
+
<div class="wrapper">
|
|
86
|
+
<header>
|
|
87
|
+
<h2 class="wasp-title">
|
|
88
|
+
<svg viewBox="0 0 161 161" class="icon" alt="Wasp Logo">
|
|
89
|
+
<circle cx="80.5" cy="80.5" r="79" fill="var(--wasp-yellow)" />
|
|
90
|
+
<path
|
|
91
|
+
d="M88.67 114.33h2.91q6 0 7.87-1.89c1.22-1.25 1.83-3.9 1.83-7.93V93.89c0-4.46.65-7.7 1.93-9.73s3.51-3.43 6.67-4.2q-4.69-1.08-6.65-4.12c-1.3-2-2-5.28-2-9.77V55.44q0-6-1.83-7.93t-7.87-1.88h-2.86V39.5h2.65q10.65 0 14.24 3.15t3.59 12.62v10.29c0 4.28.77 7.24 2.29 8.87s4.3 2.44 8.32 2.44h2.74V83h-2.74q-6 0-8.32 2.49c-1.52 1.65-2.29 4.64-2.29 9v10.25q0 9.47-3.59 12.64t-14.24 3.12h-2.65Z"
|
|
92
|
+
/>
|
|
93
|
+
<path d="M38.5 85.15h37.33v7.58H38.5Zm0-17.88h37.33v7.49H38.5Z" />
|
|
94
|
+
</svg>
|
|
95
|
+
Wasp
|
|
96
|
+
</h2>
|
|
97
|
+
</header>
|
|
98
|
+
|
|
99
|
+
<main>
|
|
100
|
+
<h1>${appName} API Server</h1>
|
|
101
|
+
<p>
|
|
102
|
+
The server is up and running. This is the backend part of your Wasp
|
|
103
|
+
application.
|
|
104
|
+
</p>
|
|
105
|
+
<p>
|
|
106
|
+
If you want to visit your frontend application, go to this URL in
|
|
107
|
+
your browser:
|
|
108
|
+
</p>
|
|
109
|
+
<a href="${frontendUrl}" class="main-link">
|
|
110
|
+
<p>${frontendUrl}</p>
|
|
111
|
+
</a>
|
|
112
|
+
<p>
|
|
113
|
+
<small>
|
|
114
|
+
This message is shown because you are running the server in
|
|
115
|
+
development mode. In production, this route would not show
|
|
116
|
+
anything.
|
|
117
|
+
</small>
|
|
118
|
+
</p>
|
|
119
|
+
</main>
|
|
120
|
+
</div>
|
|
121
|
+
</body>
|
|
122
|
+
</html>
|
|
123
|
+
`;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{{={= =}=}}
|
|
2
|
+
|
|
3
|
+
import http from 'http'
|
|
4
|
+
import { Server, Socket } from 'socket.io'
|
|
5
|
+
import type { ServerType } from 'wasp/server/webSocket'
|
|
6
|
+
|
|
7
|
+
import { config, prisma } from 'wasp/server'
|
|
8
|
+
|
|
9
|
+
{=# isAuthEnabled =}
|
|
10
|
+
import { getSessionAndUserFromSessionId } from 'wasp/auth/session'
|
|
11
|
+
import { makeAuthUserIfPossible } from 'wasp/auth/user'
|
|
12
|
+
{=/ isAuthEnabled =}
|
|
13
|
+
|
|
14
|
+
{=& userWebSocketFn.importStatement =}
|
|
15
|
+
|
|
16
|
+
// Initializes the WebSocket server and invokes the user's WebSocket function.
|
|
17
|
+
export async function init(server: http.Server): Promise<void> {
|
|
18
|
+
// TODO: In the future, we can consider allowing a clustering option.
|
|
19
|
+
// Ref: https://github.com/wasp-lang/wasp/issues/1228
|
|
20
|
+
|
|
21
|
+
// TODO: Uncomment the type annotation once we make sure that the types between different packages are aligned.
|
|
22
|
+
// Ref: https://github.com/wasp-lang/wasp/issues/2726
|
|
23
|
+
const io /* : ServerType */ = new Server(server, {
|
|
24
|
+
cors: {
|
|
25
|
+
origin: config.frontendUrl,
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
{=# isAuthEnabled =}
|
|
30
|
+
io.use(addUserToSocketDataIfAuthenticated)
|
|
31
|
+
{=/ isAuthEnabled =}
|
|
32
|
+
|
|
33
|
+
const context = {
|
|
34
|
+
entities: {
|
|
35
|
+
{=# allEntities =}
|
|
36
|
+
{= name =}: prisma.{= prismaIdentifier =},
|
|
37
|
+
{=/ allEntities =}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
await ({= userWebSocketFn.importIdentifier =} as any)(io, context)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
{=# isAuthEnabled =}
|
|
45
|
+
async function addUserToSocketDataIfAuthenticated(socket: Socket, next: (err?: Error) => void) {
|
|
46
|
+
const sessionId = socket.handshake.auth.sessionId
|
|
47
|
+
if (sessionId) {
|
|
48
|
+
try {
|
|
49
|
+
const sessionAndUser = await getSessionAndUserFromSessionId(sessionId)
|
|
50
|
+
const user = sessionAndUser ? makeAuthUserIfPossible(sessionAndUser.user) : null
|
|
51
|
+
socket.data = {
|
|
52
|
+
...socket.data,
|
|
53
|
+
user,
|
|
54
|
+
}
|
|
55
|
+
} catch (err) { }
|
|
56
|
+
}
|
|
57
|
+
next()
|
|
58
|
+
}
|
|
59
|
+
{=/ isAuthEnabled =}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{{={= =}=}}
|
|
2
|
+
{
|
|
3
|
+
"extends": "@tsconfig/node{= majorNodeVersion =}/tsconfig.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
// Overriding this until we implement more complete TypeScript support.
|
|
6
|
+
"strict": false,
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
|
|
9
|
+
// This property currently doesn't matter because we haven't been running
|
|
10
|
+
// TSC on server code since https://github.com/wasp-lang/wasp/pull/1714.
|
|
11
|
+
//
|
|
12
|
+
// When we start running TSC again (after we fix all current errors and
|
|
13
|
+
// make project references work for the TS config), then I believe the
|
|
14
|
+
// correct configuration is "rootDir": "." (the project reference should
|
|
15
|
+
// take care of the user code), but we should double-check.
|
|
16
|
+
//
|
|
17
|
+
// Before changing this property, ensure you're aware of the implications:
|
|
18
|
+
// - https://github.com/wasp-lang/wasp/pull/1584#discussion_r1404019301
|
|
19
|
+
// - https://github.com/wasp-lang/wasp/pull/1713/files#diff-58191eecd9cc55f71c73de89420df8b1866dce38ad35f4ef0f6f8874616eda77R32
|
|
20
|
+
"rootDir": ".",
|
|
21
|
+
// Enable source map for debugging
|
|
22
|
+
"sourceMap": true,
|
|
23
|
+
// We are using rollup and extensionless imports, our module and module
|
|
24
|
+
// resolution reflect that.
|
|
25
|
+
"module": "preserve",
|
|
26
|
+
"moduleResolution": "bundler",
|
|
27
|
+
// The remaining settings should match the extended nodeXY/tsconfig.json, but I kept
|
|
28
|
+
// them here to be explicit.
|
|
29
|
+
"esModuleInterop": true,
|
|
30
|
+
"skipLibCheck": true,
|
|
31
|
+
"outDir": "dist",
|
|
32
|
+
"target": "es2022",
|
|
33
|
+
"lib" : ["es2023"]
|
|
34
|
+
},
|
|
35
|
+
"include": [
|
|
36
|
+
"src"
|
|
37
|
+
],
|
|
38
|
+
"references": [
|
|
39
|
+
{ "path": "{= srcTsConfigPath =}" }
|
|
40
|
+
]
|
|
41
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type {{upperDeclName}} } from 'wasp/server/operations'
|
|
2
|
+
|
|
3
|
+
type {{upperDeclName}}Input = void
|
|
4
|
+
type {{upperDeclName}}Output = void
|
|
5
|
+
|
|
6
|
+
{{#named?}}export {{/named?}}const {{name}}: {{upperDeclName}}<{{upperDeclName}}Input, {{upperDeclName}}Output> = async (args, context) => {
|
|
7
|
+
// Implementation goes here
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
{{#default?}}
|
|
11
|
+
export default {{name}}
|
|
12
|
+
{{/default?}}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type {{upperDeclName}} } from 'wasp/server/operations'
|
|
2
|
+
|
|
3
|
+
type {{upperDeclName}}Input = void
|
|
4
|
+
type {{upperDeclName}}Output = void
|
|
5
|
+
|
|
6
|
+
{{#named?}}export {{/named?}}const {{name}}: {{upperDeclName}}<{{upperDeclName}}Input, {{upperDeclName}}Output> = async (args, context) => {
|
|
7
|
+
// Implementation goes here
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
{{#default?}}
|
|
11
|
+
export default {{name}}
|
|
12
|
+
{{/default?}}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { waspSays } from "./terminal.js";
|
|
2
|
+
import { getClientBuildArtefactsDir, getClientBuildDir, } from "./waspProject.js";
|
|
3
|
+
import { createCommandWithCwd } from "./zx.js";
|
|
4
|
+
export const serverUrlEnvVarName = "REACT_APP_API_URL";
|
|
5
|
+
export async function buildClient(defaultServerAppUrl, { waspProjectDir }) {
|
|
6
|
+
waspSays("Building web client for production...");
|
|
7
|
+
waspSays(`If you configured a custom domain for the server, you should run the command with an env variable: ${serverUrlEnvVarName}=https://serverUrl.com <command>`);
|
|
8
|
+
const clientBuildDir = getClientBuildDir(waspProjectDir);
|
|
9
|
+
const npmCli = createCommandWithCwd("npm", clientBuildDir);
|
|
10
|
+
await npmCli(["install"]);
|
|
11
|
+
const serverUrl = getServerAppUrlEnvValue() ?? defaultServerAppUrl;
|
|
12
|
+
await npmCli(["run", "build"], {
|
|
13
|
+
env: {
|
|
14
|
+
...process.env,
|
|
15
|
+
[serverUrlEnvVarName]: serverUrl,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
return getClientBuildArtefactsDir(waspProjectDir);
|
|
19
|
+
}
|
|
20
|
+
// We allow users to specify the server URL that the client will connect to
|
|
21
|
+
// using an environment variable.
|
|
22
|
+
// TODO: improve this API to allow specifying the server URL via options or a config file.
|
|
23
|
+
function getServerAppUrlEnvValue() {
|
|
24
|
+
return process.env[serverUrlEnvVarName];
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=clientApp.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function getFullCommandName(command) {
|
|
2
|
+
const fullCommandNameParts = [command.name()];
|
|
3
|
+
for (let parent = command.parent; parent; parent = parent.parent) {
|
|
4
|
+
fullCommandNameParts.unshift(parent.name());
|
|
5
|
+
}
|
|
6
|
+
return fullCommandNameParts.join(" ");
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=commander.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { chalk } from "zx";
|
|
2
|
+
export function waspSays(str) {
|
|
3
|
+
const formattedStr = str
|
|
4
|
+
.split("\n")
|
|
5
|
+
.map((line) => `🚀 ${line}`)
|
|
6
|
+
.join("\n");
|
|
7
|
+
console.log(chalk.yellow(formattedStr));
|
|
8
|
+
}
|
|
9
|
+
export function displayWaspRocketImage() {
|
|
10
|
+
// Escaping backslashes makes it look weird here, but it works in console.
|
|
11
|
+
const asciiArt = `
|
|
12
|
+
|
|
13
|
+
__
|
|
14
|
+
// \\
|
|
15
|
+
\\\\_/ //
|
|
16
|
+
_ -(||)(')
|
|
17
|
+
\\ \\____///_____
|
|
18
|
+
#########[==__DEPLOYED__}
|
|
19
|
+
/_/
|
|
20
|
+
|
|
21
|
+
`;
|
|
22
|
+
console.log(asciiArt);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=terminal.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
export function assertDirPathIsAbsolute(dirPath, dirNameInError) {
|
|
4
|
+
if (!path.isAbsolute(dirPath)) {
|
|
5
|
+
throw new Error(`The ${dirNameInError} path must be absolute.`);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export function assertDirExists(dirPath, dirNameInError) {
|
|
9
|
+
const dirExists = fs.existsSync(dirPath);
|
|
10
|
+
if (!dirExists) {
|
|
11
|
+
throw new Error(`The ${dirNameInError} does not exist.`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { waspSays } from "./terminal.js";
|
|
2
|
+
import { createCommandWithCwd } from "./zx.js";
|
|
3
|
+
export const ensureWaspProjectIsBuilt = createEnsureWaspProjectIsBuilt();
|
|
4
|
+
function createEnsureWaspProjectIsBuilt() {
|
|
5
|
+
async function buildWaspApp({ waspProjectDir, waspExe, }) {
|
|
6
|
+
waspSays("Building your Wasp app...");
|
|
7
|
+
const waspCli = createCommandWithCwd(waspExe, waspProjectDir);
|
|
8
|
+
return waspCli(["build"]);
|
|
9
|
+
}
|
|
10
|
+
// We want to build the Wasp project only once per CLI invocation.
|
|
11
|
+
// Sometimes `ensureWaspProjectIsBuilt` is called multiple times
|
|
12
|
+
// (e.g. in `setup` command, we call it and then again when deploying).
|
|
13
|
+
let cachedWaspBuildResult = undefined;
|
|
14
|
+
return (...params) => {
|
|
15
|
+
if (cachedWaspBuildResult === undefined) {
|
|
16
|
+
cachedWaspBuildResult = buildWaspApp(...params);
|
|
17
|
+
}
|
|
18
|
+
return cachedWaspBuildResult;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=waspBuild.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { assertDirExists, assertDirPathIsAbsolute } from "./validation.js";
|
|
4
|
+
import { createCommandWithCwd } from "./zx.js";
|
|
5
|
+
export async function assertValidWaspProject(waspProjectDir, waspExe) {
|
|
6
|
+
const waspCli = createCommandWithCwd(waspExe, waspProjectDir);
|
|
7
|
+
const result = await waspCli(["info"], {
|
|
8
|
+
quiet: true,
|
|
9
|
+
nothrow: true,
|
|
10
|
+
});
|
|
11
|
+
if (result.exitCode !== 0) {
|
|
12
|
+
throw new Error([
|
|
13
|
+
"The supplied Wasp directory does not appear to be a valid Wasp project.",
|
|
14
|
+
"Please double check your Wasp project directory.",
|
|
15
|
+
].join("\n"));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function assertWaspProjectDirIsAbsoluteAndPresent(waspProjectDir) {
|
|
19
|
+
const dirNameInError = "Wasp project directory";
|
|
20
|
+
assertDirPathIsAbsolute(waspProjectDir, dirNameInError);
|
|
21
|
+
assertDirExists(waspProjectDir, dirNameInError);
|
|
22
|
+
}
|
|
23
|
+
export function buildDirExists(waspProjectDir) {
|
|
24
|
+
return fs.existsSync(getWaspBuildDir(waspProjectDir));
|
|
25
|
+
}
|
|
26
|
+
export function getServerBuildArtefactsDir(waspProjectDir) {
|
|
27
|
+
return getServerBuildDir(waspProjectDir);
|
|
28
|
+
}
|
|
29
|
+
export function getClientBuildArtefactsDir(waspProjectDir) {
|
|
30
|
+
const clientBuildDir = getClientBuildDir(waspProjectDir);
|
|
31
|
+
return path.join(clientBuildDir, "build");
|
|
32
|
+
}
|
|
33
|
+
function getWaspBuildDir(waspProjectDir) {
|
|
34
|
+
return path.join(waspProjectDir, ".wasp", "build");
|
|
35
|
+
}
|
|
36
|
+
export function getServerBuildDir(waspProjectDir) {
|
|
37
|
+
// The server is built from the Wasp build directory.
|
|
38
|
+
return path.join(getWaspBuildDir(waspProjectDir), ".");
|
|
39
|
+
}
|
|
40
|
+
export function getClientBuildDir(waspProjectDir) {
|
|
41
|
+
return path.join(getWaspBuildDir(waspProjectDir), "web-app");
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=waspProject.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { $, syncProcessCwd } from "zx";
|
|
4
|
+
import { waspSays } from "./common/terminal.js";
|
|
5
|
+
import { createFlyCommand } from "./providers/fly/index.js";
|
|
6
|
+
import { createRailwayCommand } from "./providers/railway/index.js";
|
|
7
|
+
const program = new Command();
|
|
8
|
+
program
|
|
9
|
+
.name("wasp deploy")
|
|
10
|
+
.description("CLI for deploying Wasp apps to various clouds")
|
|
11
|
+
.allowUnknownOption();
|
|
12
|
+
// We want to see the output of commands by default
|
|
13
|
+
$.verbose = true;
|
|
14
|
+
// Keeps the process.cwd() in sync with the internal $ current working directory
|
|
15
|
+
// if it is changed via cd().
|
|
16
|
+
syncProcessCwd();
|
|
17
|
+
program.addCommand(createFlyCommand());
|
|
18
|
+
program.addCommand(createRailwayCommand());
|
|
19
|
+
try {
|
|
20
|
+
// parseAsync not only parses the command line arguments but also
|
|
21
|
+
// executes the command and it will throw an error if the command fails.
|
|
22
|
+
await program.parseAsync();
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
if (error instanceof Error && error.message) {
|
|
26
|
+
waspSays(error.message);
|
|
27
|
+
}
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { cd } from "zx";
|
|
2
|
+
import { getClientBuildDir, getServerBuildDir, } from "../../common/waspProject.js";
|
|
3
|
+
import { clientTomlExistsInProject, copyLocalClientTomlToProject, copyLocalServerTomlToProject, copyProjectClientTomlLocally, copyProjectServerTomlLocally, serverTomlExistsInProject, } from "./tomlFile.js";
|
|
4
|
+
export var ContextOption;
|
|
5
|
+
(function (ContextOption) {
|
|
6
|
+
ContextOption["Client"] = "client";
|
|
7
|
+
ContextOption["Server"] = "server";
|
|
8
|
+
})(ContextOption || (ContextOption = {}));
|
|
9
|
+
export function getCommonOps(context, waspProjectDir, paths) {
|
|
10
|
+
const commonOps = {
|
|
11
|
+
[ContextOption.Client]: createClientCommonOps(waspProjectDir, paths),
|
|
12
|
+
[ContextOption.Server]: createServerCommonOps(waspProjectDir, paths),
|
|
13
|
+
};
|
|
14
|
+
return commonOps[context];
|
|
15
|
+
}
|
|
16
|
+
function createClientCommonOps(waspProjectDir, paths) {
|
|
17
|
+
return {
|
|
18
|
+
waspProjectDir,
|
|
19
|
+
paths,
|
|
20
|
+
cdToBuildDir: () => cd(getClientBuildDir(waspProjectDir)),
|
|
21
|
+
tomlExistsInProject: () => clientTomlExistsInProject(paths),
|
|
22
|
+
copyLocalTomlToProject: () => copyLocalClientTomlToProject(paths),
|
|
23
|
+
copyProjectTomlLocally: () => copyProjectClientTomlLocally(paths),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function createServerCommonOps(waspProjectDir, paths) {
|
|
27
|
+
return {
|
|
28
|
+
waspProjectDir,
|
|
29
|
+
paths,
|
|
30
|
+
cdToBuildDir: () => cd(getServerBuildDir(waspProjectDir)),
|
|
31
|
+
tomlExistsInProject: () => serverTomlExistsInProject(paths),
|
|
32
|
+
copyLocalTomlToProject: () => copyLocalServerTomlToProject(paths),
|
|
33
|
+
copyProjectTomlLocally: () => copyProjectServerTomlLocally(paths),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=CommonOps.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function createDeploymentInstructions({ baseName, cmdOptions, tomlFilePaths, region, }) {
|
|
2
|
+
return Object.freeze({
|
|
3
|
+
baseName,
|
|
4
|
+
region,
|
|
5
|
+
cmdOptions,
|
|
6
|
+
tomlFilePaths,
|
|
7
|
+
clientFlyAppName: `${baseName}-client`,
|
|
8
|
+
serverFlyAppName: `${baseName}-server`,
|
|
9
|
+
dbName: `${baseName}-db`,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=DeploymentInstructions.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { $ } from "zx";
|
|
2
|
+
import { waspSays } from "../../../../common/terminal.js";
|
|
3
|
+
import { ensureWaspProjectIsBuilt } from "../../../../common/waspBuild.js";
|
|
4
|
+
import { getCommonOps } from "../../CommonOps.js";
|
|
5
|
+
import { deleteLocalToml, getTomlFilePaths, localTomlExists, } from "../../tomlFile.js";
|
|
6
|
+
// Runs a command by copying down the project toml files, executing it, and copying it back up (just in case).
|
|
7
|
+
// If the toml file does not exist, some commands will not run with additional args (e.g. -a <appname>).
|
|
8
|
+
export async function cmd(flyctlArgs, cmdOptions) {
|
|
9
|
+
if (cmdOptions.org) {
|
|
10
|
+
flyctlArgs.push("--org", cmdOptions.org);
|
|
11
|
+
}
|
|
12
|
+
waspSays(`Running ${cmdOptions.context} command: flyctl ${flyctlArgs.join(" ")}`);
|
|
13
|
+
await ensureWaspProjectIsBuilt(cmdOptions);
|
|
14
|
+
const tomlFilePaths = getTomlFilePaths(cmdOptions);
|
|
15
|
+
const commonOps = getCommonOps(cmdOptions.context, cmdOptions.waspProjectDir, tomlFilePaths);
|
|
16
|
+
await runFlyctlCommand(commonOps, flyctlArgs);
|
|
17
|
+
}
|
|
18
|
+
async function runFlyctlCommand(commonOps, flyctlArgs) {
|
|
19
|
+
commonOps.cdToBuildDir();
|
|
20
|
+
deleteLocalToml();
|
|
21
|
+
if (commonOps.tomlExistsInProject()) {
|
|
22
|
+
commonOps.copyProjectTomlLocally();
|
|
23
|
+
}
|
|
24
|
+
await $ `flyctl ${flyctlArgs}`;
|
|
25
|
+
if (localTomlExists()) {
|
|
26
|
+
commonOps.copyLocalTomlToProject();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=cmd.js.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { $, ProcessOutput, question } from "zx";
|
|
2
|
+
import { getFullCommandName } from "../../../../common/commander.js";
|
|
3
|
+
import { waspSays } from "../../../../common/terminal.js";
|
|
4
|
+
import { createDeploymentInstructions } from "../../DeploymentInstructions.js";
|
|
5
|
+
import { flyDeployCommand, flySetupCommand } from "../../index.js";
|
|
6
|
+
import { getInferredBasenameFromServerToml, getTomlFilePaths, serverTomlExistsInProject, } from "../../tomlFile.js";
|
|
7
|
+
export async function createDb(region, cmdOptions) {
|
|
8
|
+
waspSays("Creating your DB on Fly.io!");
|
|
9
|
+
const tomlFilePaths = getTomlFilePaths(cmdOptions);
|
|
10
|
+
if (!serverTomlExistsInProject(tomlFilePaths)) {
|
|
11
|
+
throw new Error(`${tomlFilePaths.serverTomlPath} missing. Skipping DB creation. Perhaps you need to run "${getFullCommandName(flySetupCommand)}" first?`);
|
|
12
|
+
}
|
|
13
|
+
const inferredBaseName = getInferredBasenameFromServerToml(tomlFilePaths);
|
|
14
|
+
const deploymentInstructions = createDeploymentInstructions({
|
|
15
|
+
baseName: inferredBaseName,
|
|
16
|
+
region,
|
|
17
|
+
cmdOptions,
|
|
18
|
+
tomlFilePaths,
|
|
19
|
+
});
|
|
20
|
+
// Creates a DB, waits for it to come up, then links it to the app.
|
|
21
|
+
// The attachment process shares the DATABASE_URL secret.
|
|
22
|
+
const createArgs = [
|
|
23
|
+
"--name",
|
|
24
|
+
deploymentInstructions.dbName,
|
|
25
|
+
"--region",
|
|
26
|
+
deploymentInstructions.region,
|
|
27
|
+
"--vm-size",
|
|
28
|
+
cmdOptions.vmSize,
|
|
29
|
+
"--initial-cluster-size",
|
|
30
|
+
cmdOptions.initialClusterSize,
|
|
31
|
+
"--volume-size",
|
|
32
|
+
cmdOptions.volumeSize,
|
|
33
|
+
];
|
|
34
|
+
if (cmdOptions.dbImage) {
|
|
35
|
+
createArgs.push("--image-ref", cmdOptions.dbImage);
|
|
36
|
+
}
|
|
37
|
+
if (deploymentInstructions.cmdOptions.org) {
|
|
38
|
+
createArgs.push("--org", deploymentInstructions.cmdOptions.org);
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
await $ `flyctl postgres create ${createArgs}`;
|
|
42
|
+
await $ `flyctl postgres attach ${deploymentInstructions.dbName} -a ${deploymentInstructions.serverFlyAppName}`;
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
if (error instanceof ProcessOutput) {
|
|
46
|
+
throw new Error(error.stderr.trim());
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
await question("Please take note of your database credentials above, as they will not be available in plaintext again. Press any key to continue.");
|
|
53
|
+
waspSays(`Don't forget to deploy your app by running "${getFullCommandName(flyDeployCommand)}".`);
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=createDb.js.map
|