@cedarjs/cli 7.0.1-next.467 → 7.1.0-rc.32

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 (194) hide show
  1. package/dist/commands/build/buildHandler.js +1 -2
  2. package/dist/commands/build.js +1 -1
  3. package/dist/commands/check.js +1 -2
  4. package/dist/commands/deploy/baremetal/baremetalHandler.js +73 -364
  5. package/dist/commands/deploy/baremetal.js +1 -7
  6. package/dist/commands/deploy/flightcontrolHandler.js +1 -1
  7. package/dist/commands/deploy/helpers/deployHandler.js +1 -1
  8. package/dist/commands/deploy/netlify.js +1 -1
  9. package/dist/commands/deploy/renderHandler.js +1 -1
  10. package/dist/commands/deploy/serverlessHandler.js +1 -2
  11. package/dist/commands/deploy/vercel.js +1 -1
  12. package/dist/commands/destroy/handlerHelpers.js +1 -1
  13. package/dist/commands/destroy/page/pageHandler.js +1 -2
  14. package/dist/commands/destroy/scaffold/scaffoldHandler.js +26 -65
  15. package/dist/commands/destroy/sdl/sdlHandler.js +1 -2
  16. package/dist/commands/dev/devHandler.js +4 -3
  17. package/dist/commands/dev/packageWatchCommands.js +3 -8
  18. package/dist/commands/dev.js +1 -1
  19. package/dist/commands/execHandler.js +1 -2
  20. package/dist/commands/experimental/live-queries/liveQueries.js +1 -1
  21. package/dist/commands/experimental/live-queries/liveQueriesHandler.js +3 -3
  22. package/dist/commands/experimental/setupInngest.js +1 -1
  23. package/dist/commands/experimental/setupInngestHandler.js +1 -1
  24. package/dist/commands/experimental/setupOpentelemetry.js +1 -1
  25. package/dist/commands/experimental/setupOpentelemetryHandler.js +1 -2
  26. package/dist/commands/experimental/setupReactCompiler.js +1 -1
  27. package/dist/commands/experimental/setupReactCompilerHandler.js +4 -4
  28. package/dist/commands/experimental/setupRsc.js +1 -1
  29. package/dist/commands/experimental/setupRscHandler.js +1 -2
  30. package/dist/commands/experimental/setupStreamingSsr.js +1 -1
  31. package/dist/commands/experimental/setupStreamingSsrHandler.js +2 -3
  32. package/dist/commands/generate/cell/cell.js +0 -20
  33. package/dist/commands/generate/cell/cellHandler.js +20 -68
  34. package/dist/commands/generate/cell/templates/cell.tsx.template +2 -21
  35. package/dist/commands/generate/cell/templates/cellList.tsx.template +2 -21
  36. package/dist/commands/generate/cell/templates/test.js.template +1 -1
  37. package/dist/commands/generate/dataMigration/dataMigration.js +1 -2
  38. package/dist/commands/generate/dbAuth/dbAuth.js +2 -6
  39. package/dist/commands/generate/dbAuth/dbAuthHandler.js +17 -80
  40. package/dist/commands/generate/dbAuth/templates/login.webAuthn.tsx.template +12 -20
  41. package/dist/commands/generate/directive/directiveHandler.js +1 -2
  42. package/dist/commands/generate/function/functionHandler.js +1 -2
  43. package/dist/commands/generate/helpers.js +0 -26
  44. package/dist/commands/generate/job/jobHandler.js +1 -2
  45. package/dist/commands/generate/model/modelHandler.js +1 -2
  46. package/dist/commands/generate/ogImage/ogImageHandler.js +1 -2
  47. package/dist/commands/generate/ogImage/templates/ogImage.og.tsx.template +1 -1
  48. package/dist/commands/generate/package/filesTask.js +12 -9
  49. package/dist/commands/generate/package/packageHandler.js +4 -3
  50. package/dist/commands/generate/package/templates/tsconfig.json.template +0 -1
  51. package/dist/commands/generate/page/pageHandler.js +1 -2
  52. package/dist/commands/generate/realtime/realtime.js +1 -1
  53. package/dist/commands/generate/realtime/realtimeHandler.js +9 -2
  54. package/dist/commands/generate/realtime/templates/liveQueries/blank/blank.service.ts.template +4 -12
  55. package/dist/commands/generate/realtime/templates/subscriptions/blank/blank.service.ts.template +2 -2
  56. package/dist/commands/generate/realtime/templates/subscriptions/blank/blank.ts.template +4 -4
  57. package/dist/commands/generate/scaffold/scaffold.js +1 -1
  58. package/dist/commands/generate/scaffold/scaffoldHandler.js +49 -93
  59. package/dist/commands/generate/scaffold/templates/assets/scaffold.tailwind.css.template +7 -12
  60. package/dist/commands/generate/scaffold/templates/components/EditNameCell.tsx.template +7 -5
  61. package/dist/commands/generate/scaffold/templates/components/NameForm.tsx.template +9 -10
  62. package/dist/commands/generate/scaffold/templates/lib/formatters.test.tsx.template +0 -11
  63. package/dist/commands/generate/scaffold/templates/lib/formatters.tsx.template +4 -16
  64. package/dist/commands/generate/script/scriptHandler.js +1 -2
  65. package/dist/commands/generate/script/templates/tsconfig.json.template +0 -1
  66. package/dist/commands/generate/sdl/sdlHandler.js +4 -10
  67. package/dist/commands/generate/secret/secret.js +1 -1
  68. package/dist/commands/generate/service/serviceHandler.js +49 -79
  69. package/dist/commands/generate/service/templates/service.ts.template +13 -40
  70. package/dist/commands/generate/service/templates/test.ts.template +6 -8
  71. package/dist/commands/generate/yargsCommandHelpers.js +1 -1
  72. package/dist/commands/generate/yargsHandlerHelpers.js +1 -2
  73. package/dist/commands/generate.js +1 -1
  74. package/dist/commands/info.js +1 -1
  75. package/dist/commands/jobsHandler.js +3 -5
  76. package/dist/commands/lint.js +1 -1
  77. package/dist/commands/prerenderHandler.js +4 -11
  78. package/dist/commands/prismaHandler.js +2 -7
  79. package/dist/commands/record/init.js +1 -1
  80. package/dist/commands/serve.js +1 -2
  81. package/dist/commands/setup/auth/auth.js +4 -2
  82. package/dist/commands/setup/cache/cache.js +1 -1
  83. package/dist/commands/setup/cache/cacheHandler.js +1 -2
  84. package/dist/commands/setup/cache/templates/memcached.ts.template +17 -14
  85. package/dist/commands/setup/cache/templates/redis.ts.template +20 -12
  86. package/dist/commands/setup/database/postgres.js +1 -1
  87. package/dist/commands/setup/database/postgresHandler.js +1 -3
  88. package/dist/commands/setup/deploy/providers/baremetal.js +0 -7
  89. package/dist/commands/setup/deploy/providers/baremetalHandler.js +21 -130
  90. package/dist/commands/setup/deploy/providers/coherence.js +1 -1
  91. package/dist/commands/setup/deploy/providers/coherenceHandler.js +6 -7
  92. package/dist/commands/setup/deploy/providers/flightcontrolHandler.js +1 -2
  93. package/dist/commands/setup/deploy/providers/netlifyHandler.js +1 -2
  94. package/dist/commands/setup/deploy/providers/renderHandler.js +1 -2
  95. package/dist/commands/setup/deploy/providers/serverlessHandler.js +1 -2
  96. package/dist/commands/setup/deploy/providers/universalDeployHandler.js +6 -4
  97. package/dist/commands/setup/deploy/providers/vercelHandler.js +1 -2
  98. package/dist/commands/setup/deploy/templates/baremetal.js +9 -119
  99. package/dist/commands/setup/deploy/templates/netlifyUD.js +0 -3
  100. package/dist/commands/setup/docker/docker.js +1 -1
  101. package/dist/commands/setup/docker/dockerHandler.js +1 -2
  102. package/dist/commands/setup/generator/generator.js +1 -1
  103. package/dist/commands/setup/generator/generatorHandler.js +1 -1
  104. package/dist/commands/setup/graphql/features/fragments/fragments.js +1 -1
  105. package/dist/commands/setup/graphql/features/fragments/fragmentsHandler.js +5 -3
  106. package/dist/commands/setup/graphql/features/trustedDocuments/trustedDocuments.js +1 -1
  107. package/dist/commands/setup/graphql/features/trustedDocuments/trustedDocumentsHandler.js +1 -2
  108. package/dist/commands/setup/i18n/i18n.js +1 -1
  109. package/dist/commands/setup/i18n/i18nHandler.js +1 -1
  110. package/dist/commands/setup/jobs/jobs.js +1 -1
  111. package/dist/commands/setup/jobs/jobsHandler.js +1 -4
  112. package/dist/commands/setup/mailer/mailer.js +1 -1
  113. package/dist/commands/setup/mailer/mailerHandler.js +1 -2
  114. package/dist/commands/setup/middleware/ogImage/ogImage.js +1 -1
  115. package/dist/commands/setup/middleware/ogImage/ogImageHandler.js +1 -2
  116. package/dist/commands/setup/monitoring/sentry/sentry.js +1 -1
  117. package/dist/commands/setup/monitoring/sentry/sentryHandler.js +9 -13
  118. package/dist/commands/setup/monitoring/sentry/templates/sentryApi.ts.template +4 -1
  119. package/dist/commands/setup/monitoring/sentry/templates/sentryWeb.ts.template +4 -7
  120. package/dist/commands/setup/neon/neon.js +1 -1
  121. package/dist/commands/setup/neon/neonHandler.js +9 -5
  122. package/dist/commands/setup/package/package.js +1 -1
  123. package/dist/commands/setup/package/packageHandler.js +4 -4
  124. package/dist/commands/setup/realtime/addRealtimeToGraphql.js +1 -1
  125. package/dist/commands/setup/realtime/realtime.js +1 -1
  126. package/dist/commands/setup/realtime/realtimeHandler.js +16 -4
  127. package/dist/commands/setup/realtime/templates/defer/fastAndSlowFields/fastAndSlowFields.ts.template +1 -4
  128. package/dist/commands/setup/realtime/templates/liveQueries/auctions/auctions.ts.template +4 -12
  129. package/dist/commands/setup/realtime/templates/subscriptions/countdown/countdown.ts.template +1 -1
  130. package/dist/commands/setup/realtime/templates/subscriptions/newMessage/newMessage.ts.template +2 -2
  131. package/dist/commands/setup/server-file/serverFile.js +1 -1
  132. package/dist/commands/setup/server-file/serverFileHandler.js +1 -2
  133. package/dist/commands/setup/ui/libraries/chakra-uiHandler.js +1 -2
  134. package/dist/commands/setup/ui/libraries/mantineHandler.js +1 -2
  135. package/dist/commands/setup/ui/libraries/tailwindcssHandler.js +82 -63
  136. package/dist/commands/setup/ui/templates/postcss.config.cjs.template +9 -0
  137. package/dist/commands/setup/uploads/dbCodemod.js +28 -0
  138. package/dist/commands/setup/uploads/templates/signedUrl.ts.template +21 -0
  139. package/dist/commands/setup/uploads/templates/srcLibUploads.ts.template +24 -23
  140. package/dist/commands/setup/uploads/uploads.js +7 -49
  141. package/dist/commands/setup/uploads/uploadsHandler.js +69 -277
  142. package/dist/commands/setup.js +1 -2
  143. package/dist/commands/studio.js +1 -1
  144. package/dist/commands/test/testHandler.js +71 -25
  145. package/dist/commands/test/testHandlerEsm.js +109 -0
  146. package/dist/commands/test.js +18 -10
  147. package/dist/commands/testEsm.js +41 -0
  148. package/dist/commands/type-checkHandler.js +1 -1
  149. package/dist/commands/upgrade/preUpgradeScripts.js +3 -3
  150. package/dist/commands/upgrade/upgrade.js +1 -1
  151. package/dist/commands/upgrade/upgradeHandler.js +1 -2
  152. package/dist/index.js +8 -5
  153. package/dist/lib/exit.js +1 -1
  154. package/dist/lib/index.js +31 -16
  155. package/dist/lib/loadEnvFiles.js +1 -1
  156. package/dist/lib/plugin.js +1 -1
  157. package/dist/lib/test.js +1 -1
  158. package/dist/lib/updateCheck.js +4 -4
  159. package/dist/middleware/checkNodeVersion.js +4 -4
  160. package/package.json +27 -27
  161. package/dist/commands/deploy/baremetal/monitors.js +0 -66
  162. package/dist/commands/generate/cell/templates/cellFragment.tsx.template +0 -43
  163. package/dist/commands/generate/cell/templates/storiesFragment.tsx.template +0 -23
  164. package/dist/commands/generate/cell/templates/testFragment.js.template +0 -30
  165. package/dist/commands/generate/dbAuth/templates/changePassword.tsx.template +0 -131
  166. package/dist/commands/generate/dbAuth/templates/login.oauth.tsx.template +0 -164
  167. package/dist/commands/generate/dbAuth/templates/signup.oauth.tsx.template +0 -147
  168. package/dist/commands/generate/scaffold/templates/layouts/NamesScaffoldLayout.tsx.template +0 -18
  169. package/dist/commands/setup/tenancy/authCodemod.js +0 -66
  170. package/dist/commands/setup/tenancy/dbCodemod.js +0 -64
  171. package/dist/commands/setup/tenancy/graphqlCodemod.js +0 -88
  172. package/dist/commands/setup/tenancy/preflight.js +0 -49
  173. package/dist/commands/setup/tenancy/schemaPrisma.js +0 -81
  174. package/dist/commands/setup/tenancy/signupCodemod.js +0 -154
  175. package/dist/commands/setup/tenancy/templates/InvitePage.tsx.template +0 -72
  176. package/dist/commands/setup/tenancy/templates/OrgScope.tsx.template +0 -40
  177. package/dist/commands/setup/tenancy/templates/ensureDefaultOrganizations.dataMigration.ts.template +0 -39
  178. package/dist/commands/setup/tenancy/templates/organizations.scenarios.ts.template +0 -57
  179. package/dist/commands/setup/tenancy/templates/organizations.sdl.ts.template +0 -89
  180. package/dist/commands/setup/tenancy/templates/organizations.test.ts.template +0 -381
  181. package/dist/commands/setup/tenancy/templates/organizations.ts.template +0 -394
  182. package/dist/commands/setup/tenancy/templates/requireMembership.test.ts.template +0 -35
  183. package/dist/commands/setup/tenancy/templates/requireMembership.ts.template +0 -25
  184. package/dist/commands/setup/tenancy/tenancy.js +0 -30
  185. package/dist/commands/setup/tenancy/tenancyHandler.js +0 -425
  186. package/dist/commands/setup/uploads/gitignore.js +0 -17
  187. package/dist/commands/setup/uploads/schemaPrisma.js +0 -41
  188. package/dist/commands/setup/uploads/serverFile.js +0 -217
  189. package/dist/commands/setup/uploads/templates/requireUploadToken.ts.template +0 -15
  190. package/dist/commands/setup/uploads/templates/uploads.sdl.ts.template +0 -79
  191. package/dist/commands/setup/uploads/templates/uploads.ts.template +0 -98
  192. package/dist/commands/setup/uploads/templates/withDataUri.ts.template +0 -14
  193. package/dist/commands/setup/uploads/templates/withSignedUrl.ts.template +0 -16
  194. package/dist/commands/test/viteVersionCheck.js +0 -75
