@cedarjs/cli 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +706 -0
- package/dist/commands/build.js +54 -0
- package/dist/commands/buildHandler.js +134 -0
- package/dist/commands/check.js +28 -0
- package/dist/commands/console.js +13 -0
- package/dist/commands/consoleHandler.js +68 -0
- package/dist/commands/deploy/baremetal/SshExecutor.js +41 -0
- package/dist/commands/deploy/baremetal/baremetalHandler.js +558 -0
- package/dist/commands/deploy/baremetal.js +89 -0
- package/dist/commands/deploy/flightcontrol.js +40 -0
- package/dist/commands/deploy/flightcontrolHandler.js +58 -0
- package/dist/commands/deploy/helpers/deployBuilder.js +25 -0
- package/dist/commands/deploy/helpers/deployHandler.js +31 -0
- package/dist/commands/deploy/netlify.js +21 -0
- package/dist/commands/deploy/packing/nft.js +61 -0
- package/dist/commands/deploy/render.js +37 -0
- package/dist/commands/deploy/renderHandler.js +70 -0
- package/dist/commands/deploy/serverless.js +51 -0
- package/dist/commands/deploy/serverlessHandler.js +211 -0
- package/dist/commands/deploy/vercel.js +21 -0
- package/dist/commands/deploy.js +21 -0
- package/dist/commands/destroy/cell/cell.js +12 -0
- package/dist/commands/destroy/cell/cellHandler.js +10 -0
- package/dist/commands/destroy/component/component.js +15 -0
- package/dist/commands/destroy/component/componentHandler.js +10 -0
- package/dist/commands/destroy/directive/directive.js +14 -0
- package/dist/commands/destroy/directive/directiveHandler.js +12 -0
- package/dist/commands/destroy/function/function.js +20 -0
- package/dist/commands/destroy/function/functionHandler.js +10 -0
- package/dist/commands/destroy/handlerHelpers.js +34 -0
- package/dist/commands/destroy/helpers.js +22 -0
- package/dist/commands/destroy/layout/layout.js +12 -0
- package/dist/commands/destroy/layout/layoutHandler.js +10 -0
- package/dist/commands/destroy/page/page.js +20 -0
- package/dist/commands/destroy/page/pageHandler.js +51 -0
- package/dist/commands/destroy/scaffold/scaffold.js +16 -0
- package/dist/commands/destroy/scaffold/scaffoldHandler.js +105 -0
- package/dist/commands/destroy/sdl/sdl.js +16 -0
- package/dist/commands/destroy/sdl/sdlHandler.js +33 -0
- package/dist/commands/destroy/service/service.js +10 -0
- package/dist/commands/destroy/service/serviceHandler.js +17 -0
- package/dist/commands/destroy.js +25 -0
- package/dist/commands/dev.js +47 -0
- package/dist/commands/devHandler.js +202 -0
- package/dist/commands/exec.js +38 -0
- package/dist/commands/execHandler.js +180 -0
- package/dist/commands/experimental/setupInngest.js +28 -0
- package/dist/commands/experimental/setupInngestHandler.js +46 -0
- package/dist/commands/experimental/setupOpentelemetry.js +34 -0
- package/dist/commands/experimental/setupOpentelemetryHandler.js +215 -0
- package/dist/commands/experimental/setupReactCompiler.js +28 -0
- package/dist/commands/experimental/setupReactCompilerHandler.js +124 -0
- package/dist/commands/experimental/setupRsc.js +28 -0
- package/dist/commands/experimental/setupRscHandler.js +408 -0
- package/dist/commands/experimental/setupStreamingSsr.js +28 -0
- package/dist/commands/experimental/setupStreamingSsrHandler.js +208 -0
- package/dist/commands/experimental/templates/opentelemetry.ts.template +55 -0
- package/dist/commands/experimental/templates/rsc/AboutCounter.tsx.template +20 -0
- package/dist/commands/experimental/templates/rsc/AboutPage.css.template +2 -0
- package/dist/commands/experimental/templates/rsc/AboutPage.tsx.template +17 -0
- package/dist/commands/experimental/templates/rsc/Counter.css.template +7 -0
- package/dist/commands/experimental/templates/rsc/Counter.module.css.template +3 -0
- package/dist/commands/experimental/templates/rsc/Counter.tsx.template +18 -0
- package/dist/commands/experimental/templates/rsc/Document.tsx.template +27 -0
- package/dist/commands/experimental/templates/rsc/HomePage.css.template +2 -0
- package/dist/commands/experimental/templates/rsc/HomePage.module.css.template +3 -0
- package/dist/commands/experimental/templates/rsc/HomePage.tsx.template +19 -0
- package/dist/commands/experimental/templates/rsc/NavigationLayout.css.template +32 -0
- package/dist/commands/experimental/templates/rsc/NavigationLayout.tsx.template +31 -0
- package/dist/commands/experimental/templates/rsc/Routes.tsx.template +29 -0
- package/dist/commands/experimental/templates/rsc/entry.client.tsx.template +35 -0
- package/dist/commands/experimental/templates/rsc/entry.server.tsx.template +20 -0
- package/dist/commands/experimental/templates/rsc/index.css.template +4 -0
- package/dist/commands/experimental/templates/streamingSsr/Document.tsx.template +27 -0
- package/dist/commands/experimental/templates/streamingSsr/entry.client.tsx.template +40 -0
- package/dist/commands/experimental/templates/streamingSsr/entry.server.tsx.template +20 -0
- package/dist/commands/experimental/templates/streamingSsr/tsconfig.json.template +54 -0
- package/dist/commands/experimental/util.js +69 -0
- package/dist/commands/experimental.js +22 -0
- package/dist/commands/generate/cell/cell.js +35 -0
- package/dist/commands/generate/cell/cellHandler.js +153 -0
- package/dist/commands/generate/cell/templates/cell.tsx.template +34 -0
- package/dist/commands/generate/cell/templates/cellList.tsx.template +40 -0
- package/dist/commands/generate/cell/templates/mock.ts.template +7 -0
- package/dist/commands/generate/cell/templates/mockList.ts.template +14 -0
- package/dist/commands/generate/cell/templates/stories.tsx.template +35 -0
- package/dist/commands/generate/cell/templates/test.js.template +42 -0
- package/dist/commands/generate/cell/utils/utils.js +43 -0
- package/dist/commands/generate/component/component.js +15 -0
- package/dist/commands/generate/component/componentHandler.js +55 -0
- package/dist/commands/generate/component/templates/component.tsx.template +10 -0
- package/dist/commands/generate/component/templates/stories.jsx.template +17 -0
- package/dist/commands/generate/component/templates/stories.tsx.template +26 -0
- package/dist/commands/generate/component/templates/test.tsx.template +14 -0
- package/dist/commands/generate/dataMigration/dataMigration.js +105 -0
- package/dist/commands/generate/dataMigration/templates/dataMigration.js.template +7 -0
- package/dist/commands/generate/dataMigration/templates/dataMigration.ts.template +5 -0
- package/dist/commands/generate/dbAuth/dbAuth.js +55 -0
- package/dist/commands/generate/dbAuth/dbAuthHandler.js +375 -0
- package/dist/commands/generate/dbAuth/templates/forgotPassword.tsx.template +94 -0
- package/dist/commands/generate/dbAuth/templates/login.tsx.template +130 -0
- package/dist/commands/generate/dbAuth/templates/login.webAuthn.tsx.template +264 -0
- package/dist/commands/generate/dbAuth/templates/resetPassword.tsx.template +121 -0
- package/dist/commands/generate/dbAuth/templates/signup.tsx.template +123 -0
- package/dist/commands/generate/directive/directive.js +15 -0
- package/dist/commands/generate/directive/directiveHandler.js +159 -0
- package/dist/commands/generate/directive/templates/transformer.directive.test.ts.template +18 -0
- package/dist/commands/generate/directive/templates/transformer.directive.ts.template +38 -0
- package/dist/commands/generate/directive/templates/validator.directive.test.ts.template +17 -0
- package/dist/commands/generate/directive/templates/validator.directive.ts.template +39 -0
- package/dist/commands/generate/function/function.js +29 -0
- package/dist/commands/generate/function/functionHandler.js +131 -0
- package/dist/commands/generate/function/templates/function.ts.template +33 -0
- package/dist/commands/generate/function/templates/scenarios.ts.template +8 -0
- package/dist/commands/generate/function/templates/test.ts.template +30 -0
- package/dist/commands/generate/helpers.js +71 -0
- package/dist/commands/generate/job/job.js +39 -0
- package/dist/commands/generate/job/jobHandler.js +138 -0
- package/dist/commands/generate/job/templates/job.ts.template +8 -0
- package/dist/commands/generate/job/templates/scenarios.ts.template +8 -0
- package/dist/commands/generate/job/templates/test.ts.template +7 -0
- package/dist/commands/generate/layout/layout.js +25 -0
- package/dist/commands/generate/layout/layoutHandler.js +59 -0
- package/dist/commands/generate/layout/templates/layout.tsx.a11y.template +27 -0
- package/dist/commands/generate/layout/templates/layout.tsx.template +9 -0
- package/dist/commands/generate/layout/templates/stories.tsx.template +13 -0
- package/dist/commands/generate/layout/templates/test.tsx.template +14 -0
- package/dist/commands/generate/model/model.js +29 -0
- package/dist/commands/generate/model/modelHandler.js +63 -0
- package/dist/commands/generate/model/templates/model.js.template +3 -0
- package/dist/commands/generate/ogImage/ogImage.js +43 -0
- package/dist/commands/generate/ogImage/ogImageHandler.js +111 -0
- package/dist/commands/generate/ogImage/templates/ogImage.og.tsx.template +13 -0
- package/dist/commands/generate/page/page.js +22 -0
- package/dist/commands/generate/page/pageHandler.js +227 -0
- package/dist/commands/generate/page/templates/page.tsx.template +35 -0
- package/dist/commands/generate/page/templates/stories.tsx.parameters.template +13 -0
- package/dist/commands/generate/page/templates/stories.tsx.template +13 -0
- package/dist/commands/generate/page/templates/test.tsx.template +14 -0
- package/dist/commands/generate/realtime/realtime.js +41 -0
- package/dist/commands/generate/realtime/realtimeHandler.js +215 -0
- package/dist/commands/generate/realtime/templates/liveQueries/blank/blank.sdl.ts.template +27 -0
- package/dist/commands/generate/realtime/templates/liveQueries/blank/blank.service.ts.template +73 -0
- package/dist/commands/generate/realtime/templates/realtime.ts.template +42 -0
- package/dist/commands/generate/realtime/templates/subscriptions/blank/blank.sdl.ts.template +20 -0
- package/dist/commands/generate/realtime/templates/subscriptions/blank/blank.service.ts.template +19 -0
- package/dist/commands/generate/realtime/templates/subscriptions/blank/blank.ts.template +58 -0
- package/dist/commands/generate/scaffold/scaffold.js +38 -0
- package/dist/commands/generate/scaffold/scaffoldHandler.js +663 -0
- package/dist/commands/generate/scaffold/templates/assets/scaffold.css.template +398 -0
- package/dist/commands/generate/scaffold/templates/assets/scaffold.tailwind.css.template +243 -0
- package/dist/commands/generate/scaffold/templates/components/EditNameCell.tsx.template +74 -0
- package/dist/commands/generate/scaffold/templates/components/Name.tsx.template +79 -0
- package/dist/commands/generate/scaffold/templates/components/NameCell.tsx.template +32 -0
- package/dist/commands/generate/scaffold/templates/components/NameForm.tsx.template +123 -0
- package/dist/commands/generate/scaffold/templates/components/Names.tsx.template +88 -0
- package/dist/commands/generate/scaffold/templates/components/NamesCell.tsx.template +45 -0
- package/dist/commands/generate/scaffold/templates/components/NewName.tsx.template +55 -0
- package/dist/commands/generate/scaffold/templates/layouts/ScaffoldLayout.tsx.template +37 -0
- package/dist/commands/generate/scaffold/templates/lib/formatters.test.tsx.template +192 -0
- package/dist/commands/generate/scaffold/templates/lib/formatters.tsx.template +58 -0
- package/dist/commands/generate/scaffold/templates/pages/EditNamePage.tsx.template +11 -0
- package/dist/commands/generate/scaffold/templates/pages/NamePage.tsx.template +11 -0
- package/dist/commands/generate/scaffold/templates/pages/NamesPage.tsx.template +7 -0
- package/dist/commands/generate/scaffold/templates/pages/NewNamePage.tsx.template +7 -0
- package/dist/commands/generate/script/script.js +29 -0
- package/dist/commands/generate/script/scriptHandler.js +85 -0
- package/dist/commands/generate/script/templates/script.ts.template +15 -0
- package/dist/commands/generate/script/templates/tsconfig.json.template +33 -0
- package/dist/commands/generate/sdl/sdl.js +48 -0
- package/dist/commands/generate/sdl/sdlHandler.js +282 -0
- package/dist/commands/generate/sdl/templates/sdl.js.template +70 -0
- package/dist/commands/generate/sdl/templates/sdl.ts.template +70 -0
- package/dist/commands/generate/secret/secret.js +52 -0
- package/dist/commands/generate/service/service.js +50 -0
- package/dist/commands/generate/service/serviceHandler.js +301 -0
- package/dist/commands/generate/service/templates/scenarios.ts.template +7 -0
- package/dist/commands/generate/service/templates/service.ts.template +38 -0
- package/dist/commands/generate/service/templates/test.ts.template +84 -0
- package/dist/commands/generate/yargsCommandHelpers.js +77 -0
- package/dist/commands/generate/yargsHandlerHelpers.js +155 -0
- package/dist/commands/generate.js +44 -0
- package/dist/commands/info.js +36 -0
- package/dist/commands/jobs.js +17 -0
- package/dist/commands/jobsHandler.js +30 -0
- package/dist/commands/lint.js +57 -0
- package/dist/commands/prerender.js +34 -0
- package/dist/commands/prerenderHandler.js +282 -0
- package/dist/commands/prisma.js +17 -0
- package/dist/commands/prismaHandler.js +90 -0
- package/dist/commands/record/init.js +11 -0
- package/dist/commands/record.js +19 -0
- package/dist/commands/serve.js +139 -0
- package/dist/commands/serveApiHandler.js +15 -0
- package/dist/commands/serveBothHandler.js +95 -0
- package/dist/commands/serveWebHandler.js +17 -0
- package/dist/commands/setup/auth/auth.js +265 -0
- package/dist/commands/setup/cache/cache.js +37 -0
- package/dist/commands/setup/cache/cacheHandler.js +69 -0
- package/dist/commands/setup/cache/templates/memcached.ts.template +30 -0
- package/dist/commands/setup/cache/templates/redis.ts.template +24 -0
- package/dist/commands/setup/deploy/deploy.js +26 -0
- package/dist/commands/setup/deploy/helpers/helpers.js +9 -0
- package/dist/commands/setup/deploy/helpers/index.js +110 -0
- package/dist/commands/setup/deploy/providers/baremetal.js +9 -0
- package/dist/commands/setup/deploy/providers/baremetalHandler.js +64 -0
- package/dist/commands/setup/deploy/providers/coherence.js +24 -0
- package/dist/commands/setup/deploy/providers/coherenceHandler.js +203 -0
- package/dist/commands/setup/deploy/providers/flightcontrol.js +19 -0
- package/dist/commands/setup/deploy/providers/flightcontrolHandler.js +294 -0
- package/dist/commands/setup/deploy/providers/netlify.js +9 -0
- package/dist/commands/setup/deploy/providers/netlifyHandler.js +42 -0
- package/dist/commands/setup/deploy/providers/render.js +17 -0
- package/dist/commands/setup/deploy/providers/renderHandler.js +111 -0
- package/dist/commands/setup/deploy/providers/serverless.js +11 -0
- package/dist/commands/setup/deploy/providers/serverlessHandler.js +141 -0
- package/dist/commands/setup/deploy/providers/vercel.js +9 -0
- package/dist/commands/setup/deploy/providers/vercelHandler.js +56 -0
- package/dist/commands/setup/deploy/templates/baremetal.js +128 -0
- package/dist/commands/setup/deploy/templates/flightcontrol.js +85 -0
- package/dist/commands/setup/deploy/templates/netlify.js +32 -0
- package/dist/commands/setup/deploy/templates/render.js +72 -0
- package/dist/commands/setup/deploy/templates/serverless/api.js +78 -0
- package/dist/commands/setup/deploy/templates/serverless/web.js +32 -0
- package/dist/commands/setup/docker/docker.js +26 -0
- package/dist/commands/setup/docker/dockerHandler.js +265 -0
- package/dist/commands/setup/docker/templates/Dockerfile +154 -0
- package/dist/commands/setup/docker/templates/docker-compose.dev.yml +58 -0
- package/dist/commands/setup/docker/templates/docker-compose.prod.yml +63 -0
- package/dist/commands/setup/docker/templates/dockerignore +18 -0
- package/dist/commands/setup/generator/generator.js +49 -0
- package/dist/commands/setup/generator/generatorHandler.js +55 -0
- package/dist/commands/setup/graphql/features/fragments/appGqlConfigTransform.js +117 -0
- package/dist/commands/setup/graphql/features/fragments/appImportTransform.js +20 -0
- package/dist/commands/setup/graphql/features/fragments/fragments.js +25 -0
- package/dist/commands/setup/graphql/features/fragments/fragmentsHandler.js +89 -0
- package/dist/commands/setup/graphql/features/trustedDocuments/graphqlTransform.js +51 -0
- package/dist/commands/setup/graphql/features/trustedDocuments/trustedDocuments.js +25 -0
- package/dist/commands/setup/graphql/features/trustedDocuments/trustedDocumentsHandler.js +74 -0
- package/dist/commands/setup/graphql/graphql.js +18 -0
- package/dist/commands/setup/i18n/i18n.js +25 -0
- package/dist/commands/setup/i18n/i18nHandler.js +169 -0
- package/dist/commands/setup/i18n/templates/en.json.template +11 -0
- package/dist/commands/setup/i18n/templates/fr.json.template +11 -0
- package/dist/commands/setup/i18n/templates/i18n.js.template +52 -0
- package/dist/commands/setup/i18n/templates/storybook.preview.tsx.template +43 -0
- package/dist/commands/setup/jobs/jobs.js +31 -0
- package/dist/commands/setup/jobs/jobsHandler.js +122 -0
- package/dist/commands/setup/jobs/templates/jobs.ts.template +32 -0
- package/dist/commands/setup/mailer/mailer.js +30 -0
- package/dist/commands/setup/mailer/mailerHandler.js +106 -0
- package/dist/commands/setup/mailer/templates/mailer.ts.template +30 -0
- package/dist/commands/setup/mailer/templates/re-example.tsx.template +40 -0
- package/dist/commands/setup/middleware/middleware.js +17 -0
- package/dist/commands/setup/middleware/ogImage/__codemod_tests__/middleware.js +15 -0
- package/dist/commands/setup/middleware/ogImage/__codemod_tests__/vitePlugin.js +6 -0
- package/dist/commands/setup/middleware/ogImage/codemodMiddleware.js +97 -0
- package/dist/commands/setup/middleware/ogImage/codemodVitePlugin.js +65 -0
- package/dist/commands/setup/middleware/ogImage/ogImage.js +27 -0
- package/dist/commands/setup/middleware/ogImage/ogImageHandler.js +121 -0
- package/dist/commands/setup/monitoring/monitoring.js +17 -0
- package/dist/commands/setup/monitoring/sentry/sentry.js +25 -0
- package/dist/commands/setup/monitoring/sentry/sentryHandler.js +163 -0
- package/dist/commands/setup/monitoring/sentry/templates/sentryApi.ts.template +15 -0
- package/dist/commands/setup/monitoring/sentry/templates/sentryWeb.ts.template +31 -0
- package/dist/commands/setup/package/package.js +33 -0
- package/dist/commands/setup/package/packageHandler.js +134 -0
- package/dist/commands/setup/realtime/realtime.js +37 -0
- package/dist/commands/setup/realtime/realtimeHandler.js +309 -0
- package/dist/commands/setup/realtime/templates/defer/fastAndSlowFields/fastAndSlowFields.sdl.template +14 -0
- package/dist/commands/setup/realtime/templates/defer/fastAndSlowFields/fastAndSlowFields.ts.template +14 -0
- package/dist/commands/setup/realtime/templates/liveQueries/auctions/auctions.sdl.ts.template +27 -0
- package/dist/commands/setup/realtime/templates/liveQueries/auctions/auctions.ts.template +73 -0
- package/dist/commands/setup/realtime/templates/realtime.ts.template +46 -0
- package/dist/commands/setup/realtime/templates/stream/alphabet/alphabet.sdl.template +9 -0
- package/dist/commands/setup/realtime/templates/stream/alphabet/alphabet.ts.template +31 -0
- package/dist/commands/setup/realtime/templates/subscriptions/countdown/countdown.ts.template +58 -0
- package/dist/commands/setup/realtime/templates/subscriptions/newMessage/newMessage.ts.template +57 -0
- package/dist/commands/setup/realtime/templates/subscriptions/newMessage/rooms.sdl.ts.template +20 -0
- package/dist/commands/setup/realtime/templates/subscriptions/newMessage/rooms.ts.template +20 -0
- package/dist/commands/setup/server-file/serverFile.js +31 -0
- package/dist/commands/setup/server-file/serverFileHandler.js +56 -0
- package/dist/commands/setup/server-file/templates/server.ts.template +13 -0
- package/dist/commands/setup/tsconfig/tsconfig.js +25 -0
- package/dist/commands/setup/tsconfig/tsconfigHandler.js +59 -0
- package/dist/commands/setup/ui/helpers/helpers.js +9 -0
- package/dist/commands/setup/ui/libraries/chakra-ui.js +24 -0
- package/dist/commands/setup/ui/libraries/chakra-uiHandler.js +98 -0
- package/dist/commands/setup/ui/libraries/mantine.js +32 -0
- package/dist/commands/setup/ui/libraries/mantineHandler.js +138 -0
- package/dist/commands/setup/ui/libraries/tailwindcss.js +26 -0
- package/dist/commands/setup/ui/libraries/tailwindcssHandler.js +386 -0
- package/dist/commands/setup/ui/templates/chakra.storybook.preview.tsx.template +20 -0
- package/dist/commands/setup/ui/templates/mantine-postcss.config.js.template +35 -0
- package/dist/commands/setup/ui/templates/mantine.storybook.preview.tsx.template +18 -0
- package/dist/commands/setup/ui/templates/postcss.config.js.template +9 -0
- package/dist/commands/setup/ui/ui.js +17 -0
- package/dist/commands/setup/uploads/dbCodemod.js +28 -0
- package/dist/commands/setup/uploads/templates/signedUrl.ts.template +21 -0
- package/dist/commands/setup/uploads/templates/srcLibUploads.ts.template +25 -0
- package/dist/commands/setup/uploads/uploads.js +26 -0
- package/dist/commands/setup/uploads/uploadsHandler.js +147 -0
- package/dist/commands/setup/vite/templates/vite.config.ts.template +19 -0
- package/dist/commands/setup/vite/vite.js +38 -0
- package/dist/commands/setup/vite/viteHandler.js +83 -0
- package/dist/commands/setup.js +33 -0
- package/dist/commands/studio.js +23 -0
- package/dist/commands/studioHandler.js +61 -0
- package/dist/commands/test.js +44 -0
- package/dist/commands/testHandler.js +138 -0
- package/dist/commands/ts-to-js.js +20 -0
- package/dist/commands/type-check.js +41 -0
- package/dist/commands/type-checkHandler.js +71 -0
- package/dist/commands/upgrade.js +441 -0
- package/dist/index.d.js +0 -0
- package/dist/index.js +146 -0
- package/dist/lib/background.js +45 -0
- package/dist/lib/colors.js +18 -0
- package/dist/lib/configureStorybook.js +50 -0
- package/dist/lib/exec.js +85 -0
- package/dist/lib/exit.js +44 -0
- package/dist/lib/extendFile.js +114 -0
- package/dist/lib/generatePrismaClient.js +60 -0
- package/dist/lib/index.js +485 -0
- package/dist/lib/loadEnvFiles.js +12 -0
- package/dist/lib/locking.js +60 -0
- package/dist/lib/merge/algorithms.js +30 -0
- package/dist/lib/merge/index.js +163 -0
- package/dist/lib/merge/semanticIdentity.js +18 -0
- package/dist/lib/merge/strategy.js +136 -0
- package/dist/lib/mockTelemetry.js +7 -0
- package/dist/lib/packages.js +77 -0
- package/dist/lib/plugin.js +206 -0
- package/dist/lib/pluralHelpers.js +50 -0
- package/dist/lib/ports.js +17 -0
- package/dist/lib/project.js +30 -0
- package/dist/lib/rollback.js +72 -0
- package/dist/lib/runTransform.js +66 -0
- package/dist/lib/rwPluralize.js +56 -0
- package/dist/lib/schemaHelpers.js +95 -0
- package/dist/lib/templates/storybook.preview.tsx.template +19 -0
- package/dist/lib/test.js +106 -0
- package/dist/lib/updateCheck.js +202 -0
- package/dist/lib/updateCheckExecute.js +2 -0
- package/dist/middleware/checkNodeVersion.js +23 -0
- package/dist/middleware/detectProjectRxVersion.js +12 -0
- package/dist/plugin.js +223 -0
- package/dist/rwfw.js +47 -0
- package/dist/telemetry/exporter.js +63 -0
- package/dist/telemetry/index.js +84 -0
- package/dist/telemetry/resource.js +98 -0
- package/dist/telemetry/send.js +80 -0
- package/dist/testLib/cells.js +188 -0
- package/dist/testLib/fetchFileFromTemplate.js +9 -0
- package/dist/testLib/getFilesWithPattern.js +21 -0
- package/dist/testLib/getRootPackageJSON.js +14 -0
- package/dist/testLib/isTSProject.js +9 -0
- package/dist/testLib/runTransform.js +42 -0
- package/package.json +102 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import execa from "execa";
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
5
|
+
import { getPaths } from "@cedarjs/project-config";
|
|
6
|
+
const handler = async ({ side, serve, prisma, dm: dataMigrate }) => {
|
|
7
|
+
recordTelemetryAttributes({
|
|
8
|
+
command: "deploy flightcontrol",
|
|
9
|
+
side,
|
|
10
|
+
prisma,
|
|
11
|
+
dataMigrate,
|
|
12
|
+
serve
|
|
13
|
+
});
|
|
14
|
+
const rwjsPaths = getPaths();
|
|
15
|
+
const execaConfig = {
|
|
16
|
+
cwd: rwjsPaths.base,
|
|
17
|
+
shell: true,
|
|
18
|
+
stdio: "inherit"
|
|
19
|
+
};
|
|
20
|
+
async function runApiCommands() {
|
|
21
|
+
if (!serve) {
|
|
22
|
+
console.log("Building api...");
|
|
23
|
+
execa.commandSync("yarn rw build api --verbose", execaConfig);
|
|
24
|
+
if (prisma) {
|
|
25
|
+
console.log("Running database migrations...");
|
|
26
|
+
execa.commandSync(
|
|
27
|
+
`node_modules/.bin/prisma migrate deploy --schema "${rwjsPaths.api.dbSchema}"`,
|
|
28
|
+
execaConfig
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
if (dataMigrate) {
|
|
32
|
+
console.log("Running data migrations...");
|
|
33
|
+
execa.commandSync("yarn rw dataMigrate up", execaConfig);
|
|
34
|
+
}
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const serverFilePath = path.join(rwjsPaths.api.dist, "server.js");
|
|
38
|
+
const hasServerFile = fs.pathExistsSync(serverFilePath);
|
|
39
|
+
if (hasServerFile) {
|
|
40
|
+
execa(`yarn node ${serverFilePath}`, execaConfig);
|
|
41
|
+
} else {
|
|
42
|
+
const { handler: handler2 } = await import("@cedarjs/api-server/dist/apiCLIConfigHandler.js");
|
|
43
|
+
handler2();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function runWebCommands() {
|
|
47
|
+
console.log("Building web...");
|
|
48
|
+
execa.commandSync("yarn rw build web --verbose", execaConfig);
|
|
49
|
+
}
|
|
50
|
+
if (side === "api") {
|
|
51
|
+
runApiCommands();
|
|
52
|
+
} else if (side === "web") {
|
|
53
|
+
runWebCommands();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
handler
|
|
58
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import terminalLink from "terminal-link";
|
|
2
|
+
const deployBuilder = (yargs) => {
|
|
3
|
+
yargs.option("build", {
|
|
4
|
+
description: "Build for production",
|
|
5
|
+
type: "boolean",
|
|
6
|
+
default: "true"
|
|
7
|
+
}).option("prisma", {
|
|
8
|
+
description: "Apply database migrations",
|
|
9
|
+
type: "boolean",
|
|
10
|
+
default: "true"
|
|
11
|
+
}).option("data-migrate", {
|
|
12
|
+
description: "Migrate the data in your database",
|
|
13
|
+
type: "boolean",
|
|
14
|
+
default: "true",
|
|
15
|
+
alias: "dm"
|
|
16
|
+
}).epilogue(
|
|
17
|
+
`For more commands, options, and examples, see ${terminalLink(
|
|
18
|
+
"Redwood CLI Reference",
|
|
19
|
+
"https://redwoodjs.com/docs/cli-commands#deploy"
|
|
20
|
+
)}`
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
deployBuilder
|
|
25
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import execa from "execa";
|
|
2
|
+
import { getPaths } from "@cedarjs/project-config";
|
|
3
|
+
import c from "../../../lib/colors.js";
|
|
4
|
+
const deployHandler = async ({ build, prisma, dm: dataMigrate }) => {
|
|
5
|
+
const paths = getPaths();
|
|
6
|
+
let commandSet = [];
|
|
7
|
+
if (build) {
|
|
8
|
+
commandSet.push("yarn rw build --verbose");
|
|
9
|
+
}
|
|
10
|
+
if (prisma) {
|
|
11
|
+
commandSet.push("yarn rw prisma migrate deploy");
|
|
12
|
+
}
|
|
13
|
+
if (dataMigrate) {
|
|
14
|
+
commandSet.push("yarn rw data-migrate up");
|
|
15
|
+
}
|
|
16
|
+
const joinedCommands = commandSet.join(" && ");
|
|
17
|
+
console.log(c.note(`
|
|
18
|
+
Running:
|
|
19
|
+
`) + `${joinedCommands}
|
|
20
|
+
`);
|
|
21
|
+
return execa(joinedCommands, {
|
|
22
|
+
shell: true,
|
|
23
|
+
stdio: "inherit",
|
|
24
|
+
cwd: paths.base,
|
|
25
|
+
extendEnv: true,
|
|
26
|
+
cleanup: true
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
deployHandler
|
|
31
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
2
|
+
import { deployBuilder } from "./helpers/deployBuilder.js";
|
|
3
|
+
const command = "netlify [...commands]";
|
|
4
|
+
const description = "Build command for Netlify deploy";
|
|
5
|
+
const builder = (yargs) => deployBuilder(yargs);
|
|
6
|
+
async function handler(yargs) {
|
|
7
|
+
recordTelemetryAttributes({
|
|
8
|
+
command: "deploy netlify",
|
|
9
|
+
build: yargs.build,
|
|
10
|
+
prisma: yargs.prisma,
|
|
11
|
+
dataMigrate: yargs.dataMigrate
|
|
12
|
+
});
|
|
13
|
+
const { handler: importedHandler } = await import("./helpers/deployHandler.js");
|
|
14
|
+
return importedHandler(yargs);
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
builder,
|
|
18
|
+
command,
|
|
19
|
+
description,
|
|
20
|
+
handler
|
|
21
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { nodeFileTrace } from "@vercel/nft";
|
|
3
|
+
import archiver from "archiver";
|
|
4
|
+
import fse from "fs-extra";
|
|
5
|
+
import { findApiDistFunctions } from "@cedarjs/internal/dist/files";
|
|
6
|
+
import { ensurePosixPath, getPaths } from "@cedarjs/project-config";
|
|
7
|
+
import * as nftPacker from "../packing/nft.js";
|
|
8
|
+
const ZIPBALL_DIR = "./api/dist/zipball";
|
|
9
|
+
function zipDirectory(source, out) {
|
|
10
|
+
const archive = archiver("zip", { zlib: { level: 5 } });
|
|
11
|
+
const stream = fse.createWriteStream(out);
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
archive.directory(source, false).on("error", (err) => reject(err)).pipe(stream);
|
|
14
|
+
stream.on("close", () => resolve());
|
|
15
|
+
archive.finalize();
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function generateEntryFile(functionAbsolutePath, name) {
|
|
19
|
+
const relativeImport = ensurePosixPath(
|
|
20
|
+
path.relative(getPaths().base, functionAbsolutePath)
|
|
21
|
+
);
|
|
22
|
+
return [
|
|
23
|
+
`${ZIPBALL_DIR}/${name}/${name}.js`,
|
|
24
|
+
`module.exports = require('./${relativeImport}')`
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
async function packageSingleFunction(functionFile) {
|
|
28
|
+
const { name: functionName } = path.parse(functionFile);
|
|
29
|
+
const { fileList: functionDependencyFileList } = await nodeFileTrace([
|
|
30
|
+
functionFile
|
|
31
|
+
]);
|
|
32
|
+
const copyPromises = [];
|
|
33
|
+
for (const singleDependencyPath of functionDependencyFileList) {
|
|
34
|
+
copyPromises.push(
|
|
35
|
+
fse.copy(
|
|
36
|
+
"./" + singleDependencyPath,
|
|
37
|
+
`${ZIPBALL_DIR}/${functionName}/${singleDependencyPath}`
|
|
38
|
+
)
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
const [entryFilePath, content] = generateEntryFile(functionFile, functionName);
|
|
42
|
+
const functionEntryPromise = fse.outputFile(entryFilePath, content);
|
|
43
|
+
copyPromises.push(functionEntryPromise);
|
|
44
|
+
await Promise.all(copyPromises);
|
|
45
|
+
await zipDirectory(
|
|
46
|
+
`${ZIPBALL_DIR}/${functionName}`,
|
|
47
|
+
`${ZIPBALL_DIR}/${functionName}.zip`
|
|
48
|
+
);
|
|
49
|
+
await fse.remove(`${ZIPBALL_DIR}/${functionName}`);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
function nftPack() {
|
|
53
|
+
const filesToBePacked = findApiDistFunctions();
|
|
54
|
+
return Promise.all(filesToBePacked.map(nftPacker.packageSingleFunction));
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
generateEntryFile,
|
|
58
|
+
nftPack,
|
|
59
|
+
packageSingleFunction,
|
|
60
|
+
zipDirectory
|
|
61
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import terminalLink from "terminal-link";
|
|
2
|
+
if (process.argv.slice(2).includes("api")) {
|
|
3
|
+
process.env.REDWOOD_DISABLE_TELEMETRY = 1;
|
|
4
|
+
}
|
|
5
|
+
const command = "render <side>";
|
|
6
|
+
const description = "Build, migrate, and serve command for Render deploy";
|
|
7
|
+
const builder = (yargs) => {
|
|
8
|
+
yargs.positional("side", {
|
|
9
|
+
choices: ["api", "web"],
|
|
10
|
+
description: "Side to deploy",
|
|
11
|
+
type: "string"
|
|
12
|
+
}).option("prisma", {
|
|
13
|
+
description: "Apply database migrations",
|
|
14
|
+
type: "boolean",
|
|
15
|
+
default: true
|
|
16
|
+
}).option("data-migrate", {
|
|
17
|
+
description: "Apply data migrations",
|
|
18
|
+
type: "boolean",
|
|
19
|
+
default: true,
|
|
20
|
+
alias: "dm"
|
|
21
|
+
}).epilogue(
|
|
22
|
+
`For more commands, options, and examples, see ${terminalLink(
|
|
23
|
+
"Redwood CLI Reference",
|
|
24
|
+
"https://redwoodjs.com/docs/cli-commands#deploy"
|
|
25
|
+
)}`
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
async function handler(yargs) {
|
|
29
|
+
const { handler: importedHandler } = await import("./renderHandler.js");
|
|
30
|
+
return importedHandler(yargs);
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
builder,
|
|
34
|
+
command,
|
|
35
|
+
description,
|
|
36
|
+
handler
|
|
37
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import execa from "execa";
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
5
|
+
import { getPaths } from "@cedarjs/project-config";
|
|
6
|
+
const handler = async ({ side, prisma, dataMigrate }) => {
|
|
7
|
+
recordTelemetryAttributes({
|
|
8
|
+
command: "deploy render",
|
|
9
|
+
side,
|
|
10
|
+
prisma,
|
|
11
|
+
dataMigrate
|
|
12
|
+
});
|
|
13
|
+
const rwjsPaths = getPaths();
|
|
14
|
+
const execaConfig = {
|
|
15
|
+
cwd: rwjsPaths.base,
|
|
16
|
+
shell: true,
|
|
17
|
+
stdio: "inherit"
|
|
18
|
+
};
|
|
19
|
+
async function runApiCommands() {
|
|
20
|
+
if (prisma) {
|
|
21
|
+
console.log("Running database migrations...");
|
|
22
|
+
execa.commandSync(
|
|
23
|
+
`node_modules/.bin/prisma migrate deploy --schema "${rwjsPaths.api.dbSchema}"`,
|
|
24
|
+
execaConfig
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
if (dataMigrate) {
|
|
28
|
+
console.log("Running data migrations...");
|
|
29
|
+
const packageJson = fs.readJsonSync(
|
|
30
|
+
path.join(rwjsPaths.base, "package.json")
|
|
31
|
+
);
|
|
32
|
+
const hasDataMigratePackage = !!packageJson.devDependencies["@cedarjs/cli-data-migrate"];
|
|
33
|
+
if (!hasDataMigratePackage) {
|
|
34
|
+
console.error(
|
|
35
|
+
[
|
|
36
|
+
"Skipping data migrations; your project doesn't have the `@cedarjs/cli-data-migrate` package as a dev dependency.",
|
|
37
|
+
"Without it installed, you're likely to run into memory issues during deploy.",
|
|
38
|
+
"If you want to run data migrations, add the package to your project's root package.json and deploy again:",
|
|
39
|
+
"",
|
|
40
|
+
"```",
|
|
41
|
+
"yarn add -D @cedarjs/cli-data-migrate",
|
|
42
|
+
"```"
|
|
43
|
+
].join("\n")
|
|
44
|
+
);
|
|
45
|
+
} else {
|
|
46
|
+
execa.commandSync("yarn rw dataMigrate up", execaConfig);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const serverFilePath = path.join(rwjsPaths.api.dist, "server.js");
|
|
50
|
+
const hasServerFile = fs.pathExistsSync(serverFilePath);
|
|
51
|
+
if (hasServerFile) {
|
|
52
|
+
execa(`yarn node ${serverFilePath}`, execaConfig);
|
|
53
|
+
} else {
|
|
54
|
+
const { handler: handler2 } = await import("@cedarjs/api-server/dist/apiCLIConfigHandler.js");
|
|
55
|
+
handler2();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async function runWebCommands() {
|
|
59
|
+
execa.commandSync("yarn install", execaConfig);
|
|
60
|
+
execa.commandSync("yarn rw build web --verbose", execaConfig);
|
|
61
|
+
}
|
|
62
|
+
if (side === "api") {
|
|
63
|
+
runApiCommands();
|
|
64
|
+
} else if (side === "web") {
|
|
65
|
+
runWebCommands();
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
export {
|
|
69
|
+
handler
|
|
70
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import terminalLink from "terminal-link";
|
|
2
|
+
const command = "serverless";
|
|
3
|
+
const aliases = ["aws serverless", "sls"];
|
|
4
|
+
const description = "Deploy to AWS via the serverless framework";
|
|
5
|
+
const builder = (yargs) => {
|
|
6
|
+
yargs.option("stage", {
|
|
7
|
+
describe: "serverless stage pass through param: https://www.serverless.com/blog/stages-and-environments",
|
|
8
|
+
default: "production",
|
|
9
|
+
type: "string"
|
|
10
|
+
});
|
|
11
|
+
yargs.option("sides", {
|
|
12
|
+
describe: "which Side(s) to deploy",
|
|
13
|
+
choices: ["api", "web"],
|
|
14
|
+
default: ["api", "web"],
|
|
15
|
+
alias: "side",
|
|
16
|
+
type: "array"
|
|
17
|
+
});
|
|
18
|
+
yargs.option("verbose", {
|
|
19
|
+
describe: "verbosity of logs",
|
|
20
|
+
default: true,
|
|
21
|
+
type: "boolean"
|
|
22
|
+
});
|
|
23
|
+
yargs.option("pack-only", {
|
|
24
|
+
describe: "Only build and pack, and dont push code up using serverless",
|
|
25
|
+
default: false,
|
|
26
|
+
type: "boolean"
|
|
27
|
+
});
|
|
28
|
+
yargs.option("first-run", {
|
|
29
|
+
describe: "Set this flag the first time you deploy, to configure your API URL on the webside",
|
|
30
|
+
default: false,
|
|
31
|
+
type: "boolean"
|
|
32
|
+
});
|
|
33
|
+
yargs.epilogue(
|
|
34
|
+
`Also see the ${terminalLink(
|
|
35
|
+
"Redwood CLI Reference",
|
|
36
|
+
"https://redwoodjs.com/docs/cli-commands#deploy"
|
|
37
|
+
)}
|
|
38
|
+
`
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
async function handler(yargs) {
|
|
42
|
+
const { handler: importedHandler } = await import("./serverlessHandler.js");
|
|
43
|
+
return importedHandler(yargs);
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
aliases,
|
|
47
|
+
builder,
|
|
48
|
+
command,
|
|
49
|
+
description,
|
|
50
|
+
handler
|
|
51
|
+
};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import boxen from "boxen";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { config } from "dotenv-defaults";
|
|
5
|
+
import execa from "execa";
|
|
6
|
+
import fs from "fs-extra";
|
|
7
|
+
import { Listr } from "listr2";
|
|
8
|
+
import prompts from "prompts";
|
|
9
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
10
|
+
import c from "../../lib/colors.js";
|
|
11
|
+
import { getPaths } from "../../lib/index.js";
|
|
12
|
+
const preRequisites = () => [
|
|
13
|
+
{
|
|
14
|
+
title: "Checking if Serverless framework is installed...",
|
|
15
|
+
command: ["yarn serverless", ["--version"]],
|
|
16
|
+
errorMessage: [
|
|
17
|
+
"Looks like Serverless is not installed.",
|
|
18
|
+
"Please run yarn add -W --dev serverless."
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
];
|
|
22
|
+
const buildCommands = ({ sides }) => {
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
title: `Building ${sides.join(" & ")}...`,
|
|
26
|
+
command: ["yarn", ["rw", "build", ...sides]]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
title: "Packing Functions...",
|
|
30
|
+
enabled: () => sides.includes("api"),
|
|
31
|
+
task: async () => {
|
|
32
|
+
const { nftPack } = await import("./packing/nft.js");
|
|
33
|
+
await nftPack();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
};
|
|
38
|
+
const deployCommands = ({ stage, sides, firstRun, packOnly }) => {
|
|
39
|
+
const slsStage = stage ? ["--stage", stage] : [];
|
|
40
|
+
return sides.map((side) => {
|
|
41
|
+
return {
|
|
42
|
+
title: `Deploying ${side}....`,
|
|
43
|
+
task: async () => {
|
|
44
|
+
await execa("yarn", ["serverless", "deploy", ...slsStage], {
|
|
45
|
+
cwd: path.join(getPaths().base, side),
|
|
46
|
+
shell: true,
|
|
47
|
+
stdio: "inherit",
|
|
48
|
+
cleanup: true
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
skip: () => {
|
|
52
|
+
if (firstRun && side === "web") {
|
|
53
|
+
return "Skipping web deploy, until environment configured";
|
|
54
|
+
}
|
|
55
|
+
if (packOnly) {
|
|
56
|
+
return "Finishing early due to --pack-only flag. Your Redwood project is packaged and ready to deploy";
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
const loadDotEnvForStage = (dotEnvPath) => {
|
|
63
|
+
config({
|
|
64
|
+
path: dotEnvPath,
|
|
65
|
+
defaults: path.join(getPaths().base, ".env.defaults"),
|
|
66
|
+
encoding: "utf8"
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
const handler = async (yargs) => {
|
|
70
|
+
recordTelemetryAttributes({
|
|
71
|
+
command: "deploy serverless",
|
|
72
|
+
sides: JSON.stringify(yargs.sides),
|
|
73
|
+
verbose: yargs.verbose,
|
|
74
|
+
packOnly: yargs.packOnly,
|
|
75
|
+
firstRun: yargs.firstRun
|
|
76
|
+
});
|
|
77
|
+
const rwjsPaths = getPaths();
|
|
78
|
+
const dotEnvPath = path.join(rwjsPaths.base, `.env.${yargs.stage}`);
|
|
79
|
+
loadDotEnvForStage(dotEnvPath);
|
|
80
|
+
const tasks = new Listr(
|
|
81
|
+
[
|
|
82
|
+
...preRequisites(yargs).map(mapCommandsToListr),
|
|
83
|
+
...buildCommands(yargs).map(mapCommandsToListr),
|
|
84
|
+
...deployCommands(yargs).map(mapCommandsToListr)
|
|
85
|
+
],
|
|
86
|
+
{
|
|
87
|
+
exitOnError: true,
|
|
88
|
+
renderer: yargs.verbose && "verbose"
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
try {
|
|
92
|
+
await tasks.run();
|
|
93
|
+
if (yargs.firstRun) {
|
|
94
|
+
const SETUP_MARKER = chalk.bgBlue(chalk.black("First Setup "));
|
|
95
|
+
console.log();
|
|
96
|
+
console.log(SETUP_MARKER, c.success("Starting first setup wizard..."));
|
|
97
|
+
const { stdout: slsInfo } = await execa(
|
|
98
|
+
`yarn serverless info --verbose --stage=${yargs.stage}`,
|
|
99
|
+
{
|
|
100
|
+
shell: true,
|
|
101
|
+
cwd: getPaths().api.base
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
const deployedApiUrl = slsInfo.match(/HttpApiUrl: (https:\/\/.*)/)[1];
|
|
105
|
+
console.log();
|
|
106
|
+
console.log(SETUP_MARKER, `Found ${c.success(deployedApiUrl)}`);
|
|
107
|
+
console.log();
|
|
108
|
+
const { addDotEnv } = await prompts({
|
|
109
|
+
type: "confirm",
|
|
110
|
+
name: "addDotEnv",
|
|
111
|
+
message: `Add API_URL to your .env.${yargs.stage}? This will be used if you deploy the web side from your machine`
|
|
112
|
+
});
|
|
113
|
+
if (addDotEnv) {
|
|
114
|
+
fs.writeFileSync(dotEnvPath, `API_URL=${deployedApiUrl}`);
|
|
115
|
+
loadDotEnvForStage(dotEnvPath);
|
|
116
|
+
}
|
|
117
|
+
if (yargs.sides.includes("web")) {
|
|
118
|
+
console.log();
|
|
119
|
+
console.log(SETUP_MARKER, "Deploying web side with updated API_URL");
|
|
120
|
+
console.log(
|
|
121
|
+
SETUP_MARKER,
|
|
122
|
+
"First deploys can take a good few minutes..."
|
|
123
|
+
);
|
|
124
|
+
console.log();
|
|
125
|
+
const webDeployTasks = new Listr(
|
|
126
|
+
[
|
|
127
|
+
// Rebuild web with the new API_URL
|
|
128
|
+
...buildCommands({ ...yargs, sides: ["web"], firstRun: false }).map(
|
|
129
|
+
mapCommandsToListr
|
|
130
|
+
),
|
|
131
|
+
...deployCommands({
|
|
132
|
+
...yargs,
|
|
133
|
+
sides: ["web"],
|
|
134
|
+
firstRun: false
|
|
135
|
+
}).map(mapCommandsToListr)
|
|
136
|
+
],
|
|
137
|
+
{
|
|
138
|
+
exitOnError: true,
|
|
139
|
+
renderer: yargs.verbose && "verbose"
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
await webDeployTasks.run();
|
|
143
|
+
const { stdout: slsInfo2 } = await execa(
|
|
144
|
+
`yarn serverless info --verbose --stage=${yargs.stage}`,
|
|
145
|
+
{
|
|
146
|
+
shell: true,
|
|
147
|
+
cwd: getPaths().web.base
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
const deployedWebUrl = slsInfo2.match(/url: (https:\/\/.*)/)[1];
|
|
151
|
+
const message = [
|
|
152
|
+
c.bold("Successful first deploy!"),
|
|
153
|
+
"",
|
|
154
|
+
`View your deployed site at: ${c.success(deployedWebUrl)}`,
|
|
155
|
+
"",
|
|
156
|
+
"You can use serverless.com CI/CD by connecting/creating an app",
|
|
157
|
+
"To do this run `yarn serverless` on each of the sides, and connect your account",
|
|
158
|
+
"",
|
|
159
|
+
"Find more information in our docs:",
|
|
160
|
+
c.underline("https://redwoodjs.com/docs/deploy#serverless")
|
|
161
|
+
];
|
|
162
|
+
console.log(
|
|
163
|
+
boxen(message.join("\n"), {
|
|
164
|
+
padding: { top: 0, bottom: 0, right: 1, left: 1 },
|
|
165
|
+
margin: 1,
|
|
166
|
+
borderColor: "gray"
|
|
167
|
+
})
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
} catch (e) {
|
|
172
|
+
console.error(c.error(e.message));
|
|
173
|
+
process.exit(e?.exitCode || 1);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
const mapCommandsToListr = ({
|
|
177
|
+
title,
|
|
178
|
+
command,
|
|
179
|
+
task,
|
|
180
|
+
cwd,
|
|
181
|
+
errorMessage,
|
|
182
|
+
skip,
|
|
183
|
+
enabled
|
|
184
|
+
}) => {
|
|
185
|
+
return {
|
|
186
|
+
title,
|
|
187
|
+
task: task ? task : async () => {
|
|
188
|
+
try {
|
|
189
|
+
const executingCommand = execa(...command, {
|
|
190
|
+
cwd: cwd || getPaths().base,
|
|
191
|
+
shell: true
|
|
192
|
+
});
|
|
193
|
+
executingCommand.stdout.pipe(process.stdout);
|
|
194
|
+
await executingCommand;
|
|
195
|
+
} catch (error) {
|
|
196
|
+
if (errorMessage) {
|
|
197
|
+
error.message = error.message + "\n" + errorMessage.join(" ");
|
|
198
|
+
}
|
|
199
|
+
throw error;
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
skip,
|
|
203
|
+
enabled
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
export {
|
|
207
|
+
buildCommands,
|
|
208
|
+
deployCommands,
|
|
209
|
+
handler,
|
|
210
|
+
preRequisites
|
|
211
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
2
|
+
import { deployBuilder } from "./helpers/deployBuilder.js";
|
|
3
|
+
const command = "vercel [...commands]";
|
|
4
|
+
const description = "Build command for Vercel deploy";
|
|
5
|
+
const builder = (yargs) => deployBuilder(yargs);
|
|
6
|
+
async function handler(yargs) {
|
|
7
|
+
recordTelemetryAttributes({
|
|
8
|
+
command: "deploy vercel",
|
|
9
|
+
build: yargs.build,
|
|
10
|
+
prisma: yargs.prisma,
|
|
11
|
+
dataMigrate: yargs.dataMigrate
|
|
12
|
+
});
|
|
13
|
+
const { handler: importedHandler } = await import("./helpers/deployHandler.js");
|
|
14
|
+
return importedHandler(yargs);
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
builder,
|
|
18
|
+
command,
|
|
19
|
+
description,
|
|
20
|
+
handler
|
|
21
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const command = "deploy <target>";
|
|
2
|
+
const description = "Deploy your Redwood project";
|
|
3
|
+
import terminalLink from "terminal-link";
|
|
4
|
+
import * as deployBaremetal from "./deploy/baremetal.js";
|
|
5
|
+
import * as deployFlightcontrol from "./deploy/flightcontrol.js";
|
|
6
|
+
import * as deployNetlify from "./deploy/netlify.js";
|
|
7
|
+
import * as deployRender from "./deploy/render.js";
|
|
8
|
+
import * as deployServerless from "./deploy/serverless.js";
|
|
9
|
+
import * as deployVercel from "./deploy/vercel.js";
|
|
10
|
+
const builder = (yargs) => yargs.command(deployBaremetal).command(deployFlightcontrol).command(deployNetlify).command(deployRender).command(deployServerless).command(deployVercel).demandCommand().epilogue(
|
|
11
|
+
`Also see the ${terminalLink(
|
|
12
|
+
"Redwood CLI Reference",
|
|
13
|
+
"https://redwoodjs.com/docs/cli-commands#deploy"
|
|
14
|
+
)}
|
|
15
|
+
`
|
|
16
|
+
);
|
|
17
|
+
export {
|
|
18
|
+
builder,
|
|
19
|
+
command,
|
|
20
|
+
description
|
|
21
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { files as cellFiles } from "../../generate/cell/cellHandler.js";
|
|
2
|
+
import { createYargsForComponentDestroy, createHandler } from "../helpers.js";
|
|
3
|
+
const { command, description, builder } = createYargsForComponentDestroy(
|
|
4
|
+
{ componentName: "cell", filesFn: cellFiles }
|
|
5
|
+
);
|
|
6
|
+
const handler = createHandler("cell");
|
|
7
|
+
export {
|
|
8
|
+
builder,
|
|
9
|
+
command,
|
|
10
|
+
description,
|
|
11
|
+
handler
|
|
12
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { files as componentFiles } from "../../generate/component/componentHandler.js";
|
|
2
|
+
import { createHandler, createYargsForComponentDestroy } from "../helpers.js";
|
|
3
|
+
const description = "Destroy a component";
|
|
4
|
+
const { command, builder, tasks } = createYargsForComponentDestroy({
|
|
5
|
+
componentName: "component",
|
|
6
|
+
filesFn: componentFiles
|
|
7
|
+
});
|
|
8
|
+
const handler = createHandler("component");
|
|
9
|
+
export {
|
|
10
|
+
builder,
|
|
11
|
+
command,
|
|
12
|
+
description,
|
|
13
|
+
handler,
|
|
14
|
+
tasks
|
|
15
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { files as componentFiles } from "../../generate/component/componentHandler.js";
|
|
2
|
+
import { createHandler } from "../handlerHelpers.js";
|
|
3
|
+
const { handler, tasks } = createHandler({
|
|
4
|
+
componentName: "component",
|
|
5
|
+
filesFn: componentFiles
|
|
6
|
+
});
|
|
7
|
+
export {
|
|
8
|
+
handler,
|
|
9
|
+
tasks
|
|
10
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { files as directiveFiles } from "../../generate/directive/directiveHandler.js";
|
|
2
|
+
import { createYargsForComponentDestroy, createHandler } from "../helpers.js";
|
|
3
|
+
const description = "Destroy a directive";
|
|
4
|
+
const { command, builder } = createYargsForComponentDestroy({
|
|
5
|
+
componentName: "directive",
|
|
6
|
+
filesFn: (args) => directiveFiles({ ...args, type: "validator" })
|
|
7
|
+
});
|
|
8
|
+
const handler = createHandler("directive");
|
|
9
|
+
export {
|
|
10
|
+
builder,
|
|
11
|
+
command,
|
|
12
|
+
description,
|
|
13
|
+
handler
|
|
14
|
+
};
|