@cedarjs/cli 9.0.0-canary.1784 → 9.0.0-canary.3124

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/README.md +7 -10
  2. package/dist/cfw.js +10 -6
  3. package/dist/commands/build/buildHandler.js +220 -45
  4. package/dist/commands/build/buildPackagesTask.js +21 -20
  5. package/dist/commands/build.js +13 -2
  6. package/dist/commands/check.js +4 -6
  7. package/dist/commands/console.js +6 -4
  8. package/dist/commands/deploy/baremetal/SshExecutor.js +13 -4
  9. package/dist/commands/deploy/baremetal/baremetalHandler.js +116 -50
  10. package/dist/commands/deploy/baremetal.js +11 -4
  11. package/dist/commands/deploy/flightcontrolHandler.js +28 -15
  12. package/dist/commands/deploy/helpers/deployHandler.js +11 -6
  13. package/dist/commands/deploy/netlify.js +1 -1
  14. package/dist/commands/deploy/packing/nft.js +1 -2
  15. package/dist/commands/deploy/render.js +1 -1
  16. package/dist/commands/deploy/renderHandler.js +24 -13
  17. package/dist/commands/deploy/serverlessHandler.js +69 -27
  18. package/dist/commands/deploy/vercel.js +1 -1
  19. package/dist/commands/destroy/component/component.js +2 -3
  20. package/dist/commands/destroy/directive/directive.js +1 -3
  21. package/dist/commands/destroy/directive/directiveHandler.js +2 -4
  22. package/dist/commands/destroy/function/function.js +1 -3
  23. package/dist/commands/destroy/handlerHelpers.js +17 -17
  24. package/dist/commands/destroy/helpers.js +8 -2
  25. package/dist/commands/destroy/layout/layout.js +1 -2
  26. package/dist/commands/destroy/page/pageHandler.js +3 -3
  27. package/dist/commands/destroy/scaffold/scaffoldHandler.js +31 -12
  28. package/dist/commands/destroy/sdl/sdlHandler.js +3 -3
  29. package/dist/commands/dev/apiDebugFlag.js +5 -4
  30. package/dist/commands/dev/devHandler.js +219 -68
  31. package/dist/commands/dev/packageWatchCommands.js +8 -3
  32. package/dist/commands/dev.js +16 -6
  33. package/dist/commands/execHandler.js +49 -29
  34. package/dist/commands/experimental/live-queries/liveQueries.js +32 -0
  35. package/dist/commands/experimental/live-queries/liveQueriesHandler.js +448 -0
  36. package/dist/commands/experimental/live-queries/templates/liveQueriesListener.ts.template +153 -0
  37. package/dist/commands/experimental/live-queries/templates/migration.sql.template +100 -0
  38. package/dist/commands/experimental/setupInngest.js +2 -2
  39. package/dist/commands/experimental/setupInngestHandler.js +13 -12
  40. package/dist/commands/experimental/setupOpentelemetry.js +2 -2
  41. package/dist/commands/experimental/setupOpentelemetryHandler.js +14 -10
  42. package/dist/commands/experimental/setupReactCompiler.js +2 -2
  43. package/dist/commands/experimental/setupReactCompilerHandler.js +48 -33
  44. package/dist/commands/experimental/setupRsc.js +1 -1
  45. package/dist/commands/experimental/setupRscHandler.js +20 -16
  46. package/dist/commands/experimental/setupStreamingSsr.js +2 -2
  47. package/dist/commands/experimental/setupStreamingSsrHandler.js +49 -34
  48. package/dist/commands/experimental/templates/opentelemetry.ts.template +2 -1
  49. package/dist/commands/experimental/templates/rsc/Document.tsx.template +1 -1
  50. package/dist/commands/experimental/templates/rsc/entry.client.tsx.template +8 -8
  51. package/dist/commands/experimental/templates/streamingSsr/Document.tsx.template +1 -1
  52. package/dist/commands/experimental/templates/streamingSsr/entry.client.tsx.template +6 -6
  53. package/dist/commands/experimental/templates/streamingSsr/tsconfig.json.template +6 -6
  54. package/dist/commands/experimental/util.js +27 -25
  55. package/dist/commands/experimental.js +3 -2
  56. package/dist/commands/generate/cell/cell.js +20 -0
  57. package/dist/commands/generate/cell/cellHandler.js +89 -40
  58. package/dist/commands/generate/cell/templates/cell.tsx.template +21 -2
  59. package/dist/commands/generate/cell/templates/cellFragment.tsx.template +43 -0
  60. package/dist/commands/generate/cell/templates/cellList.tsx.template +21 -2
  61. package/dist/commands/generate/cell/templates/storiesFragment.tsx.template +23 -0
  62. package/dist/commands/generate/cell/templates/test.js.template +1 -1
  63. package/dist/commands/generate/cell/templates/testFragment.js.template +30 -0
  64. package/dist/commands/generate/component/componentHandler.js +14 -16
  65. package/dist/commands/generate/dataMigration/dataMigration.js +36 -18
  66. package/dist/commands/generate/dataMigration/templates/dataMigration.js.template +1 -1
  67. package/dist/commands/generate/dataMigration/templates/dataMigration.ts.template +1 -1
  68. package/dist/commands/generate/dbAuth/dbAuth.js +1 -0
  69. package/dist/commands/generate/dbAuth/dbAuthHandler.js +63 -34
  70. package/dist/commands/generate/dbAuth/templates/login.oauth.tsx.template +164 -0
  71. package/dist/commands/generate/dbAuth/templates/signup.oauth.tsx.template +147 -0
  72. package/dist/commands/generate/directive/directiveHandler.js +14 -16
  73. package/dist/commands/generate/function/function.js +1 -0
  74. package/dist/commands/generate/function/functionHandler.js +14 -19
  75. package/dist/commands/generate/helpers.js +34 -18
  76. package/dist/commands/generate/job/job.js +1 -0
  77. package/dist/commands/generate/job/jobHandler.js +20 -24
  78. package/dist/commands/generate/layout/layoutHandler.js +13 -16
  79. package/dist/commands/generate/model/model.js +1 -0
  80. package/dist/commands/generate/model/modelHandler.js +11 -5
  81. package/dist/commands/generate/ogImage/ogImage.js +1 -0
  82. package/dist/commands/generate/ogImage/ogImageHandler.js +18 -11
  83. package/dist/commands/generate/package/filesTask.js +9 -0
  84. package/dist/commands/generate/package/packageHandler.js +50 -61
  85. package/dist/commands/generate/package/templates/test.ts.template +2 -2
  86. package/dist/commands/generate/package/templates/vitest.config.ts.template +9 -0
  87. package/dist/commands/generate/page/pageHandler.js +27 -24
  88. package/dist/commands/generate/realtime/realtime.js +2 -2
  89. package/dist/commands/generate/realtime/realtimeHandler.js +51 -32
  90. package/dist/commands/generate/realtime/templates/subscriptions/blank/blank.ts.template +1 -1
  91. package/dist/commands/generate/scaffold/scaffold.js +1 -0
  92. package/dist/commands/generate/scaffold/scaffoldHandler.js +176 -49
  93. package/dist/commands/generate/scaffold/templates/lib/formatters.tsx.template +1 -1
  94. package/dist/commands/generate/script/script.js +1 -0
  95. package/dist/commands/generate/script/scriptHandler.js +10 -6
  96. package/dist/commands/generate/script/templates/script.ts.template +9 -4
  97. package/dist/commands/generate/script/templates/tsconfig.json.template +16 -2
  98. package/dist/commands/generate/sdl/sdl.js +4 -3
  99. package/dist/commands/generate/sdl/sdlHandler.js +135 -46
  100. package/dist/commands/generate/sdl/stubFiles.js +132 -0
  101. package/dist/commands/generate/sdl/templates/sdl.js.template +2 -1
  102. package/dist/commands/generate/sdl/templates/sdl.ts.template +2 -1
  103. package/dist/commands/generate/secret/secret.js +20 -20
  104. package/dist/commands/generate/service/service.js +5 -5
  105. package/dist/commands/generate/service/serviceHandler.js +126 -61
  106. package/dist/commands/generate/service/templates/scenarios.ts.template +4 -2
  107. package/dist/commands/generate/service/templates/service.ts.template +22 -8
  108. package/dist/commands/generate/service/templates/test.ts.template +2 -2
  109. package/dist/commands/generate/yargsCommandHelpers.js +7 -2
  110. package/dist/commands/generate/yargsHandlerHelpers.js +20 -18
  111. package/dist/commands/generate.js +4 -4
  112. package/dist/commands/info.js +2 -2
  113. package/dist/commands/jobsHandler.js +7 -4
  114. package/dist/commands/lint.js +26 -69
  115. package/dist/commands/prerenderHandler.js +95 -58
  116. package/dist/commands/prismaHandler.js +51 -26
  117. package/dist/commands/record/init.js +2 -2
  118. package/dist/commands/record.js +4 -3
  119. package/dist/commands/serve.js +245 -31
  120. package/dist/commands/serveApiHandler.js +7 -6
  121. package/dist/commands/serveBothHandler.js +22 -13
  122. package/dist/commands/serveWebHandler.js +3 -2
  123. package/dist/commands/setup/auth/auth.js +15 -11
  124. package/dist/commands/setup/cache/cache.js +1 -1
  125. package/dist/commands/setup/cache/cacheHandler.js +15 -9
  126. package/dist/commands/setup/database/database.js +15 -0
  127. package/dist/commands/setup/database/postgres.js +19 -0
  128. package/dist/commands/setup/database/postgresHandler.js +196 -0
  129. package/dist/commands/setup/database/templates/db.ts.template +32 -0
  130. package/dist/commands/setup/deploy/deploy.js +4 -3
  131. package/dist/commands/setup/deploy/helpers/helpers.js +5 -1
  132. package/dist/commands/setup/deploy/helpers/index.js +132 -6
  133. package/dist/commands/setup/deploy/providers/baremetalHandler.js +28 -6
  134. package/dist/commands/setup/deploy/providers/coherence.js +1 -1
  135. package/dist/commands/setup/deploy/providers/coherenceHandler.js +60 -31
  136. package/dist/commands/setup/deploy/providers/flightcontrolHandler.js +69 -51
  137. package/dist/commands/setup/deploy/providers/netlify.js +6 -0
  138. package/dist/commands/setup/deploy/providers/netlifyHandler.js +114 -13
  139. package/dist/commands/setup/deploy/providers/renderHandler.js +44 -41
  140. package/dist/commands/setup/deploy/providers/serverlessHandler.js +7 -5
  141. package/dist/commands/setup/deploy/providers/universal-deploy.js +11 -0
  142. package/dist/commands/setup/deploy/providers/universalDeployHandler.js +186 -0
  143. package/dist/commands/setup/deploy/providers/vercel.js +6 -0
  144. package/dist/commands/setup/deploy/providers/vercelHandler.js +115 -14
  145. package/dist/commands/setup/deploy/templates/baremetal.js +3 -2
  146. package/dist/commands/setup/deploy/templates/flightcontrol.js +60 -49
  147. package/dist/commands/setup/deploy/templates/netlify.js +2 -1
  148. package/dist/commands/setup/deploy/templates/netlifyUD.js +31 -0
  149. package/dist/commands/setup/deploy/templates/render.js +32 -17
  150. package/dist/commands/setup/docker/docker.js +2 -2
  151. package/dist/commands/setup/docker/dockerHandler.js +74 -39
  152. package/dist/commands/setup/docker/templates/Dockerfile.npm +119 -0
  153. package/dist/commands/setup/docker/templates/Dockerfile.pnpm +112 -0
  154. package/dist/commands/setup/docker/templates/{Dockerfile → Dockerfile.yarn} +4 -7
  155. package/dist/commands/setup/docker/templates/docker-compose.dev.yml +3 -3
  156. package/dist/commands/setup/docker/templates/docker-compose.prod.yml +2 -5
  157. package/dist/commands/setup/docker/templates/dockerignore +1 -0
  158. package/dist/commands/setup/generator/generator.js +1 -1
  159. package/dist/commands/setup/generator/generatorHandler.js +5 -4
  160. package/dist/commands/setup/graphql/features/fragments/appGqlConfigTransform.js +6 -3
  161. package/dist/commands/setup/graphql/features/fragments/fragments.js +1 -1
  162. package/dist/commands/setup/graphql/features/fragments/fragmentsHandler.js +5 -7
  163. package/dist/commands/setup/graphql/features/trustedDocuments/trustedDocuments.js +1 -1
  164. package/dist/commands/setup/graphql/features/trustedDocuments/trustedDocumentsHandler.js +4 -3
  165. package/dist/commands/setup/i18n/i18n.js +1 -1
  166. package/dist/commands/setup/i18n/i18nHandler.js +21 -17
  167. package/dist/commands/setup/jobs/jobs.js +1 -1
  168. package/dist/commands/setup/jobs/jobsHandler.js +17 -12
  169. package/dist/commands/setup/mailer/mailer.js +1 -1
  170. package/dist/commands/setup/mailer/mailerHandler.js +13 -11
  171. package/dist/commands/setup/middleware/ogImage/ogImage.js +1 -1
  172. package/dist/commands/setup/middleware/ogImage/ogImageHandler.js +2 -1
  173. package/dist/commands/setup/monitoring/sentry/sentry.js +1 -1
  174. package/dist/commands/setup/monitoring/sentry/sentryHandler.js +18 -12
  175. package/dist/commands/setup/neon/neon.js +35 -0
  176. package/dist/commands/setup/neon/neonHandler.js +264 -0
  177. package/dist/commands/setup/package/package.js +1 -1
  178. package/dist/commands/setup/package/packageHandler.js +18 -14
  179. package/dist/commands/setup/realtime/addRealtimeToGraphql.js +1 -1
  180. package/dist/commands/setup/realtime/realtime.js +1 -1
  181. package/dist/commands/setup/realtime/realtimeHandler.js +26 -37
  182. package/dist/commands/setup/realtime/templates/realtime.ts.template +1 -1
  183. package/dist/commands/setup/realtime/templates/subscriptions/countdown/countdown.ts.template +1 -1
  184. package/dist/commands/setup/realtime/templates/subscriptions/newMessage/newMessage.ts.template +1 -1
  185. package/dist/commands/setup/server-file/serverFile.js +1 -1
  186. package/dist/commands/setup/server-file/serverFileHandler.js +18 -10
  187. package/dist/commands/setup/tenancy/authCodemod.js +66 -0
  188. package/dist/commands/setup/tenancy/dbCodemod.js +64 -0
  189. package/dist/commands/setup/tenancy/graphqlCodemod.js +88 -0
  190. package/dist/commands/setup/tenancy/preflight.js +49 -0
  191. package/dist/commands/setup/tenancy/schemaPrisma.js +81 -0
  192. package/dist/commands/setup/tenancy/signupCodemod.js +153 -0
  193. package/dist/commands/setup/tenancy/templates/InvitePage.tsx.template +63 -0
  194. package/dist/commands/setup/tenancy/templates/OrgScope.tsx.template +40 -0
  195. package/dist/commands/setup/tenancy/templates/ensureDefaultOrganizations.dataMigration.ts.template +39 -0
  196. package/dist/commands/setup/tenancy/templates/organizations.scenarios.ts.template +59 -0
  197. package/dist/commands/setup/tenancy/templates/organizations.sdl.ts.template +89 -0
  198. package/dist/commands/setup/tenancy/templates/organizations.test.ts.template +389 -0
  199. package/dist/commands/setup/tenancy/templates/organizations.ts.template +394 -0
  200. package/dist/commands/setup/tenancy/templates/requireMembership.test.ts.template +35 -0
  201. package/dist/commands/setup/tenancy/templates/requireMembership.ts.template +25 -0
  202. package/dist/commands/setup/tenancy/tenancy.js +30 -0
  203. package/dist/commands/setup/tenancy/tenancyHandler.js +425 -0
  204. package/dist/commands/setup/ui/helpers/helpers.js +5 -1
  205. package/dist/commands/setup/ui/libraries/chakra-uiHandler.js +16 -8
  206. package/dist/commands/setup/ui/libraries/mantineHandler.js +26 -16
  207. package/dist/commands/setup/ui/libraries/tailwindcssHandler.js +40 -29
  208. package/dist/commands/setup/uploads/schemaPrisma.js +41 -0
  209. package/dist/commands/setup/uploads/serverFile.js +151 -0
  210. package/dist/commands/setup/uploads/templates/requireUploadToken.ts.template +15 -0
  211. package/dist/commands/setup/uploads/templates/srcLibUploads.ts.template +23 -24
  212. package/dist/commands/setup/uploads/templates/uploads.sdl.ts.template +79 -0
  213. package/dist/commands/setup/uploads/templates/uploads.ts.template +89 -0
  214. package/dist/commands/setup/uploads/templates/withDataUri.ts.template +14 -0
  215. package/dist/commands/setup/uploads/templates/withSignedUrl.ts.template +16 -0
  216. package/dist/commands/setup/uploads/uploads.js +49 -7
  217. package/dist/commands/setup/uploads/uploadsHandler.js +266 -72
  218. package/dist/commands/setup.js +5 -4
  219. package/dist/commands/studio.js +1 -1
  220. package/dist/commands/studioHandler.js +2 -2
  221. package/dist/commands/test/datasourceWarning.js +42 -0
  222. package/dist/commands/test/testHandler.js +104 -0
  223. package/dist/commands/test/viteVersionCheck.js +75 -0
  224. package/dist/commands/test.js +16 -19
  225. package/dist/commands/type-check.js +2 -1
  226. package/dist/commands/type-checkHandler.js +25 -18
  227. package/dist/commands/upgrade/preUpgradeScripts.js +11 -11
  228. package/dist/commands/upgrade/upgrade.js +4 -2
  229. package/dist/commands/upgrade/upgradeHandler.js +97 -73
  230. package/dist/index.js +15 -11
  231. package/dist/lib/background.js +22 -1
  232. package/dist/lib/configureStorybook.js +2 -2
  233. package/dist/lib/exec.js +68 -63
  234. package/dist/lib/exit.js +20 -5
  235. package/dist/lib/extendFile.js +23 -13
  236. package/dist/lib/generatePrismaClient.js +48 -12
  237. package/dist/lib/index.js +137 -106
  238. package/dist/lib/loadEnvFiles.js +1 -1
  239. package/dist/lib/locking.js +8 -4
  240. package/dist/lib/merge/algorithms.js +4 -1
  241. package/dist/lib/merge/index.js +78 -41
  242. package/dist/lib/merge/semanticIdentity.js +18 -6
  243. package/dist/lib/merge/strategy.js +86 -36
  244. package/dist/lib/packages.js +23 -13
  245. package/dist/lib/plugin.js +13 -7
  246. package/dist/lib/pluralHelpers.js +6 -2
  247. package/dist/lib/project.js +3 -1
  248. package/dist/lib/rollback.js +7 -7
  249. package/dist/lib/schemaHelpers.js +16 -19
  250. package/dist/lib/test.js +20 -5
  251. package/dist/lib/updateCheck.js +47 -18
  252. package/dist/middleware/checkNodeVersion.js +9 -4
  253. package/dist/middleware/{detectProjectRxVersion.js → detectProjectCedarVersion.js} +2 -2
  254. package/dist/plugin.js +18 -12
  255. package/dist/telemetry/exporter.js +12 -5
  256. package/dist/telemetry/index.js +4 -3
  257. package/dist/telemetry/resource.js +9 -12
  258. package/dist/telemetry/send.js +14 -10
  259. package/dist/testLib/cells.js +5 -3
  260. package/package.json +44 -41
  261. package/LICENSE +0 -21
  262. package/dist/commands/consoleHandler.js +0 -68
  263. package/dist/commands/setup/tsconfig/tsconfig.js +0 -25
  264. package/dist/commands/setup/tsconfig/tsconfigHandler.js +0 -59
  265. package/dist/commands/setup/uploads/dbCodemod.js +0 -28
  266. package/dist/commands/setup/uploads/templates/signedUrl.ts.template +0 -21
  267. package/dist/commands/setup/vite/templates/vite.config.ts.template +0 -19
  268. package/dist/commands/setup/vite/vite.js +0 -38
  269. package/dist/commands/setup/vite/viteHandler.js +0 -83
  270. package/dist/commands/testEsm.js +0 -36
  271. package/dist/commands/testHandler.js +0 -137
  272. package/dist/commands/testHandlerEsm.js +0 -85
  273. package/dist/commands/ts-to-js.js +0 -20
  274. package/dist/lib/cedarPluralize.js +0 -56
  275. package/dist/lib/colors.js +0 -18
  276. package/dist/testLib/getFilesWithPattern.js +0 -21
  277. /package/dist/{index.d.js → global.d.js} +0 -0