@@ -1,5 +1,5 @@
1
1
  import { Listr } from "listr2";
2
- import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
2
+ import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
3
3
  import { deleteFilesTask } from "../../lib/index.js";
4
4
  function tasks({ componentName, filesFn, name }) {
5
5
  return new Listr(
@@ -1,7 +1,6 @@
1
1
  import camelcase from "camelcase";
2
2
  import { Listr } from "listr2";
3
- import { colors as c } from "@cedarjs/cli-helpers/colors";
4
- import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
3
+ import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
5
4
  import {
6
5
  deleteFilesTask,
7
6
  removeRoutesFromRouterTask
@@ -1,7 +1,7 @@
1
- import { parse } from "@babel/parser";
2
1
  import { Listr } from "listr2";
3
- import { colors as c } from "@cedarjs/cli-helpers/colors";
4
- import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
2
+ import pascalcase from "pascalcase";
3
+ import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
4
+ import { pluralize } from "@cedarjs/utils/cedarPluralize";
5
5
  import {
6
6
  deleteFilesTask,
7
7
  getPaths,
@@ -12,7 +12,6 @@ import {
12
12
  import { verifyModelName } from "../../../lib/schemaHelpers.js";
13
13
  import {
14
14
  files,
15
- getScaffoldLayoutNames,
16
15
  routes as scaffoldRoutes,
17
16
  splitPathAndModel
18
17
  } from "../../generate/scaffold/scaffoldHandler.js";
@@ -23,83 +22,45 @@ const removeRoutesWithSet = async ({
23
22
  }) => {
24
23
  const routes = await scaffoldRoutes({ model, path, nestScaffoldByModel });
25
24
  const routeNames = routes.map(extractRouteName);
26
- const { importName } = getScaffoldLayoutNames(model, path);
27
- return removeRoutesFromRouterTask(routeNames, importName);
28
- };
29
- const removeNamedImport = (code, source, name) => {
30
- const program = parse(code, {
31
- sourceType: "module",
32
- plugins: ["jsx", "typescript"]
33
- }).program;
34
- for (const statement of program.body) {
35
- if (statement.type !== "ImportDeclaration" || statement.source.value !== source) {
36
- continue;
37
- }
38
- const specifiers = statement.specifiers;
39
- const index = specifiers.findIndex(
40
- (specifier2) => specifier2.type === "ImportSpecifier" && specifier2.imported.type === "Identifier" && specifier2.imported.name === name && specifier2.local.name === name
41
- );
42
- if (index === -1) {
43
- continue;
44
- }
45
- const specifier = specifiers[index];
46
- let start;
47
- let end;
48
- if (specifiers.length === 1) {
49
- start = statement.start ?? 0;
50
- end = statement.end ?? 0;
51
- if (code[end] === "\n") {
52
- end++;
53
- }
54
- } else if (index === specifiers.length - 1) {
55
- start = specifiers[index - 1].end ?? 0;
56
- end = specifier.end ?? 0;
57
- } else {
58
- start = specifier.start ?? 0;
59
- end = specifiers[index + 1].start ?? 0;
60
- }
61
- return code.slice(0, start) + code.slice(end);
62
- }
63
- return code;
25
+ const pluralPascalName = pascalcase(pluralize(model));
26
+ const layoutName = `${pluralPascalName}Layout`;
27
+ return removeRoutesFromRouterTask(routeNames, layoutName);
64
28
  };
65
29
  const removeSetImport = () => {
66
30
  const routesPath = getPaths().web.routes;
67
31
  const routesContent = readFile(routesPath).toString();
68
- const unusedNames = ["Set", "PrivateSet"].filter(
69
- (name) => !new RegExp(`<${name}\\b`).test(routesContent)
70
- );
71
- if (unusedNames.length === 0) {
32
+ if (routesContent.match("<Set")) {
72
33
  return "Skipping removal of Set import in Routes.{jsx,tsx}";
73
34
  }
74
- let newRoutesContent = routesContent;
75
- try {
76
- for (const name of unusedNames) {
77
- newRoutesContent = removeNamedImport(
78
- newRoutesContent,
79
- "@cedarjs/router",
80
- name
81
- );
82
- }
83
- } catch {
84
- return "Skipping removal of Set import, Routes.{jsx,tsx} couldn't be parsed";
85
- }
86
- if (newRoutesContent === routesContent) {
87
- return "No unused Set or PrivateSet import found in Routes.{jsx,tsx}";
35
+ const cedarRouterImportMatch = routesContent.match(
36
+ /import {[^]*} from '@cedarjs\/router'/
37
+ );
38
+ if (!cedarRouterImportMatch) {
39
+ return "No @cedarjs/router import found in Routes.{jsx,tsx}";
88
40
  }
41
+ const [cedarRouterImport] = cedarRouterImportMatch;
42
+ const removedSetImport = cedarRouterImport.replace(/,*\s*Set,*/, "");
43
+ const newRoutesContent = routesContent.replace(
44
+ cedarRouterImport,
45
+ removedSetImport
46
+ );
89
47
  writeFile(routesPath, newRoutesContent, { overwriteExisting: true });
90
- return "Removed unused Set and PrivateSet imports in Routes.{jsx,tsx}";
48
+ return "Removed Set import in Routes.{jsx,tsx}";
91
49
  };
92
50
  const removeLayoutImport = ({
93
51
  model: name,
94
52
  path: scaffoldPath = ""
95
53
  }) => {
96
- const { importName, importPath } = getScaffoldLayoutNames(name, scaffoldPath);
54
+ const pluralPascalName = pascalcase(pluralize(name));
55
+ const pascalScaffoldPath = scaffoldPath === "" ? scaffoldPath : scaffoldPath.split("/").map(pascalcase).join("/") + "/";
56
+ const layoutName = `${pluralPascalName}Layout`;
57
+ const importLayout = `import ${pluralPascalName}Layout from 'src/layouts/${pascalScaffoldPath}${layoutName}'`;
97
58
  const routesPath = getPaths().web.routes;
98
59
  const routesContent = readFile(routesPath).toString();
99
- const importLayout = new RegExp(
100
- `\\s*import ${importName} from (['"])${importPath}\\1;?`
60
+ const newRoutesContent = routesContent.replace(
61
+ new RegExp(`\\s*${importLayout}`),
62
+ ""
101
63
  );
102
- const newRoutesContent = routesContent.replace(importLayout, "");
103
64
  writeFile(routesPath, newRoutesContent, { overwriteExisting: true });
104
65
  return "Removed layout import from Routes.{jsx,tsx}";
105
66
  };
@@ -1,6 +1,5 @@
1
1
  import { Listr } from "listr2";
2
- import { colors as c } from "@cedarjs/cli-helpers/colors";
3
- import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
2
+ import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
4
3
  import { deleteFilesTask } from "../../../lib/index.js";
5
4
  import { verifyModelName } from "../../../lib/schemaHelpers.js";
6
5
  import { files } from "../../generate/sdl/sdlHandler.js";
@@ -3,9 +3,8 @@ import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import { Writable } from "node:stream";
5
5
  import concurrently from "concurrently";
6
- import { colors as c } from "@cedarjs/cli-helpers/colors";
6
+ import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
7
7
  import { formatRunBinCommand } from "@cedarjs/cli-helpers/packageManager/display";
8
- import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
9
8
  import { shutdownPort } from "@cedarjs/internal/dist/dev";
10
9
  import { generateGqlormArtifacts } from "@cedarjs/internal/dist/generate/gqlormSchema";
11
10
  import { getConfig, getConfigPath } from "@cedarjs/project-config";
@@ -257,13 +256,15 @@ const handler = async ({
257
256
  });
258
257
  } else {
259
258
  if (workspace.includes("api")) {
259
+ const isEsm = rootPackageJson.type === "module";
260
+ const serverWatchCommand = isEsm ? `cedarjs-api-server-watch` : `cedar-api-server-watch`;
260
261
  const cedarConfigPath = getConfigPath();
261
262
  jobs.push({
262
263
  name: "api",
263
264
  command: formatRunBinCommand("nodemon", [
264
265
  "--quiet",
265
266
  `--watch "${cedarConfigPath}"`,
266
- `--exec "${formatRunBinCommand("cedar-api-server-watch")} --port ${apiAvailablePort} ${getApiDebugFlag(apiDebugPort, apiAvailablePort)} | ${formatRunBinCommand("cedar-log-formatter")}"`
267
+ `--exec "${formatRunBinCommand(serverWatchCommand)} --port ${apiAvailablePort} ${getApiDebugFlag(apiDebugPort, apiAvailablePort)} | ${formatRunBinCommand("cedar-log-formatter")}"`
267
268
  ]),
268
269
  env: {
269
270
  NODE_ENV: "development",
@@ -1,7 +1,7 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
- import { colors as c } from "@cedarjs/cli-helpers/colors";
4
- import { getConfig, importStatementPath } from "@cedarjs/project-config";
3
+ import { colors as c } from "@cedarjs/cli-helpers";
4
+ import { importStatementPath } from "@cedarjs/project-config";
5
5
  import { getPaths } from "../../lib/index.js";
6
6
  async function getPackageWatchCommands(packageWorkspaces) {
7
7
  const cedarPaths = getPaths();
@@ -17,7 +17,6 @@ async function getPackageWatchCommands(packageWorkspaces) {
17
17
  }
18
18
  return importStatementPath(workspacePath);
19
19
  });
20
- const packagesWorkspaceConfig = getConfig().experimental.packagesWorkspace;
21
20
  const watchablePackages = [];
22
21
  const packagesWithoutWatch = [];
23
22
  for (const workspacePath of workspacePaths) {
@@ -30,11 +29,7 @@ async function getPackageWatchCommands(packageWorkspaces) {
30
29
  if (packageJson.scripts?.watch) {
31
30
  watchablePackages.push(workspacePath);
32
31
  } else {
33
- const packageConfig = packageName && packagesWorkspaceConfig[packageName];
34
- const skipWatchWarning = typeof packageConfig === "object" && packageConfig.skipWatchWarning;
35
- if (!skipWatchWarning) {
36
- packagesWithoutWatch.push(packageName);
37
- }
32
+ packagesWithoutWatch.push(packageName);
38
33
  }
39
34
  }
40
35
  if (packagesWithoutWatch.length > 0) {
@@ -1,5 +1,5 @@
1
1
  import { terminalLink } from "termi-link";
2
- import { colors as c } from "@cedarjs/cli-helpers/colors";
2
+ import { colors as c } from "@cedarjs/cli-helpers";
3
3
  import { workspaces } from "../lib/project.js";
4
4
  import { checkNodeVersion } from "../middleware/checkNodeVersion.js";
5
5
  const command = "dev [workspace..]";
@@ -4,8 +4,7 @@ import { context } from "@opentelemetry/api";
4
4
  import { suppressTracing } from "@opentelemetry/core";
5
5
  import { Listr } from "listr2";
6
6
  import { Parser } from "yargs/helpers";
7
- import { colors as c } from "@cedarjs/cli-helpers/colors";
8
- import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
7
+ import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
9
8
  import { findScripts } from "@cedarjs/internal/dist/files";
10
9
  import { runScriptFunction } from "../lib/exec.js";
11
10
  import { generatePrismaClient } from "../lib/generatePrismaClient.js";
@@ -1,4 +1,4 @@
1
- import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
1
+ import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
2
2
  import { getEpilogue } from "../util.js";
3
3
  const command = "setup-live-queries";
4
4
  const description = "Setup live query invalidation with Postgres notifications";
@@ -1,11 +1,11 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { Listr } from "listr2";
4
- import { colors as c } from "@cedarjs/cli-helpers/colors";
5
4
  import {
6
5
  addApiPackages,
7
- addWebPackages
8
- } from "@cedarjs/cli-helpers/installHelpers";
6
+ addWebPackages,
7
+ colors as c
8
+ } from "@cedarjs/cli-helpers";
9
9
  import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
10
10
  import {
11
11
  getConfigPath,
@@ -1,4 +1,4 @@
1
- import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
1
+ import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
2
2
  import { getEpilogue } from "./util.js";
3
3
  const command = "setup-inngest";
4
4
  const description = "Setup Inngest for background, scheduled, delayed, multi-step, and fan-out jobs";
@@ -1,5 +1,5 @@
1
1
  import { Listr } from "listr2";
2
- import { colors as c } from "@cedarjs/cli-helpers/colors";
2
+ import { colors as c } from "@cedarjs/cli-helpers";
3
3
  import { runBin } from "@cedarjs/cli-helpers/packageManager/exec";
4
4
  import { addRootPackages } from "@cedarjs/cli-helpers/packageManager/packages";
5
5
  import { errorTelemetry } from "@cedarjs/telemetry";
@@ -1,4 +1,4 @@
1
- import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
1
+ import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
2
2
  import { getEpilogue } from "./util.js";
3
3
  const command = "setup-opentelemetry";
4
4
  const description = "Setup OpenTelemetry within the API side";
@@ -2,8 +2,7 @@ import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
4
4
  import { Listr } from "listr2";
5
- import { colors as c } from "@cedarjs/cli-helpers/colors";
6
- import { addApiPackages } from "@cedarjs/cli-helpers/installHelpers";
5
+ import { addApiPackages, colors as c } from "@cedarjs/cli-helpers";
7
6
  import { runBin } from "@cedarjs/cli-helpers/packageManager/exec";
8
7
  import {
9
8
  getConfigPath,
@@ -1,4 +1,4 @@
1
- import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
1
+ import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
2
2
  import { getEpilogue } from "./util.js";
3
3
  const command = "setup-react-compiler";
4
4
  const description = "Enable the experimental React Compiler";
@@ -1,8 +1,8 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { Listr } from "listr2";
4
- import { coerce, isGreaterThanOrEqual } from "verkit";
5
- import { colors as c } from "@cedarjs/cli-helpers/colors";
4
+ import semver from "semver";
5
+ import { colors as c } from "@cedarjs/cli-helpers";
6
6
  import {
7
7
  addRootPackages,
8
8
  addWorkspacePackages
@@ -39,8 +39,8 @@ const handler = async (options) => {
39
39
  )
40
40
  );
41
41
  const reactVersion = webPkgJson["dependencies"]["react"];
42
- const coercedReactVersion = coerce(reactVersion);
43
- if (!coercedReactVersion || !isGreaterThanOrEqual(coercedReactVersion, "19.0.0")) {
42
+ const coercedReactVersion = semver.coerce(reactVersion);
43
+ if (!coercedReactVersion || !semver.gte(coercedReactVersion, "19.0.0")) {
44
44
  throw new Error(
45
45
  "You need to be using at least React version 19 to enable the React Compiler"
46
46
  );
@@ -1,4 +1,4 @@
1
- import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
1
+ import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
2
2
  import { getEpilogue } from "./util.js";
3
3
  const command = "setup-rsc";
4
4
  const description = "Enable React Server Components (RSC)";
@@ -2,8 +2,7 @@ import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import execa from "execa";
4
4
  import { Listr } from "listr2";
5
- import { colors as c } from "@cedarjs/cli-helpers/colors";
6
- import { prettify } from "@cedarjs/cli-helpers/fileHelpers";
5
+ import { prettify, colors as c } from "@cedarjs/cli-helpers";
7
6
  import { install } from "@cedarjs/cli-helpers/packageManager";
8
7
  import { getConfig, getConfigPath } from "@cedarjs/project-config";
9
8
  import { getPackageManager } from "@cedarjs/project-config/packageManager";
@@ -1,4 +1,4 @@
1
- import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
1
+ import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
2
2
  import { getEpilogue } from "./util.js";
3
3
  const command = "setup-streaming-ssr";
4
4
  const description = "Enable React Streaming and Server Side Rendering (SSR)";
@@ -2,8 +2,7 @@ import fs from "node:fs";
2
2
  import path from "path";
3
3
  import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
4
4
  import { Listr } from "listr2";
5
- import { colors as c } from "@cedarjs/cli-helpers/colors";
6
- import { addWebPackages } from "@cedarjs/cli-helpers/installHelpers";
5
+ import { addWebPackages, colors as c } from "@cedarjs/cli-helpers";
7
6
  import { getConfigPath } from "@cedarjs/project-config";
8
7
  import { errorTelemetry } from "@cedarjs/telemetry";
9
8
  import { getPaths, transformTSToJS, writeFile } from "../../lib/index.js";
@@ -184,7 +183,7 @@ You'll manually need to merge it with your existing entry.client${ext} file.`;
184
183
  fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
185
184
  }
186
185
  },
187
- addWebPackages(["@apollo/client-react-streaming@0.14.5"]),
186
+ addWebPackages(["@apollo/client-react-streaming@0.10.0"]),
188
187
  {
189
188
  task: () => {
190
189
  printTaskEpilogue(command, description, EXPERIMENTAL_TOPIC_ID);
@@ -22,26 +22,6 @@ const builder = createBuilder({
22
22
  default: "",
23
23
  description: "Use to enforce a specific query name within the generated cell - must be unique.",
24
24
  type: "string"
25
- },
26
- beforeQuery: {
27
- default: false,
28
- description: "Include a typed `beforeQuery` stub for configuring the query (e.g. variables, fetch policy).",
29
- type: "boolean"
30
- },
31
- afterQuery: {
32
- default: false,
33
- description: "Include a typed `afterQuery` stub for sanitizing data returned from the query.",
34
- type: "boolean"
35
- },
36
- isEmpty: {
37
- default: false,
38
- description: "Include a typed `isEmpty` stub for overriding the default check for the Empty component.",
39
- type: "boolean"
40
- },
41
- fragment: {
42
- default: "",
43
- description: "Generate a fragment cell (exports FRAGMENT instead of QUERY) that reads its data from a parent Cell, given the GraphQL type it selects from - e.g. --fragment User.",
44
- type: "string"
45
25
  }
46
26
  };
47
27
  }
@@ -26,11 +26,7 @@ const files = async ({
26
26
  list = false,
27
27
  query,
28
28
  stories,
29
- tests,
30
- beforeQuery = false,
31
- afterQuery = false,
32
- isEmpty = false,
33
- fragment = ""
29
+ tests
34
30
  }) => {
35
31
  let cellName = removeGeneratorName(name, "cell");
36
32
  let idName = "id";
@@ -39,49 +35,22 @@ const files = async ({
39
35
  let model = null;
40
36
  let templateNameSuffix = "";
41
37
  let typeName = cellName;
42
- if (fragment) {
43
- if (list) {
44
- throw new Error(
45
- "The --list flag cannot be combined with --fragment; fragment cells always render a single item."
46
- );
47
- }
48
- if (beforeQuery) {
49
- throw new Error(
50
- "The --before-query flag cannot be combined with --fragment; fragment cells never fire a query of their own."
51
- );
52
- }
53
- if (query) {
54
- throw new Error(
55
- "The --query flag cannot be combined with --fragment; fragment cells don't have an operation name."
56
- );
57
- }
58
- }
59
- const shouldGenerateList = !fragment && ((isWordPluralizable(cellName) ? isPlural(cellName) : list) || list);
60
- if (!fragment) {
61
- try {
62
- model = await getSchema(pascalcase(singularize(cellName)));
63
- idName = getIdName(model);
64
- idType = getIdType(model);
65
- typeName = model.name;
66
- mockIdValues = idType === "String" ? mockIdValues.map((value) => `'${value}'`) : mockIdValues;
67
- } catch {
68
- idType = "Int";
69
- }
38
+ const shouldGenerateList = (isWordPluralizable(cellName) ? isPlural(cellName) : list) || list;
39
+ try {
40
+ model = await getSchema(pascalcase(singularize(cellName)));
41
+ idName = getIdName(model);
42
+ idType = getIdType(model);
43
+ typeName = model.name;
44
+ mockIdValues = idType === "String" ? mockIdValues.map((value) => `'${value}'`) : mockIdValues;
45
+ } catch {
46
+ idType = "Int";
70
47
  }
71
48
  if (shouldGenerateList) {
72
49
  cellName = forcePluralizeWord(cellName);
73
50
  templateNameSuffix = "List";
74
51
  }
75
52
  let operationName = query;
76
- let fragmentName;
77
- let fragmentOnType;
78
- let fragmentPropName;
79
- if (fragment) {
80
- const fragmentTypeVariants = nameVariants(fragment);
81
- fragmentOnType = fragmentTypeVariants.pascalName;
82
- fragmentPropName = fragmentTypeVariants.camelName;
83
- fragmentName = `${nameVariants(cellName).pascalName}Cell_${fragmentPropName}`;
84
- } else if (operationName) {
53
+ if (operationName) {
85
54
  const userSpecifiedOperationNameIsUnique = await operationNameIsUnique(operationName);
86
55
  if (!userSpecifiedOperationNameIsUnique) {
87
56
  throw new Error(`Specified query name: "${operationName}" is not unique!`);
@@ -98,20 +67,11 @@ const files = async ({
98
67
  extension,
99
68
  webPathSection: CEDAR_WEB_PATH_NAME,
100
69
  generator: "cell",
101
- templatePath: fragment ? "cellFragment.tsx.template" : `cell${templateNameSuffix}.tsx.template`,
102
- templateVars: fragment ? {
103
- fragmentName,
104
- fragmentOnType,
105
- camelName: fragmentPropName,
106
- afterQuery,
107
- isEmpty
108
- } : {
70
+ templatePath: `cell${templateNameSuffix}.tsx.template`,
71
+ templateVars: {
109
72
  operationName,
110
73
  idName,
111
- idType,
112
- beforeQuery,
113
- afterQuery,
114
- isEmpty
74
+ idType
115
75
  }
116
76
  });
117
77
  const testFile = await templateForComponentFile({
@@ -120,8 +80,8 @@ const files = async ({
120
80
  extension: `.test${extension}`,
121
81
  webPathSection: CEDAR_WEB_PATH_NAME,
122
82
  generator: "cell",
123
- templatePath: fragment ? "testFragment.js.template" : "test.js.template",
124
- templateVars: fragment ? { camelName: fragmentPropName } : {
83
+ templatePath: "test.js.template",
84
+ templateVars: {
125
85
  idName: shouldGenerateList ? void 0 : idName,
126
86
  mockIdValues: shouldGenerateList ? void 0 : mockIdValues
127
87
  }
@@ -132,7 +92,7 @@ const files = async ({
132
92
  extension: `.stories${extension}`,
133
93
  webPathSection: CEDAR_WEB_PATH_NAME,
134
94
  generator: "cell",
135
- templatePath: fragment ? "storiesFragment.tsx.template" : "stories.tsx.template"
95
+ templatePath: "stories.tsx.template"
136
96
  });
137
97
  const mockFile = await templateForComponentFile({
138
98
  name: cellName,
@@ -141,12 +101,7 @@ const files = async ({
141
101
  webPathSection: CEDAR_WEB_PATH_NAME,
142
102
  generator: "cell",
143
103
  templatePath: `mock${templateNameSuffix}.ts.template`,
144
- templateVars: fragment ? {
145
- idName,
146
- mockIdValues,
147
- typeName: fragmentOnType,
148
- camelName: fragmentPropName
149
- } : {
104
+ templateVars: {
150
105
  idName,
151
106
  mockIdValues,
152
107
  typeName
@@ -167,10 +122,7 @@ const files = async ({
167
122
  const handler = createHandler({
168
123
  componentName: "cell",
169
124
  filesFn: files,
170
- includeAdditionalTasks: ({
171
- name: cellName,
172
- fragment
173
- }) => {
125
+ includeAdditionalTasks: ({ name: cellName }) => {
174
126
  return [
175
127
  {
176
128
  title: `Generating types ...`,
@@ -178,7 +130,7 @@ const handler = createHandler({
178
130
  const queryFieldName = nameVariants(
179
131
  removeGeneratorName(cellName, "cell")
180
132
  ).camelName;
181
- const projectHasSdl = Boolean(fragment) || await checkProjectForQueryField(queryFieldName);
133
+ const projectHasSdl = await checkProjectForQueryField(queryFieldName);
182
134
  if (projectHasSdl) {
183
135
  const { errors } = await generateTypes();
184
136
  for (const { message, error } of errors) {
@@ -6,9 +6,7 @@ import type {
6
6
  import type {
7
7
  CellSuccessProps,
8
8
  CellFailureProps,
9
- TypedDocumentNode,<% if (beforeQuery) { %>
10
- CellBeforeQueryResult,<% } %><% if (afterQuery || isEmpty) { %>
11
- DataObject,<% } %>
9
+ TypedDocumentNode,
12
10
  } from '@cedarjs/web'
13
11
 
14
12
  export const QUERY: TypedDocumentNode<
@@ -21,24 +19,7 @@ export const QUERY: TypedDocumentNode<
21
19
  }
22
20
  }
23
21
  `
24
- <% if (beforeQuery) { %>
25
- export const beforeQuery = (
26
- props: ${operationName}Variables,
27
- ): CellBeforeQueryResult<${operationName}Variables> => {
28
- return { variables: props, fetchPolicy: 'cache-and-network' }
29
- }
30
- <% } %><% if (isEmpty) { %>
31
- export const isEmpty = (
32
- data: DataObject,
33
- { isDataEmpty }: { isDataEmpty: (data: DataObject) => boolean },
34
- ) => {
35
- return isDataEmpty(data)
36
- }
37
- <% } %><% if (afterQuery) { %>
38
- export const afterQuery = (data: DataObject): DataObject => {
39
- return data
40
- }
41
- <% } %>
22
+
42
23
  export const Loading = () => <div>Loading...</div>
43
24
 
44
25
  export const Empty = () => <div>Empty</div>
@@ -3,9 +3,7 @@ import type { ${operationName}, ${operationName}Variables } from 'types/graphql
3
3
  import type {
4
4
  CellSuccessProps,
5
5
  CellFailureProps,
6
- TypedDocumentNode,<% if (beforeQuery) { %>
7
- CellBeforeQueryResult,<% } %><% if (afterQuery || isEmpty) { %>
8
- DataObject,<% } %>
6
+ TypedDocumentNode,
9
7
  } from '@cedarjs/web'
10
8
 
11
9
  export const QUERY: TypedDocumentNode<
@@ -18,24 +16,7 @@ export const QUERY: TypedDocumentNode<
18
16
  }
19
17
  }
20
18
  `
21
- <% if (beforeQuery) { %>
22
- export const beforeQuery = (
23
- props: ${operationName}Variables,
24
- ): CellBeforeQueryResult<${operationName}Variables> => {
25
- return { variables: props, fetchPolicy: 'cache-and-network' }
26
- }
27
- <% } %><% if (isEmpty) { %>
28
- export const isEmpty = (
29
- data: DataObject,
30
- { isDataEmpty }: { isDataEmpty: (data: DataObject) => boolean },
31
- ) => {
32
- return isDataEmpty(data)
33
- }
34
- <% } %><% if (afterQuery) { %>
35
- export const afterQuery = (data: DataObject): DataObject => {
36
- return data
37
- }
38
- <% } %>
19
+
39
20
  export const Loading = () => <div>Loading...</div>
40
21
 
41
22
  export const Empty = () => <div>Empty</div>
@@ -7,7 +7,7 @@ import { standard } from './${pascalName}Cell.mock'
7
7
  // and can fail without adjustments, e.g. Float and DateTime types.
8
8
  // Please refer to the RedwoodJS Testing Docs:
9
9
  // https://cedarjs.com/docs/testing#testing-cells
10
- // https://cedarjs.com/docs/testing#expect-type-considerations
10
+ // https://cedarjs.com/docs/testing#jest-expect-type-considerations
11
11
 
12
12
  describe('${pascalName}Cell', () => {
13
13
  it('renders Loading successfully', () => {
@@ -2,9 +2,8 @@ import path from "node:path";
2
2
  import { paramCase } from "change-case";
3
3
  import { Listr } from "listr2";
4
4
  import { terminalLink } from "termi-link";
5
- import { colors as c } from "@cedarjs/cli-helpers/colors";
5
+ import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
6
6
  import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
7
- import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
8
7
  import { getDataMigrationsPath } from "@cedarjs/project-config";
9
8
  import {
10
9
  generateTemplate,