@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,18 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
var colors_default = {
|
|
3
|
+
error: chalk.bold.red,
|
|
4
|
+
warning: chalk.hex("#ffa500"),
|
|
5
|
+
highlight: chalk.hex("#ffa500"),
|
|
6
|
+
success: chalk.green,
|
|
7
|
+
info: chalk.grey,
|
|
8
|
+
bold: chalk.bold,
|
|
9
|
+
underline: chalk.underline,
|
|
10
|
+
note: chalk.blue,
|
|
11
|
+
tip: chalk.green,
|
|
12
|
+
important: chalk.magenta,
|
|
13
|
+
caution: chalk.red,
|
|
14
|
+
link: chalk.underline
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
colors_default as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fse from "fs-extra";
|
|
3
|
+
import prettier from "prettier";
|
|
4
|
+
import { merge } from "./merge/index.js";
|
|
5
|
+
import {
|
|
6
|
+
interleave,
|
|
7
|
+
concatUnique,
|
|
8
|
+
keepBoth,
|
|
9
|
+
keepBothStatementParents
|
|
10
|
+
} from "./merge/strategy.js";
|
|
11
|
+
import { isTypeScriptProject } from "./project.js";
|
|
12
|
+
import { getPaths, transformTSToJS, writeFile } from "./index.js";
|
|
13
|
+
async function extendStorybookConfiguration(newConfigPath = void 0) {
|
|
14
|
+
const webPaths = getPaths().web;
|
|
15
|
+
const ts = isTypeScriptProject();
|
|
16
|
+
const sbPreviewConfigPath = webPaths.storybookPreviewConfig ?? `${webPaths.storybook}/preview.${ts ? "tsx" : "js"}`;
|
|
17
|
+
const read = (path2) => fse.readFileSync(path2, { encoding: "utf-8" });
|
|
18
|
+
if (!fse.existsSync(sbPreviewConfigPath)) {
|
|
19
|
+
const templateContent = read(
|
|
20
|
+
path.resolve(
|
|
21
|
+
import.meta.dirname,
|
|
22
|
+
"templates",
|
|
23
|
+
"storybook.preview.tsx.template"
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
const storybookPreviewContent2 = ts ? templateContent : await transformTSToJS(sbPreviewConfigPath, templateContent);
|
|
27
|
+
writeFile(sbPreviewConfigPath, storybookPreviewContent2);
|
|
28
|
+
}
|
|
29
|
+
const storybookPreviewContent = read(sbPreviewConfigPath);
|
|
30
|
+
if (newConfigPath) {
|
|
31
|
+
const newConfigTemplate = read(newConfigPath);
|
|
32
|
+
const newConfigContent = ts ? newConfigTemplate : await transformTSToJS(newConfigPath, newConfigTemplate);
|
|
33
|
+
const merged = await merge(storybookPreviewContent, newConfigContent, {
|
|
34
|
+
ImportDeclaration: interleave,
|
|
35
|
+
ArrayExpression: concatUnique,
|
|
36
|
+
ObjectExpression: concatUnique,
|
|
37
|
+
ArrowFunctionExpression: keepBothStatementParents,
|
|
38
|
+
FunctionDeclaration: keepBoth
|
|
39
|
+
});
|
|
40
|
+
const pConfig = await prettier.resolveConfig(sbPreviewConfigPath);
|
|
41
|
+
const formatted = await prettier.format(merged, {
|
|
42
|
+
parser: ts ? "babel-ts" : "babel",
|
|
43
|
+
...pConfig
|
|
44
|
+
});
|
|
45
|
+
writeFile(sbPreviewConfigPath, formatted, { overwriteExisting: true });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
extendStorybookConfiguration as default
|
|
50
|
+
};
|
package/dist/lib/exec.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import {
|
|
4
|
+
getWebSideDefaultBabelConfig,
|
|
5
|
+
registerApiSideBabelHook
|
|
6
|
+
} from "@cedarjs/babel-config";
|
|
7
|
+
import { getPaths } from "@cedarjs/project-config";
|
|
8
|
+
async function runScriptFunction({
|
|
9
|
+
path: scriptPath,
|
|
10
|
+
functionName,
|
|
11
|
+
args
|
|
12
|
+
}) {
|
|
13
|
+
const createdRequire = createRequire(import.meta.url);
|
|
14
|
+
const script = createdRequire(scriptPath);
|
|
15
|
+
const returnValue = await script[functionName](args);
|
|
16
|
+
try {
|
|
17
|
+
const { db } = createdRequire(path.join(getPaths().api.lib, "db"));
|
|
18
|
+
db.$disconnect();
|
|
19
|
+
} catch (e) {
|
|
20
|
+
}
|
|
21
|
+
return returnValue;
|
|
22
|
+
}
|
|
23
|
+
async function configureBabel() {
|
|
24
|
+
const {
|
|
25
|
+
overrides: _overrides,
|
|
26
|
+
plugins: webPlugins,
|
|
27
|
+
...otherWebConfig
|
|
28
|
+
} = getWebSideDefaultBabelConfig();
|
|
29
|
+
registerApiSideBabelHook({
|
|
30
|
+
plugins: [
|
|
31
|
+
[
|
|
32
|
+
"babel-plugin-module-resolver",
|
|
33
|
+
{
|
|
34
|
+
alias: {
|
|
35
|
+
$api: getPaths().api.base,
|
|
36
|
+
$web: getPaths().web.base,
|
|
37
|
+
api: getPaths().api.base,
|
|
38
|
+
web: getPaths().web.base
|
|
39
|
+
},
|
|
40
|
+
loglevel: "silent"
|
|
41
|
+
// to silence the unnecessary warnings
|
|
42
|
+
},
|
|
43
|
+
"exec-$side-module-resolver"
|
|
44
|
+
]
|
|
45
|
+
],
|
|
46
|
+
overrides: [
|
|
47
|
+
{
|
|
48
|
+
test: ["./api/"],
|
|
49
|
+
plugins: [
|
|
50
|
+
[
|
|
51
|
+
"babel-plugin-module-resolver",
|
|
52
|
+
{
|
|
53
|
+
alias: {
|
|
54
|
+
src: getPaths().api.src
|
|
55
|
+
},
|
|
56
|
+
loglevel: "silent"
|
|
57
|
+
},
|
|
58
|
+
"exec-api-src-module-resolver"
|
|
59
|
+
]
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
test: ["./web/"],
|
|
64
|
+
plugins: [
|
|
65
|
+
...webPlugins,
|
|
66
|
+
[
|
|
67
|
+
"babel-plugin-module-resolver",
|
|
68
|
+
{
|
|
69
|
+
alias: {
|
|
70
|
+
src: getPaths().web.src
|
|
71
|
+
},
|
|
72
|
+
loglevel: "silent"
|
|
73
|
+
},
|
|
74
|
+
"exec-web-src-module-resolver"
|
|
75
|
+
]
|
|
76
|
+
],
|
|
77
|
+
...otherWebConfig
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
configureBabel,
|
|
84
|
+
runScriptFunction
|
|
85
|
+
};
|
package/dist/lib/exit.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import terminalLink from "terminal-link";
|
|
3
|
+
import { v4 as uuidv4 } from "uuid";
|
|
4
|
+
import {
|
|
5
|
+
recordTelemetryAttributes,
|
|
6
|
+
recordTelemetryError
|
|
7
|
+
} from "@cedarjs/cli-helpers";
|
|
8
|
+
const DEFAULT_ERROR_EPILOGUE = [
|
|
9
|
+
"Need help?",
|
|
10
|
+
` - Not sure about something or need advice? Reach out on our ${terminalLink(
|
|
11
|
+
"Forum",
|
|
12
|
+
"https://community.redwoodjs.com/"
|
|
13
|
+
)}`,
|
|
14
|
+
` - Think you've found a bug? Open an issue on our ${terminalLink(
|
|
15
|
+
"GitHub",
|
|
16
|
+
"https://github.com/cedarjs/cedar"
|
|
17
|
+
)}`
|
|
18
|
+
].join("\n");
|
|
19
|
+
function exitWithError(error, { exitCode, message, epilogue, includeEpilogue, includeReferenceCode } = {}) {
|
|
20
|
+
exitCode ??= error?.exitCode ?? 1;
|
|
21
|
+
epilogue ??= DEFAULT_ERROR_EPILOGUE;
|
|
22
|
+
includeEpilogue ??= true;
|
|
23
|
+
includeReferenceCode ??= true;
|
|
24
|
+
message ??= error.stack ?? (error.toString() || "Unknown error");
|
|
25
|
+
const errorReferenceCode = uuidv4();
|
|
26
|
+
const line = chalk.red("-".repeat(process.stderr.columns));
|
|
27
|
+
const content = !includeEpilogue ? message : [
|
|
28
|
+
"",
|
|
29
|
+
line,
|
|
30
|
+
message,
|
|
31
|
+
`
|
|
32
|
+
${line}`,
|
|
33
|
+
epilogue,
|
|
34
|
+
includeReferenceCode && ` - Here's your unique error reference to quote: '${errorReferenceCode}'`,
|
|
35
|
+
line
|
|
36
|
+
].filter(Boolean).join("\n");
|
|
37
|
+
console.error(content);
|
|
38
|
+
recordTelemetryError(error ?? new Error(message));
|
|
39
|
+
recordTelemetryAttributes({ errorReferenceCode });
|
|
40
|
+
process.exit(exitCode);
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
exitWithError
|
|
44
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import fs from "fs-extra";
|
|
2
|
+
function fileIncludes(path, str) {
|
|
3
|
+
return fs.existsSync(path) && fs.readFileSync(path).toString().includes(str);
|
|
4
|
+
}
|
|
5
|
+
function extendJSXFile(path, {
|
|
6
|
+
insertComponent: {
|
|
7
|
+
name = void 0,
|
|
8
|
+
props = void 0,
|
|
9
|
+
around = void 0,
|
|
10
|
+
within = void 0,
|
|
11
|
+
insertBefore = void 0,
|
|
12
|
+
insertAfter = void 0
|
|
13
|
+
},
|
|
14
|
+
imports = [],
|
|
15
|
+
moduleScopeLines = []
|
|
16
|
+
}) {
|
|
17
|
+
const content = fs.readFileSync(path).toString().split("\n");
|
|
18
|
+
if (moduleScopeLines?.length) {
|
|
19
|
+
content.splice(
|
|
20
|
+
content.findLastIndex((l) => l.trimStart().startsWith("import")) + 1,
|
|
21
|
+
0,
|
|
22
|
+
"",
|
|
23
|
+
...moduleScopeLines
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
if (imports?.length) {
|
|
27
|
+
content.splice(
|
|
28
|
+
content.findLastIndex((l) => l.includes("@cedarjs")) + 1,
|
|
29
|
+
0,
|
|
30
|
+
"",
|
|
31
|
+
...imports
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
if (name) {
|
|
35
|
+
insertComponent(content, {
|
|
36
|
+
component: name,
|
|
37
|
+
props,
|
|
38
|
+
around,
|
|
39
|
+
within,
|
|
40
|
+
insertBefore,
|
|
41
|
+
insertAfter
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
fs.writeFileSync(path, content.filter((e) => e !== void 0).join("\n"));
|
|
45
|
+
}
|
|
46
|
+
function insertComponent(content, { component, props, around, within, insertBefore, insertAfter }) {
|
|
47
|
+
if (around && within || !(around || within)) {
|
|
48
|
+
throw new Error(
|
|
49
|
+
"Exactly one of (around | within) must be defined. Choose one."
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
const target = around ?? within;
|
|
53
|
+
const findTagIndex = (regex) => content.findIndex((line) => regex.test(line));
|
|
54
|
+
let open = findTagIndex(new RegExp(`([^\\S\r
|
|
55
|
+
]*)<${target}\\s*(.*)\\s*>`));
|
|
56
|
+
let close = findTagIndex(new RegExp(`([^\\S\r
|
|
57
|
+
]*)</${target}>`)) + 1;
|
|
58
|
+
if (open === -1 || close === -1) {
|
|
59
|
+
throw new Error(`Could not find tags for ${target}`);
|
|
60
|
+
}
|
|
61
|
+
if (within) {
|
|
62
|
+
open++;
|
|
63
|
+
close--;
|
|
64
|
+
}
|
|
65
|
+
const [, componentDepth] = content[open].match(/([^\S\r\n]*).*/);
|
|
66
|
+
content.splice(
|
|
67
|
+
open,
|
|
68
|
+
close - open,
|
|
69
|
+
// "Delete" the wrapped component contents. We put it back below.
|
|
70
|
+
insertBefore && componentDepth + insertBefore,
|
|
71
|
+
componentDepth + buildOpeningTag(component, props),
|
|
72
|
+
...content.slice(open, close).map((line) => " " + line),
|
|
73
|
+
componentDepth + `</${component}>`,
|
|
74
|
+
insertAfter && componentDepth + insertAfter
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
function buildOpeningTag(componentName, props) {
|
|
78
|
+
const propsString = (() => {
|
|
79
|
+
switch (typeof props) {
|
|
80
|
+
case "undefined":
|
|
81
|
+
return "";
|
|
82
|
+
case "object":
|
|
83
|
+
return objectToComponentProps(props, { raw: true }).join(" ");
|
|
84
|
+
case "string":
|
|
85
|
+
return props;
|
|
86
|
+
default:
|
|
87
|
+
throw new Error(
|
|
88
|
+
`Illegal argument passed for 'props'. Required: {Object | string | undefined}, got ${typeof props}`
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
})();
|
|
92
|
+
const possibleSpace = propsString.length ? " " : "";
|
|
93
|
+
return `<${componentName}${possibleSpace}${propsString}>`;
|
|
94
|
+
}
|
|
95
|
+
function objectToComponentProps(obj, options = { exclude: [], raw: false }) {
|
|
96
|
+
const props = [];
|
|
97
|
+
const doRaw = (key) => options.raw === true || Array.isArray(options.raw) && options.raw.includes(key);
|
|
98
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
99
|
+
if (options.exclude && options.exclude.includes(key)) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (doRaw(key)) {
|
|
103
|
+
props.push(`${key}={${value}}`);
|
|
104
|
+
} else {
|
|
105
|
+
props.push(`${key}="${value}"`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return props;
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
extendJSXFile,
|
|
112
|
+
fileIncludes,
|
|
113
|
+
objectToComponentProps
|
|
114
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
import { runCommandTask, getPaths } from "../lib/index.js";
|
|
5
|
+
const skipTask = (schema = getPaths().api.dbSchema) => {
|
|
6
|
+
if (!fs.existsSync(schema)) {
|
|
7
|
+
console.log(
|
|
8
|
+
`Skipping database and Prisma client generation, no \`schema.prisma\` file found: \`${schema}\``
|
|
9
|
+
);
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
};
|
|
14
|
+
const generatePrismaCommand = (schema) => {
|
|
15
|
+
if (skipTask(schema)) {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
const createdRequire = createRequire(import.meta.url);
|
|
19
|
+
const prismaIndexPath = createdRequire.resolve("prisma/build/index.js");
|
|
20
|
+
return {
|
|
21
|
+
cmd: `node "${prismaIndexPath}"`,
|
|
22
|
+
args: ["generate", schema && `--schema="${schema}"`]
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
const generatePrismaClient = async ({
|
|
26
|
+
verbose = true,
|
|
27
|
+
force = true,
|
|
28
|
+
silent = false,
|
|
29
|
+
schema = getPaths().api.dbSchema
|
|
30
|
+
}) => {
|
|
31
|
+
if (skipTask(schema)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (!force) {
|
|
35
|
+
const prismaClientPath = path.join(
|
|
36
|
+
getPaths().base,
|
|
37
|
+
"node_modules/.prisma/client/index.js"
|
|
38
|
+
);
|
|
39
|
+
const prismaClientFile = fs.readFileSync(prismaClientPath, "utf8");
|
|
40
|
+
if (!prismaClientFile.includes("@prisma/client did not initialize yet.") && prismaClientFile.includes("exports.Prisma.")) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
await runCommandTask(
|
|
45
|
+
[
|
|
46
|
+
{
|
|
47
|
+
title: "Generating the Prisma client...",
|
|
48
|
+
...generatePrismaCommand(schema)
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
{
|
|
52
|
+
verbose,
|
|
53
|
+
silent
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
generatePrismaClient,
|
|
59
|
+
generatePrismaCommand
|
|
60
|
+
};
|