@@ -1,15 +1,53 @@
1
1
  import fs from "node:fs";
2
- import path from "path";
2
+ import path from "node:path";
3
+ import { pathToFileURL } from "node:url";
4
+ import { serve as serveSrvx } from "srvx";
3
5
  import { terminalLink } from "termi-link";
4
6
  import * as apiServerCLIConfig from "@cedarjs/api-server/apiCliConfig";
5
7
  import * as bothServerCLIConfig from "@cedarjs/api-server/bothCliConfig";
6
- import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
7
- import { projectIsEsm } from "@cedarjs/project-config";
8
+ import { colors as c } from "@cedarjs/cli-helpers/colors";
9
+ import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
8
10
  import * as webServerCLIConfig from "@cedarjs/web-server";
9
- import c from "../lib/colors.js";
10
11
  import { getPaths, getConfig } from "../lib/index.js";
11
12
  import { serverFileExists } from "../lib/project.js";
12
13
  import { webSsrServerHandler } from "./serveWebHandler.js";
14
+ function refuseServerFileUnderUD() {
15
+ console.error(
16
+ c.error(
17
+ "\n api/src/server.ts was detected, but a custom server file is not supported with --ud. It is a Fastify concept \u2014 anything registered there (Realtime, custom plugins, custom middleware) would silently be skipped if serving continued.\n"
18
+ )
19
+ );
20
+ process.exit(1);
21
+ }
22
+ function resolveUDEntryPath() {
23
+ const base = path.join(getPaths().api.dist, "ud", "index");
24
+ for (const ext of [".mjs", ".js"]) {
25
+ const entryPath = base + ext;
26
+ if (fs.existsSync(entryPath)) {
27
+ return entryPath;
28
+ }
29
+ }
30
+ return null;
31
+ }
32
+ async function startUDServer(entryPath, host, port) {
33
+ const mod = await import(pathToFileURL(entryPath).href);
34
+ const fetchable = mod.default ?? mod;
35
+ if (!fetchable || typeof fetchable.fetch !== "function") {
36
+ throw new Error(
37
+ `UD entry at ${entryPath} does not export a Fetchable (\`export default { fetch }\`).`
38
+ );
39
+ }
40
+ const server = serveSrvx({
41
+ ...fetchable,
42
+ port,
43
+ hostname: host,
44
+ gracefulShutdown: false,
45
+ manual: true
46
+ });
47
+ server.serve();
48
+ await server.ready();
49
+ return server;
50
+ }
13
51
  const command = "serve [side]";
