@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,386 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
|
|
4
|
+
import execa from "execa";
|
|
5
|
+
import { Listr } from "listr2";
|
|
6
|
+
import terminalLink from "terminal-link";
|
|
7
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
8
|
+
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
9
|
+
import c from "../../../../lib/colors.js";
|
|
10
|
+
import { getPaths, usingVSCode } from "../../../../lib/index.js";
|
|
11
|
+
const tailwindDirectives = [
|
|
12
|
+
"@tailwind base;",
|
|
13
|
+
"@tailwind components;",
|
|
14
|
+
"@tailwind utilities;"
|
|
15
|
+
];
|
|
16
|
+
const tailwindDirectivesExist = (indexCSS) => tailwindDirectives.every(
|
|
17
|
+
(tailwindDirective) => indexCSS.includes(tailwindDirective)
|
|
18
|
+
);
|
|
19
|
+
const tailwindImportsAndNotes = [
|
|
20
|
+
"/**",
|
|
21
|
+
" * START --- SETUP TAILWINDCSS EDIT",
|
|
22
|
+
" *",
|
|
23
|
+
" * `yarn rw setup ui tailwindcss` placed these directives here",
|
|
24
|
+
" * to inject Tailwind's styles into your CSS.",
|
|
25
|
+
" * For more information, see: https://tailwindcss.com/docs/installation",
|
|
26
|
+
" */",
|
|
27
|
+
...tailwindDirectives,
|
|
28
|
+
"/**",
|
|
29
|
+
" * END --- SETUP TAILWINDCSS EDIT",
|
|
30
|
+
" */\n"
|
|
31
|
+
];
|
|
32
|
+
const recommendedVSCodeExtensions = [
|
|
33
|
+
"csstools.postcss",
|
|
34
|
+
"bradlc.vscode-tailwindcss"
|
|
35
|
+
];
|
|
36
|
+
const recommendationTexts = {
|
|
37
|
+
"csstools.postcss": terminalLink(
|
|
38
|
+
"PostCSS Language Support",
|
|
39
|
+
"https://marketplace.visualstudio.com/items?itemName=csstools.postcss"
|
|
40
|
+
),
|
|
41
|
+
"bradlc.vscode-tailwindcss": terminalLink(
|
|
42
|
+
"Tailwind CSS IntelliSense",
|
|
43
|
+
"https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss"
|
|
44
|
+
)
|
|
45
|
+
};
|
|
46
|
+
async function recommendExtensionsToInstall() {
|
|
47
|
+
if (!usingVSCode()) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
let recommendations = [];
|
|
51
|
+
try {
|
|
52
|
+
const { stdout } = await execa("code", ["--list-extensions"]);
|
|
53
|
+
const installedExtensions = stdout.split("\n").map((ext) => ext.trim());
|
|
54
|
+
recommendations = recommendedVSCodeExtensions.filter(
|
|
55
|
+
(ext) => !installedExtensions.includes(ext)
|
|
56
|
+
);
|
|
57
|
+
} catch {
|
|
58
|
+
recommendations = recommendedVSCodeExtensions;
|
|
59
|
+
}
|
|
60
|
+
if (recommendations.length > 0) {
|
|
61
|
+
console.log();
|
|
62
|
+
console.log(
|
|
63
|
+
c.info(
|
|
64
|
+
"For the best experience we recommend that you install the following " + (recommendations.length === 1 ? "extension:" : "extensions:")
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
recommendations.forEach((extension) => {
|
|
68
|
+
console.log(c.info(" " + recommendationTexts[extension]));
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const handler = async ({ force, install }) => {
|
|
73
|
+
recordTelemetryAttributes({
|
|
74
|
+
command: "setup ui tailwindcss",
|
|
75
|
+
force,
|
|
76
|
+
install
|
|
77
|
+
});
|
|
78
|
+
const rwPaths = getPaths();
|
|
79
|
+
const projectPackages = ["prettier-plugin-tailwindcss@^0.5.12"];
|
|
80
|
+
const webWorkspacePackages = [
|
|
81
|
+
"postcss",
|
|
82
|
+
"postcss-loader",
|
|
83
|
+
"tailwindcss@^3.4.17",
|
|
84
|
+
"autoprefixer"
|
|
85
|
+
];
|
|
86
|
+
const tasks = new Listr(
|
|
87
|
+
[
|
|
88
|
+
{
|
|
89
|
+
title: "Installing project-wide packages...",
|
|
90
|
+
skip: () => !install,
|
|
91
|
+
task: () => {
|
|
92
|
+
return new Listr(
|
|
93
|
+
[
|
|
94
|
+
{
|
|
95
|
+
title: `Install ${projectPackages.join(", ")}`,
|
|
96
|
+
task: async () => {
|
|
97
|
+
const yarnVersion = await execa("yarn", ["--version"]);
|
|
98
|
+
const isYarnV1 = yarnVersion.stdout.trim().startsWith("1");
|
|
99
|
+
await execa(
|
|
100
|
+
"yarn",
|
|
101
|
+
[
|
|
102
|
+
"add",
|
|
103
|
+
"-D",
|
|
104
|
+
...isYarnV1 ? ["-W"] : [],
|
|
105
|
+
...projectPackages
|
|
106
|
+
],
|
|
107
|
+
{
|
|
108
|
+
cwd: rwPaths.base
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
{ rendererOptions: { collapseSubtasks: false } }
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
title: "Installing web side packages...",
|
|
120
|
+
skip: () => !install,
|
|
121
|
+
task: () => {
|
|
122
|
+
return new Listr(
|
|
123
|
+
[
|
|
124
|
+
{
|
|
125
|
+
title: `Install ${webWorkspacePackages.join(", ")}`,
|
|
126
|
+
task: async () => {
|
|
127
|
+
await execa(
|
|
128
|
+
"yarn",
|
|
129
|
+
["workspace", "web", "add", "-D", ...webWorkspacePackages],
|
|
130
|
+
{
|
|
131
|
+
cwd: rwPaths.base
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
{ rendererOptions: { collapseSubtasks: false } }
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
title: "Configuring PostCSS...",
|
|
143
|
+
task: () => {
|
|
144
|
+
const postCSSConfigPath = rwPaths.web.postcss;
|
|
145
|
+
if (!force && fs.existsSync(postCSSConfigPath)) {
|
|
146
|
+
throw new Error(
|
|
147
|
+
"PostCSS config already exists.\nUse --force to override existing config."
|
|
148
|
+
);
|
|
149
|
+
} else {
|
|
150
|
+
const postCSSConfig = fs.readFileSync(
|
|
151
|
+
path.join(
|
|
152
|
+
import.meta.dirname,
|
|
153
|
+
"../templates/postcss.config.js.template"
|
|
154
|
+
),
|
|
155
|
+
"utf-8"
|
|
156
|
+
);
|
|
157
|
+
fs.mkdirSync(path.dirname(postCSSConfigPath), { recursive: true });
|
|
158
|
+
return fs.writeFileSync(postCSSConfigPath, postCSSConfig);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
title: "Initializing Tailwind CSS...",
|
|
164
|
+
task: async () => {
|
|
165
|
+
const tailwindConfigPath = path.join(
|
|
166
|
+
rwPaths.web.config,
|
|
167
|
+
"tailwind.config.js"
|
|
168
|
+
);
|
|
169
|
+
if (fs.existsSync(tailwindConfigPath)) {
|
|
170
|
+
if (force) {
|
|
171
|
+
fs.unlinkSync(tailwindConfigPath);
|
|
172
|
+
} else {
|
|
173
|
+
throw new Error(
|
|
174
|
+
"Tailwind CSS config already exists.\nUse --force to override existing config."
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
await execa("yarn", ["tailwindcss", "init", tailwindConfigPath], {
|
|
179
|
+
cwd: rwPaths.web.base
|
|
180
|
+
});
|
|
181
|
+
const tailwindConfig = fs.readFileSync(tailwindConfigPath, "utf-8");
|
|
182
|
+
const newTailwindConfig = 'const { join } = require("node:path");\n\n' + tailwindConfig.replace(
|
|
183
|
+
"content: []",
|
|
184
|
+
"content: [join(__dirname, '../src/**/*.{js,jsx,ts,tsx}')]"
|
|
185
|
+
);
|
|
186
|
+
fs.writeFileSync(tailwindConfigPath, newTailwindConfig);
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
title: "Adding directives to index.css...",
|
|
191
|
+
task: (_ctx, task) => {
|
|
192
|
+
const INDEX_CSS_PATH = path.join(rwPaths.web.src, "index.css");
|
|
193
|
+
const indexCSS = fs.readFileSync(INDEX_CSS_PATH, "utf-8");
|
|
194
|
+
if (tailwindDirectivesExist(indexCSS)) {
|
|
195
|
+
task.skip("Directives already exist in index.css");
|
|
196
|
+
} else {
|
|
197
|
+
const newIndexCSS = tailwindImportsAndNotes.join("\n") + indexCSS;
|
|
198
|
+
fs.writeFileSync(INDEX_CSS_PATH, newIndexCSS);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
title: "Updating 'scaffold.css' to use tailwind classes...",
|
|
204
|
+
skip: () => {
|
|
205
|
+
return !fs.existsSync(path.join(rwPaths.web.src, "scaffold.css")) && "No 'scaffold.css' file to update";
|
|
206
|
+
},
|
|
207
|
+
task: async (_ctx, task) => {
|
|
208
|
+
const prompt = task.prompt(ListrEnquirerPromptAdapter);
|
|
209
|
+
const overrideScaffoldCss = force || await prompt.run({
|
|
210
|
+
type: "Confirm",
|
|
211
|
+
message: "Do you want to override your 'scaffold.css' to use tailwind classes?"
|
|
212
|
+
});
|
|
213
|
+
if (!overrideScaffoldCss) {
|
|
214
|
+
return task.skip("Skipping 'scaffold.css' update");
|
|
215
|
+
}
|
|
216
|
+
const tailwindScaffoldTemplate = fs.readFileSync(
|
|
217
|
+
path.join(
|
|
218
|
+
import.meta.dirname,
|
|
219
|
+
"..",
|
|
220
|
+
"..",
|
|
221
|
+
"..",
|
|
222
|
+
"generate",
|
|
223
|
+
"scaffold",
|
|
224
|
+
"templates",
|
|
225
|
+
"assets",
|
|
226
|
+
"scaffold.tailwind.css.template"
|
|
227
|
+
)
|
|
228
|
+
);
|
|
229
|
+
fs.writeFileSync(
|
|
230
|
+
path.join(rwPaths.web.src, "scaffold.css"),
|
|
231
|
+
tailwindScaffoldTemplate
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
title: "Adding recommended VS Code extensions to project settings...",
|
|
237
|
+
skip: () => !usingVSCode() && "Looks like you're not using VS Code",
|
|
238
|
+
task: () => {
|
|
239
|
+
const VS_CODE_EXTENSIONS_PATH = path.join(
|
|
240
|
+
rwPaths.base,
|
|
241
|
+
".vscode/extensions.json"
|
|
242
|
+
);
|
|
243
|
+
let originalExtensionsJson = { recommendations: [] };
|
|
244
|
+
if (fs.existsSync(VS_CODE_EXTENSIONS_PATH)) {
|
|
245
|
+
const originalExtensionsFile = fs.readFileSync(
|
|
246
|
+
VS_CODE_EXTENSIONS_PATH,
|
|
247
|
+
"utf-8"
|
|
248
|
+
);
|
|
249
|
+
originalExtensionsJson = JSON.parse(originalExtensionsFile);
|
|
250
|
+
}
|
|
251
|
+
const newExtensionsJson = {
|
|
252
|
+
...originalExtensionsJson,
|
|
253
|
+
recommendations: [
|
|
254
|
+
...originalExtensionsJson.recommendations,
|
|
255
|
+
...recommendedVSCodeExtensions
|
|
256
|
+
]
|
|
257
|
+
};
|
|
258
|
+
fs.writeFileSync(
|
|
259
|
+
VS_CODE_EXTENSIONS_PATH,
|
|
260
|
+
JSON.stringify(newExtensionsJson, null, 2)
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
title: "Adding tailwind intellisense plugin configuration to VS Code settings...",
|
|
266
|
+
skip: () => !usingVSCode() && "Looks like you're not using VS Code",
|
|
267
|
+
task: () => {
|
|
268
|
+
const VS_CODE_SETTINGS_PATH = path.join(
|
|
269
|
+
rwPaths.base,
|
|
270
|
+
".vscode/settings.json"
|
|
271
|
+
);
|
|
272
|
+
const classAttributes = [
|
|
273
|
+
"class",
|
|
274
|
+
"className",
|
|
275
|
+
"activeClassName",
|
|
276
|
+
"errorClassName"
|
|
277
|
+
];
|
|
278
|
+
let newSettingsJson = {
|
|
279
|
+
["tailwindCSS.classAttributes"]: classAttributes
|
|
280
|
+
};
|
|
281
|
+
if (fs.existsSync(VS_CODE_SETTINGS_PATH)) {
|
|
282
|
+
const originalSettingsFile = fs.readFileSync(
|
|
283
|
+
VS_CODE_SETTINGS_PATH,
|
|
284
|
+
"utf-8"
|
|
285
|
+
);
|
|
286
|
+
const originalSettingsJson = JSON.parse(
|
|
287
|
+
originalSettingsFile || "{}"
|
|
288
|
+
);
|
|
289
|
+
const originalTwClassAttributesJson = originalSettingsJson["tailwindCSS.classAttributes"] || [];
|
|
290
|
+
const mergedClassAttributes = Array.from(
|
|
291
|
+
/* @__PURE__ */ new Set([...classAttributes, ...originalTwClassAttributesJson])
|
|
292
|
+
);
|
|
293
|
+
newSettingsJson = {
|
|
294
|
+
...originalSettingsJson,
|
|
295
|
+
["tailwindCSS.classAttributes"]: mergedClassAttributes
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
fs.writeFileSync(
|
|
299
|
+
VS_CODE_SETTINGS_PATH,
|
|
300
|
+
JSON.stringify(newSettingsJson, null, 2) + "\n"
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
title: "Adding tailwind config entry in prettier...",
|
|
306
|
+
task: async (_ctx) => {
|
|
307
|
+
const prettierConfigPath = path.join(
|
|
308
|
+
rwPaths.base,
|
|
309
|
+
"prettier.config.js"
|
|
310
|
+
);
|
|
311
|
+
const prettierConfig = fs.readFileSync(prettierConfigPath, "utf-8");
|
|
312
|
+
const tailwindConfigPath = path.relative(
|
|
313
|
+
rwPaths.base,
|
|
314
|
+
path.posix.join(rwPaths.web.config, "tailwind.config.js")
|
|
315
|
+
).replaceAll("\\", "/");
|
|
316
|
+
let newPrettierConfig = prettierConfig;
|
|
317
|
+
if (newPrettierConfig.includes("tailwindConfig: ")) {
|
|
318
|
+
if (force) {
|
|
319
|
+
newPrettierConfig = newPrettierConfig.replace(
|
|
320
|
+
/tailwindConfig: .*(,)?/,
|
|
321
|
+
`tailwindConfig: './${tailwindConfigPath}',`
|
|
322
|
+
);
|
|
323
|
+
} else {
|
|
324
|
+
throw new Error(
|
|
325
|
+
"tailwindConfig setting already exists in prettier configuration.\nUse --force to override existing config."
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
} else {
|
|
329
|
+
newPrettierConfig = newPrettierConfig.replace(
|
|
330
|
+
/,(\n\s*)(\}\n?)$/,
|
|
331
|
+
`,
|
|
332
|
+
tailwindConfig: './${tailwindConfigPath}',$1$2`
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
fs.writeFileSync(prettierConfigPath, newPrettierConfig);
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
title: "Adding tailwind prettier plugin...",
|
|
340
|
+
task: async (_ctx, task) => {
|
|
341
|
+
const prettierConfigPath = path.join(
|
|
342
|
+
rwPaths.base,
|
|
343
|
+
"prettier.config.js"
|
|
344
|
+
);
|
|
345
|
+
const prettierConfig = fs.readFileSync(prettierConfigPath, "utf-8");
|
|
346
|
+
let newPrettierConfig = prettierConfig;
|
|
347
|
+
if (newPrettierConfig.includes("plugins: [")) {
|
|
348
|
+
const pluginsMatch = newPrettierConfig.match(
|
|
349
|
+
/plugins: \[[\sa-z\(\)'\-,]*]/
|
|
350
|
+
);
|
|
351
|
+
const matched = pluginsMatch && pluginsMatch[0];
|
|
352
|
+
if (matched && (matched.includes("'prettier-plugin-tailwindcss'") || matched.includes('"prettier-plugin-tailwindcss"'))) {
|
|
353
|
+
task.skip(
|
|
354
|
+
"tailwindcss-plugin-prettier already required in plugins"
|
|
355
|
+
);
|
|
356
|
+
} else {
|
|
357
|
+
newPrettierConfig = newPrettierConfig.replace(
|
|
358
|
+
/plugins: \[(\n\s+)*/,
|
|
359
|
+
`plugins: [$'prettier-plugin-tailwindcss',$1`
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
} else {
|
|
363
|
+
newPrettierConfig = newPrettierConfig.replace(
|
|
364
|
+
/,(\n\s*)(\}\n?)$/,
|
|
365
|
+
`,
|
|
366
|
+
plugins: ['prettier-plugin-tailwindcss'],$1$2`
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
fs.writeFileSync(prettierConfigPath, newPrettierConfig);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
],
|
|
373
|
+
{ rendererOptions: { collapseSubtasks: false } }
|
|
374
|
+
);
|
|
375
|
+
try {
|
|
376
|
+
await tasks.run();
|
|
377
|
+
await recommendExtensionsToInstall();
|
|
378
|
+
} catch (e) {
|
|
379
|
+
errorTelemetry(process.argv, e.message);
|
|
380
|
+
console.error(c.error(e.message));
|
|
381
|
+
process.exit(e?.exitCode || 1);
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
export {
|
|
385
|
+
handler
|
|
386
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { ChakraProvider, extendTheme } from '@chakra-ui/react'
|
|
4
|
+
import type { Preview, StoryFn } from '@storybook/react'
|
|
5
|
+
import theme from 'config/chakra.config'
|
|
6
|
+
|
|
7
|
+
const extendedTheme = extendTheme(theme)
|
|
8
|
+
|
|
9
|
+
/** @see {@link https://storybook.js.org/docs/7/essentials/toolbars-and-globals#create-a-decorator | Create a decorator} */
|
|
10
|
+
const withChakra = (Story: StoryFn) => (
|
|
11
|
+
<ChakraProvider theme={extendedTheme}>
|
|
12
|
+
<Story />
|
|
13
|
+
</ChakraProvider>
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
const preview: Preview = {
|
|
17
|
+
decorators: [withChakra]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default preview
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `postcss-preset-mantine` includes the following PostCSS plugins:
|
|
3
|
+
* - postcss-nested
|
|
4
|
+
* - postcss-mixins with Mantine specific mixins
|
|
5
|
+
* - Custom plugin with em/rem functions
|
|
6
|
+
* Read more: https://mantine.dev/styles/postcss-preset/
|
|
7
|
+
|
|
8
|
+
* `postcss-simple-vars` enables use of SCSS-like variables inside CSS files:
|
|
9
|
+
* ```postcss
|
|
10
|
+
* $blue : #056ef0;
|
|
11
|
+
* $width-sm: rem(37.5);
|
|
12
|
+
* $selector: .my-component
|
|
13
|
+
*
|
|
14
|
+
* @media (min-width: $width-sm) {
|
|
15
|
+
* $selector {
|
|
16
|
+
* background: $blue;
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
* Read more: https://github.com/postcss/postcss-simple-vars
|
|
21
|
+
*/
|
|
22
|
+
module.exports = {
|
|
23
|
+
plugins: [
|
|
24
|
+
require('postcss-preset-mantine'),
|
|
25
|
+
require('postcss-simple-vars')({
|
|
26
|
+
variables: {
|
|
27
|
+
'mantine-breakpoint-xs': '36em',
|
|
28
|
+
'mantine-breakpoint-sm': '48em',
|
|
29
|
+
'mantine-breakpoint-md': '62em',
|
|
30
|
+
'mantine-breakpoint-lg': '75em',
|
|
31
|
+
'mantine-breakpoint-xl': '88em',
|
|
32
|
+
},
|
|
33
|
+
}),
|
|
34
|
+
],
|
|
35
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { MantineProvider } from '@mantine/core'
|
|
4
|
+
import type { Preview, StoryFn } from '@storybook/react'
|
|
5
|
+
import theme from 'config/mantine.config'
|
|
6
|
+
|
|
7
|
+
import '@mantine/core/styles.css'
|
|
8
|
+
|
|
9
|
+
/** @see {@link https://storybook.js.org/docs/7/essentials/toolbars-and-globals#create-a-decorator | Create a decorator} */
|
|
10
|
+
const withMantine = (Story: StoryFn) => (
|
|
11
|
+
<MantineProvider theme={theme}>
|
|
12
|
+
<Story />
|
|
13
|
+
</MantineProvider>
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
const preview: Preview = {
|
|
17
|
+
decorators: [withMantine]
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import terminalLink from "terminal-link";
|
|
2
|
+
import * as libraryChakraUi from "./libraries/chakra-ui.js";
|
|
3
|
+
import * as libraryMantine from "./libraries/mantine.js";
|
|
4
|
+
import * as libraryTailwindCss from "./libraries/tailwindcss.js";
|
|
5
|
+
const command = "ui <library>";
|
|
6
|
+
const description = "Set up a UI design or style library";
|
|
7
|
+
const builder = (yargs) => yargs.command(libraryChakraUi).command(libraryMantine).command(libraryTailwindCss).demandCommand().epilogue(
|
|
8
|
+
`Also see the ${terminalLink(
|
|
9
|
+
"Redwood CLI Reference",
|
|
10
|
+
"https://redwoodjs.com/docs/cli-commands#setup-ui"
|
|
11
|
+
)}`
|
|
12
|
+
);
|
|
13
|
+
export {
|
|
14
|
+
builder,
|
|
15
|
+
command,
|
|
16
|
+
description
|
|
17
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import j from "jscodeshift";
|
|
2
|
+
function transform(fileInfo) {
|
|
3
|
+
const root = j(fileInfo.source);
|
|
4
|
+
const imports = root.find(j.ImportDeclaration);
|
|
5
|
+
imports.at(-1).insertAfter(
|
|
6
|
+
j.importDeclaration(
|
|
7
|
+
[j.importSpecifier(j.identifier("storagePrismaExtension"))],
|
|
8
|
+
j.literal("./uploads.js")
|
|
9
|
+
)
|
|
10
|
+
);
|
|
11
|
+
root.find(j.VariableDeclaration, { declarations: [{ id: { name: "db" } }] }).forEach((path) => {
|
|
12
|
+
const dbDeclaration = path.node.declarations[0];
|
|
13
|
+
if (j.VariableDeclarator.check(dbDeclaration) && j.NewExpression.check(dbDeclaration.init)) {
|
|
14
|
+
throw new Error("RW_CODEMOD_ERR_OLD_FORMAT");
|
|
15
|
+
}
|
|
16
|
+
if (j.VariableDeclarator.check(dbDeclaration) && j.Expression.check(dbDeclaration.init)) {
|
|
17
|
+
const newInit = j.callExpression(
|
|
18
|
+
j.memberExpression(dbDeclaration.init, j.identifier("$extends")),
|
|
19
|
+
[j.identifier("storagePrismaExtension")]
|
|
20
|
+
);
|
|
21
|
+
dbDeclaration.init = newInit;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return root.toSource();
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
transform as default
|
|
28
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { APIGatewayEvent, Context } from 'aws-lambda'
|
|
2
|
+
|
|
3
|
+
import type { SignatureValidationArgs } from '@cedarjs/storage/UrlSigner'
|
|
4
|
+
|
|
5
|
+
import { urlSigner, fsStorage } from 'src/lib/uploads'
|
|
6
|
+
|
|
7
|
+
export const handler = async (event: APIGatewayEvent, _context: Context) => {
|
|
8
|
+
const fileToReturn = urlSigner.validateSignature(
|
|
9
|
+
event.queryStringParameters as SignatureValidationArgs
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
const { contents, type } = await fsStorage.read(fileToReturn)
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
statusCode: 200,
|
|
16
|
+
headers: {
|
|
17
|
+
'Content-Type': type,
|
|
18
|
+
},
|
|
19
|
+
body: contents,
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createUploadsConfig, setupStorage } from '@cedarjs/storage'
|
|
2
|
+
import { FileSystemStorage } from '@cedarjs/storage/FileSystemStorage'
|
|
3
|
+
import { UrlSigner } from '@cedarjs/storage/UrlSigner'
|
|
4
|
+
|
|
5
|
+
const uploadsConfig = createUploadsConfig({
|
|
6
|
+
// Configure your fields here
|
|
7
|
+
// e.g. modelName: { fields: ['fieldWithUpload']}
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
export const fsStorage = new FileSystemStorage({
|
|
11
|
+
baseDir: './uploads',
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const urlSigner = new UrlSigner({
|
|
15
|
+
secret: process.env.UPLOADS_SECRET,
|
|
16
|
+
endpoint: '/signedUrl',
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const { saveFiles, storagePrismaExtension } = setupStorage({
|
|
20
|
+
uploadsConfig,
|
|
21
|
+
storageAdapter: fsStorage,
|
|
22
|
+
urlSigner,
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export { saveFiles, storagePrismaExtension }
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
2
|
+
const command = "uploads";
|
|
3
|
+
const description = "Setup uploads and storage. This will install the required packages and add the required initial configuration to your redwood app.";
|
|
4
|
+
const builder = (yargs) => {
|
|
5
|
+
yargs.option("force", {
|
|
6
|
+
alias: "f",
|
|
7
|
+
default: false,
|
|
8
|
+
description: "Overwrite existing configuration",
|
|
9
|
+
type: "boolean"
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
const handler = async (options) => {
|
|
13
|
+
recordTelemetryAttributes({
|
|
14
|
+
command: "setup uploads",
|
|
15
|
+
force: options.force,
|
|
16
|
+
skipExamples: options.skipExamples
|
|
17
|
+
});
|
|
18
|
+
const { handler: handler2 } = await import("./uploadsHandler.js");
|
|
19
|
+
return handler2(options);
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
builder,
|
|
23
|
+
command,
|
|
24
|
+
description,
|
|
25
|
+
handler
|
|
26
|
+
};
|