14
52
  const description = "Start a server for serving both the api and web sides";
15
53
  const builder = async (yargs) => {
@@ -18,7 +56,14 @@ const builder = async (yargs) => {
18
56
  yargs.command({
19
57
  command: "$0",
20
58
  description: bothServerCLIConfig.description,
21
- builder: bothServerCLIConfig.builder,
59
+ builder: (yargs2) => {
60
+ bothServerCLIConfig.builder(yargs2);
61
+ return yargs2.option("ud", {
62
+ description: "Use the Universal Deploy server for the API side. The web side is served by the existing static file server. Pass --ud to opt in; the default is Fastify for both sides.",
63
+ type: "boolean",
64
+ default: false
65
+ });
66
+ },
22
67
  handler: async (argv) => {
23
68
  recordTelemetryAttributes({
24
69
  command: "serve",
@@ -26,25 +71,129 @@ const builder = async (yargs) => {
26
71
  host: argv.host,
27
72
  socket: argv.socket
28
73
  });
74
+ if (argv.ud) {
75
+ if (argv.port) {
76
+ console.error(
77
+ c.error(
78
+ "\n The --port flag is not supported with --ud. Use --web-port and --api-port instead.\n"
79
+ )
80
+ );
81
+ process.exit(1);
82
+ }
83
+ const udEntryPath = resolveUDEntryPath();
84
+ if (!udEntryPath) {
85
+ console.error(
86
+ c.error(
87
+ "\n Universal Deploy server entry not found. Please run `yarn cedar build --ud` before serving.\n"
88
+ )
89
+ );
90
+ process.exit(1);
91
+ }
92
+ const webDistIndexHtml = path.join(getPaths().web.dist, "index.html");
93
+ if (!fs.existsSync(webDistIndexHtml)) {
94
+ console.error(
95
+ c.error(
96
+ "\n Web build artifacts not found.\n Please run `yarn cedar build` before serving.\n"
97
+ )
98
+ );
99
+ process.exit(1);
100
+ }
101
+ if (serverFileExists()) {
102
+ refuseServerFileUnderUD();
103
+ }
104
+ const { getAPIHost, getAPIPort, getWebHost, getWebPort } = await import("@cedarjs/api-server/cliHelpers");
105
+ const apiPort = argv.apiPort ?? getAPIPort();
106
+ const apiHost = argv.apiHost ?? getAPIHost();
107
+ const webPort = argv.webPort ?? getWebPort({ isPublicSide: true });
108
+ const webHost = argv.webHost ?? getWebHost({ isPublicSide: true });
109
+ const apiRootPath = argv.apiRootPath ?? "/";
110
+ const apiTarget = `http://${apiHost.includes(":") ? `[${apiHost}]` : apiHost}:${apiPort}`;
111
+ const { staticMiddleware } = await import("srvx/static");
112
+ const apiUrl = getConfig().web.apiUrl;
113
+ const webDist = getPaths().web.dist;
114
+ const prerenderIndexPath = path.join(webDist, "200.html");
115
+ const fallbackIndexPath = fs.existsSync(prerenderIndexPath) ? prerenderIndexPath : path.join(webDist, "index.html");
116
+ const spaHtml = fs.readFileSync(fallbackIndexPath, "utf-8");
117
+ const webServer = serveSrvx({
118
+ // Dummy fetch handler. All requests are handled by middleware
119
+ fetch: async () => new Response("Not Found", { status: 404 }),
120
+ middleware: [
121
+ staticMiddleware({ dir: webDist }),
122
+ async (req, next) => {
123
+ const url = new URL(req.url, "http://localhost");
124
+ if (!url.pathname.startsWith(apiUrl)) {
125
+ return next();
126
+ }
127
+ const targetPath = url.pathname.slice(apiUrl.length) || "/";
128
+ const root = apiRootPath === "/" ? "" : apiRootPath;
129
+ const targetUrl = `${apiTarget}${root}${targetPath}${url.search}`;
130
+ const forwardedHeaders = new Headers(req.headers);
131
+ if (!forwardedHeaders.has("x-forwarded-host")) {
132
+ forwardedHeaders.set(
133
+ "x-forwarded-host",
134
+ req.headers.get("host") || url.host
135
+ );
136
+ }
137
+ if (!forwardedHeaders.has("x-forwarded-proto")) {
138
+ forwardedHeaders.set("x-forwarded-proto", "http");
139
+ }
140
+ return fetch(targetUrl, {
141
+ method: req.method,
142
+ headers: forwardedHeaders,
143
+ body: req.body,
144
+ // @ts-expect-error - `duplex` is required when forwarding a
145
+ // request body via fetch (Node 18+).
146
+ duplex: "half"
147
+ });
148
+ },
149
+ () => {
150
+ const headers = { "Content-Type": "text/html" };
151
+ return new Response(spaHtml, { headers });
152
+ }
153
+ ],
154
+ port: webPort,
155
+ hostname: webHost,
156
+ gracefulShutdown: false,
157
+ manual: true
158
+ });
159
+ webServer.serve();
160
+ await webServer.ready();
161
+ console.log(`Web server listening at http://${webHost}:${webPort}`);
162
+ process.stdout.write(
163
+ `API server starting at http://${apiHost}:${apiPort}...`
164
+ );
165
+ await startUDServer(udEntryPath, apiHost, apiPort);
166
+ process.stdout.write(
167
+ `\rAPI server listening at http://${apiHost}:${apiPort}
168
+ `
169
+ );
170
+ return;
171
+ }
29
172
  if (serverFileExists()) {
30
- const { bothServerFileHandler } = await import("./serveBothHandler.js");
31
- await bothServerFileHandler(argv);
173
+ const serveBothHandlers = await import("./serveBothHandler.js");
174
+ await serveBothHandlers.bothServerFileHandler(argv);
32
175
  } else if (rscEnabled || streamingEnabled) {
33
- const { bothSsrRscServerHandler } = await import("./serveBothHandler.js");
34
- await bothSsrRscServerHandler(argv, rscEnabled);
176
+ const serveBothHandlers = await import("./serveBothHandler.js");
177
+ await serveBothHandlers.bothSsrRscServerHandler(argv, rscEnabled);
35
178
  } else {
36
- if (!projectIsEsm()) {
37
- const { handler } = await import("@cedarjs/api-server/cjs/bothCliConfigHandler");
38
- await handler(argv);
39
- } else {
40
- await bothServerCLIConfig.handler(argv);
41
- }
179
+ await bothServerCLIConfig.handler(argv);
42
180
  }
43
181
  }
44
182
  }).command({
45
183
  command: "api",
46
184
  description: apiServerCLIConfig.description,
47
- builder: apiServerCLIConfig.builder,
185
+ builder: (yargs2) => {
186
+ if (typeof apiServerCLIConfig.builder === "function") {
187
+ apiServerCLIConfig.builder(yargs2);
188
+ }
189
+ return yargs2.option("ud", {
190
+ // UD serving is opt-in. Pass --ud to use the new srvx server instead
191
+ // of the legacy Fastify server.
192
+ description: "Use the Universal Deploy server. Pass --ud to opt in; the default is Fastify.",
193
+ type: "boolean",
194
+ default: false
195
+ });
196
+ },
48
197
  handler: async (argv) => {
49
198
  recordTelemetryAttributes({
50
199
  command: "serve",
@@ -53,16 +202,39 @@ const builder = async (yargs) => {
53
202
  socket: argv.socket,
54
203
  apiRootPath: argv.apiRootPath
55
204
  });
205
+ const { getAPIHost, getAPIPort } = await import("@cedarjs/api-server/cliHelpers");
206
+ const apiPort = argv.port ?? getAPIPort({ isPublicSide: true });
207
+ const apiHost = argv.host ?? getAPIHost({ isPublicSide: true });
208
+ argv.port = apiPort;
209
+ argv.host = apiHost;
210
+ if (argv.ud) {
211
+ if (serverFileExists()) {
212
+ refuseServerFileUnderUD();
213
+ }
214
+ const udEntryPath = resolveUDEntryPath();
215
+ if (!udEntryPath) {
216
+ console.error(
217
+ c.error(
218
+ "\n Universal Deploy server entry not found. Please run `yarn cedar build --ud` before serving.\n"
219
+ )
220
+ );
221
+ process.exit(1);
222
+ }
223
+ process.stdout.write(
224
+ `API server starting at http://${apiHost}:${apiPort}...`
225
+ );
226
+ await startUDServer(udEntryPath, apiHost, apiPort);
227
+ process.stdout.write(
228
+ `\rAPI server listening at http://${apiHost}:${apiPort}
229
+ `
230
+ );
231
+ return;
232
+ }
56
233
  if (serverFileExists()) {
57
234
  const { apiServerFileHandler } = await import("./serveApiHandler.js");
58
235
  await apiServerFileHandler(argv);
59
236
  } else {
60
- if (!projectIsEsm()) {
61
- const { handler } = await import("@cedarjs/api-server/cjs/apiCliConfigHandler");
62
- await handler(argv);
63
- } else {
64
- await apiServerCLIConfig.handler(argv);
65
- }
237
+ await apiServerCLIConfig.handler(argv);
66
238
  }
67
239
  }
68
240
  }).command({
@@ -88,7 +260,7 @@ const builder = async (yargs) => {
88
260
  command: "serve"
89
261
  });
90
262
  const positionalArgs = argv._;
91
- if (positionalArgs.includes("web") && !fs.existsSync(path.join(getPaths().web.dist), "index.html")) {
263
+ if (positionalArgs.includes("web") && !webSideIsBuilt(streamingEnabled || rscEnabled)) {
92
264
  console.error(
93
265
  c.error(
94
266
  "\n Please run `yarn cedar build web` before trying to serve web. \n"
@@ -114,23 +286,56 @@ const builder = async (yargs) => {
114
286
  );
115
287
  process.exit(1);
116
288
  }
289
+ if (argv.ud) {
290
+ const udEntryPath = resolveUDEntryPath();
291
+ if (!udEntryPath) {
292
+ console.error(
293
+ c.error(
294
+ "\n Universal Deploy server entry not found. Please run `yarn cedar build --ud` before serving.\n"
295
+ )
296
+ );
297
+ process.exit(1);
298
+ }
299
+ }
117
300
  }
118
301
  if (positionalArgs.length === 1) {
119
302
  if (!apiSideExists && !rscEnabled) {
120
303
  console.error(
121
304
  c.error(
122
- "\n Unable to serve the both sides as no `api` folder exists. Please use `yarn cedar serve web` instead. \n"
305
+ "\nUnable to serve web and api as no `api` folder exists. Please use `yarn cedar serve web` instead. \n"
123
306
  )
124
307
  );
125
308
  process.exit(1);
126
309
  }
127
- if (fs.existsSync(path.join(getPaths().api.base)) && !fs.existsSync(path.join(getPaths().api.dist)) || !fs.existsSync(path.join(getPaths().web.dist), "index.html")) {
128
- console.error(
129
- c.error(
130
- "\n Please run `yarn cedar build` before trying to serve your redwood app. \n"
131
- )
132
- );
133
- process.exit(1);
310
+ if (argv.ud) {
311
+ const udEntryPath = resolveUDEntryPath();
312
+ if (!udEntryPath) {
313
+ console.error(
314
+ c.error(
315
+ "\n Universal Deploy server entry not found. Please run `yarn cedar build --ud` before serving.\n"
316
+ )
317
+ );
318
+ process.exit(1);
319
+ }
320
+ const webDistIndexHtml = path.join(getPaths().web.dist, "index.html");
321
+ if (!fs.existsSync(webDistIndexHtml)) {
322
+ console.error(
323
+ c.error(
324
+ "\n Web build artifacts not found.\n Please run `yarn cedar build` before serving.\n"
325
+ )
326
+ );
327
+ process.exit(1);
328
+ }
329
+ } else {
330
+ const apiExistsButIsNotBuilt = apiSideExists && !fs.existsSync(getPaths().api.dist);
331
+ if (apiExistsButIsNotBuilt || !webSideIsBuilt(streamingEnabled || rscEnabled)) {
332
+ console.error(
333
+ c.error(
334
+ "\nPlease run `yarn cedar build` before trying to serve your Cedar app.\n"
335
+ )
336
+ );
337
+ process.exit(1);
338
+ }
134
339
  }
135
340
  }
136
341
  if (!process.env.NODE_ENV) {
@@ -143,6 +348,15 @@ const builder = async (yargs) => {
143
348
  )}`
144
349
  );
145
350
  };
351
+ function webSideIsBuilt(isStreamingOrRSC) {
352
+ if (isStreamingOrRSC) {
353
+ return fs.existsSync(
354
+ path.join(getPaths().web.distBrowser, "client-build-manifest.json")
355
+ );
356
+ } else {
357
+ return fs.existsSync(path.join(getPaths().web.dist, "index.html"));
358
+ }
359
+ }
146
360
  export {
147
361
  builder,
148
362
  command,
@@ -1,15 +1,16 @@
1
- import execa from "execa";
1
+ import { runBin } from "@cedarjs/cli-helpers/packageManager/exec";
2
2
  import { getPaths } from "@cedarjs/project-config";
3
- const apiServerFileHandler = async (argv) => {
4
- const args = ["node", "server.js", "--apiRootPath", argv.apiRootPath];
3
+ async function apiServerFileHandler(argv) {
4
+ const args = ["server.js", "--apiRootPath", argv.apiRootPath ?? "/"];
5
5
  if (argv.port) {
6
- args.push("--apiPort", argv.port);
6
+ args.push("--apiPort", String(argv.port));
7
7
  }
8
- await execa("yarn", args, {
8
+ const filteredArgs = args.filter((arg) => Boolean(arg));
9
+ await runBin("node", filteredArgs, {
9
10
  cwd: getPaths().api.dist,
10
11
  stdio: "inherit"
11
12
  });
12
- };
13
+ }
13
14
  export {
14
15
  apiServerFileHandler
15
16
  };
@@ -1,46 +1,53 @@
1
1
  import path from "path";
2
2
  import concurrently from "concurrently";
3
- import execa from "execa";
4
- import { handler as apiServerHandler } from "@cedarjs/api-server/cjs/apiCliConfigHandler";
3
+ import { handler as apiServerHandler } from "@cedarjs/api-server/apiCliConfigHandler";
5
4
  import {
6
5
  getAPIHost,
7
6
  getAPIPort,
7
+ getAPIRootPath,
8
8
  getWebHost,
9
9
  getWebPort
10
- } from "@cedarjs/api-server/cjs/cliHelpers";
10
+ } from "@cedarjs/api-server/cliHelpers";
11
+ import { formatRunBinCommand } from "@cedarjs/cli-helpers/packageManager/display";
12
+ import { runBin } from "@cedarjs/cli-helpers/packageManager/exec";
11
13
  import { getConfig, getPaths } from "@cedarjs/project-config";
12
14
  import { errorTelemetry } from "@cedarjs/telemetry";
13
15
  import { exitWithError } from "../lib/exit.js";
16
+ const hasStringMessage = (error) => {
17
+ const message = typeof error === "object" && error !== null ? Reflect.get(error, "message") : void 0;
18
+ return typeof error === "object" && error !== null && "message" in error && typeof message === "string";
19
+ };
14
20
  const bothServerFileHandler = async (argv) => {
15
21
  if (getConfig().experimental?.rsc?.enabled || getConfig().experimental?.streamingSsr?.enabled) {
16
22
  logSkippingFastifyWebServer();
17
- await execa("yarn", ["rw-serve-fe"], {
23
+ await runBin("cedar-serve-fe", [], {
18
24
  cwd: getPaths().web.base,
19
25
  stdio: "inherit"
20
26
  });
21
27
  } else {
22
28
  argv.apiPort ??= getAPIPort();
23
29
  argv.apiHost ??= getAPIHost();
24
- argv.webPort ??= getWebPort();
25
- argv.webHost ??= getWebHost();
30
+ argv.webPort ??= getWebPort({ isPublicSide: true });
31
+ argv.webHost ??= getWebHost({ isPublicSide: true });
32
+ const apiRootPath = argv.apiRootPath ?? getAPIRootPath();
26
33
  const apiProxyTarget = [
27
34
  "http://",
28
35
  argv.apiHost.includes(":") ? `[${argv.apiHost}]` : argv.apiHost,
29
36
  ":",
30
37
  argv.apiPort,
31
- argv.apiRootPath
38
+ apiRootPath
32
39
  ].join("");
33
40
  const { result } = concurrently(
34
41
  [
35
42
  {
36
43
  name: "api",
37
- command: `yarn node ${path.join("dist", "server.js")} --apiPort ${argv.apiPort} --apiHost ${argv.apiHost} --apiRootPath ${argv.apiRootPath}`,
44
+ command: `${formatRunBinCommand("node", [path.join("dist", "server.js"), "--apiPort", String(argv.apiPort), "--apiHost", argv.apiHost, "--apiRootPath", apiRootPath])}`,
38
45
  cwd: getPaths().api.base,
39
46
  prefixColor: "cyan"
40
47
  },
41
48
  {
42
49
  name: "web",
43
- command: `yarn rw-web-server --port ${argv.webPort} --host ${argv.webHost} --api-proxy-target ${apiProxyTarget}`,
50
+ command: `${formatRunBinCommand("cedar-web-server", ["--port", String(argv.webPort), "--host", argv.webHost, "--api-proxy-target", apiProxyTarget])}`,
44
51
  cwd: getPaths().base,
45
52
  prefixColor: "blue"
46
53
  }
@@ -54,10 +61,11 @@ const bothServerFileHandler = async (argv) => {
54
61
  try {
55
62
  await result;
56
63
  } catch (error) {
57
- if (typeof error?.message !== "undefined") {
64
+ const message = hasStringMessage(error) ? error.message : void 0;
65
+ if (typeof message !== "undefined") {
58
66
  errorTelemetry(
59
67
  process.argv,
60
- `Error concurrently starting sides: ${error.message}`
68
+ `Error concurrently starting sides: ${message}`
61
69
  );
62
70
  exitWithError(error);
63
71
  }
@@ -66,14 +74,15 @@ const bothServerFileHandler = async (argv) => {
66
74
  };
67
75
  const bothSsrRscServerHandler = async (argv, rscEnabled) => {
68
76
  const apiPromise = apiServerHandler({
69
- apiRootPath: argv.apiRootPath,
77
+ apiRootPath: argv.apiRootPath ?? getAPIRootPath(),
70
78
  host: argv.apiHost,
71
79
  port: argv.apiPort
72
80
  });
73
- const fePromise = execa("yarn", ["rw-serve-fe"], {
81
+ const fePromise = runBin("cedar-serve-fe", [], {
74
82
  cwd: getPaths().web.base,
75
83
  stdio: "inherit",
76
84
  env: rscEnabled ? {
85
+ ...process.env,
77
86
  // TODO (RSC): Is this how we want to do it? If so, we need to find a way
78
87
  // to merge this with users' NODE_OPTIONS
79
88
  NODE_OPTIONS: "--conditions react-server"
@@ -1,10 +1,11 @@
1
- import execa from "execa";
1
+ import { runBin } from "@cedarjs/cli-helpers/packageManager/exec";
2
2
  import { getPaths } from "@cedarjs/project-config";
3
3
  const webSsrServerHandler = async (rscEnabled) => {
4
- await execa("yarn", ["rw-serve-fe"], {
4
+ await runBin("cedar-serve-fe", [], {
5
5
  cwd: getPaths().web.base,
6
6
  stdio: "inherit",
7
7
  env: rscEnabled ? {
8
+ ...process.env,
8
9
  // TODO (RSC): Is this how we want to do it? If so, we need to find a way
9
10
  // to merge this with users' NODE_OPTIONS
10
11
  NODE_OPTIONS: "--conditions react-server"
@@ -1,11 +1,9 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
- import execa from "execa";
4
3
  import { terminalLink } from "termi-link";
5
- import {
6
- recordTelemetryAttributes,
7
- standardAuthBuilder
8
- } from "@cedarjs/cli-helpers";
4
+ import { standardAuthBuilder } from "@cedarjs/cli-helpers/auth/setupHelpers";
5
+ import { addRootPackages } from "@cedarjs/cli-helpers/packageManager/packages";
6
+ import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
9
7
  import { getPaths } from "../../../lib/index.js";
10
8
  const command = "auth <provider>";
11
9
  const description = "Set up an auth configuration";
@@ -198,7 +196,7 @@ async function getAuthSetupHandler(module) {
198
196
  } else {
199
197
  customRequire = require;
200
198
  }
201
- } catch (error) {
199
+ } catch {
202
200
  customRequire = require;
203
201
  }
204
202
  const packageJsonPath = customRequire.resolve("@cedarjs/cli/package.json");
@@ -216,22 +214,28 @@ async function getAuthSetupHandler(module) {
216
214
  if (packument.error) {
217
215
  throw new Error(packument.error);
218
216
  }
219
- } catch (error) {
217
+ } catch (e) {
220
218
  throw new Error(
221
- `Couldn't fetch packument for ${module}: ${error.message}`
219
+ `Couldn't fetch packument for ${module}: ${e instanceof Error ? e.message : String(e)}`
220
+ );
221
+ }
222
+ if (!packument.versions || typeof packument.versions !== "object" || Array.isArray(packument.versions)) {
223
+ throw new Error(
224
+ `Couldn't fetch packument for ${module}: invalid versions field`
222
225
  );
223
226
  }
224
227
  const versionIsPublished = Object.keys(packument.versions).includes(version);
225
228
  if (!versionIsPublished) {
226
229
  version = "canary";
227
230
  }
228
- await execa.command(`yarn add -D ${module}@${version}`, {
231
+ await addRootPackages([`${module}@${version}`], {
232
+ dev: true,
229
233
  stdio: "inherit",
230
234
  cwd: getPaths().base
231
235
  });
232
236
  }
233
237
  const setupModule = await import(module);
234
- return setupModule.default.handler;
238
+ return setupModule.handler;
235
239
  }
236
240
  function isInstalled(module) {
237
241
  const { dependencies, devDependencies } = JSON.parse(
@@ -254,7 +258,7 @@ function isInstalled(module) {
254
258
  return possiblePaths.some((modulePath) => {
255
259
  return fs.existsSync(path.join(modulePath, "package.json"));
256
260
  });
257
- } catch (error) {
261
+ } catch {
258
262
  return false;
259
263
  }
260
264
  }
@@ -1,5 +1,5 @@
1
1
  import { terminalLink } from "termi-link";
2
- import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
2
+ import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
3
3
  const command = "cache <client>";
4
4
  const description = "Sets up an init file for service caching";
5
5
  const builder = (yargs) => {
@@ -1,9 +1,10 @@
1
1
  import fs from "node:fs";
2
2
  import path from "path";
3
3
  import { Listr } from "listr2";
4
- import { addEnvVarTask } from "@cedarjs/cli-helpers";
4
+ import { terminalLink } from "termi-link";
5
+ import { colors as c } from "@cedarjs/cli-helpers/colors";
6
+ import { addEnvVarTask } from "@cedarjs/cli-helpers/project";
5
7
  import { errorTelemetry } from "@cedarjs/telemetry";
6
- import c from "../../../lib/colors.js";
7
8
  import { addPackagesTask, getPaths, writeFile } from "../../../lib/index.js";
8
9
  import { isTypeScriptProject } from "../../../lib/project.js";
9
10
  const CLIENT_PACKAGE_MAP = {
@@ -14,15 +15,18 @@ const CLIENT_HOST_MAP = {
14
15
  memcached: "localhost:11211",
15
16
  redis: "redis://localhost:6379"
16
17
  };
17
- const handler = async ({ client, force }) => {
18
- const extension = isTypeScriptProject ? "ts" : "js";
18
+ const handler = async ({
19
+ client,
20
+ force
21
+ }) => {
22
+ const extension = isTypeScriptProject() ? "ts" : "js";
19
23
  const tasks = new Listr([
20
24
  await addPackagesTask({
21
25
  packages: [CLIENT_PACKAGE_MAP[client]],
22
26
  side: "api"
23
27
  }),
24
28
  {
25
- title: `Writing api/src/lib/cache.js`,
29
+ title: `Writing api/src/lib/cache.${extension}`,
26
30
  task: () => {
27
31
  const template = fs.readFileSync(
28
32
  path.join(
@@ -51,7 +55,7 @@ const handler = async ({ client, force }) => {
51
55
  task.title = `One more thing...
52
56
 
53
57
  ${c.tip("Check out the Service Cache docs for config and usage:")}
54
- ${c.link("https://cedarjs.com/docs/services#caching")}
58
+ ${terminalLink("", "https://cedarjs.com/docs/services#caching")}
55
59
  `;
56
60
  }
57
61
  }
@@ -59,9 +63,11 @@ const handler = async ({ client, force }) => {
59
63
  try {
60
64
  await tasks.run();
61
65
  } catch (e) {
62
- errorTelemetry(process.argv, e.message);
63
- console.error(c.error(e.message));
64
- process.exit(e?.exitCode || 1);
66
+ const message = e instanceof Error ? e.message : String(e);
67
+ errorTelemetry(process.argv, message);
68
+ console.error(c.error(message));
69
+ const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
70
+ process.exit(exitCode);
65
71
  }
66
72
  };
67
73
  export {
@@ -0,0 +1,15 @@
1
+ import { terminalLink } from "termi-link";
2
+ import * as setupDatabasePostgres from "./postgres.js";
3
+ const command = "database <command>";
4
+ const description = "Switch your project's database";
5
+ const builder = (yargs) => yargs.command(setupDatabasePostgres).demandCommand().epilogue(
6
+ `Also see the ${terminalLink(
7
+ "CedarJS CLI Reference",
8
+ "https://cedarjs.com/docs/cli-commands#setup"
9
+ )}`
10
+ );
11
+ export {
12
+ builder,
13
+ command,
14
+ description
15
+ };
@@ -0,0 +1,19 @@
1
+ import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
2
+ const command = "postgres";
3
+ const description = "Switch your project from SQLite to PostgreSQL (schema, dependencies, and database adapter)";
4
+ function builder(yargs) {
5
+ return yargs;
6
+ }
7
+ async function handler() {
8
+ recordTelemetryAttributes({
9
+ command: "setup database postgres"
10
+ });
11
+ const { handler: handler2 } = await import("./postgresHandler.js");
12
+ return handler2();
13
+ }
14
+ export {
15
+ builder,
16
+ command,
17
+ description,
18
+ handler
19
+ };