@cedarjs/cli 7.0.1-next.314 → 7.0.1-next.466

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 (59) hide show
  1. package/dist/commands/deploy/baremetal/baremetalHandler.js +375 -76
  2. package/dist/commands/deploy/baremetal/monitors.js +66 -0
  3. package/dist/commands/deploy/baremetal.js +6 -0
  4. package/dist/commands/destroy/scaffold/scaffoldHandler.js +63 -25
  5. package/dist/commands/dev/devHandler.js +13 -1
  6. package/dist/commands/generate/dbAuth/dbAuth.js +6 -2
  7. package/dist/commands/generate/dbAuth/dbAuthHandler.js +57 -14
  8. package/dist/commands/generate/dbAuth/templates/changePassword.tsx.template +131 -0
  9. package/dist/commands/generate/dbAuth/templates/login.webAuthn.tsx.template +20 -12
  10. package/dist/commands/generate/directive/directive.js +15 -2
  11. package/dist/commands/generate/helpers.js +26 -0
  12. package/dist/commands/generate/ogImage/templates/ogImage.og.tsx.template +1 -1
  13. package/dist/commands/generate/package/templates/tsconfig.json.template +1 -0
  14. package/dist/commands/generate/realtime/templates/liveQueries/blank/blank.service.ts.template +12 -4
  15. package/dist/commands/generate/realtime/templates/subscriptions/blank/blank.service.ts.template +2 -2
  16. package/dist/commands/generate/realtime/templates/subscriptions/blank/blank.ts.template +3 -3
  17. package/dist/commands/generate/scaffold/scaffold.js +1 -1
  18. package/dist/commands/generate/scaffold/scaffoldHandler.js +83 -44
  19. package/dist/commands/generate/scaffold/templates/assets/scaffold.tailwind.css.template +12 -7
  20. package/dist/commands/generate/scaffold/templates/components/EditNameCell.tsx.template +7 -7
  21. package/dist/commands/generate/scaffold/templates/components/NameForm.tsx.template +7 -6
  22. package/dist/commands/generate/scaffold/templates/layouts/NamesScaffoldLayout.tsx.template +18 -0
  23. package/dist/commands/generate/scaffold/templates/lib/formatters.tsx.template +3 -3
  24. package/dist/commands/generate/script/templates/tsconfig.json.template +1 -0
  25. package/dist/commands/generate/sdl/sdlHandler.js +8 -3
  26. package/dist/commands/generate/service/serviceHandler.js +32 -11
  27. package/dist/commands/generate/service/templates/service.ts.template +21 -8
  28. package/dist/commands/generate/service/templates/test.ts.template +7 -5
  29. package/dist/commands/jobsHandler.js +5 -3
  30. package/dist/commands/setup/cache/templates/memcached.ts.template +14 -17
  31. package/dist/commands/setup/cache/templates/redis.ts.template +12 -20
  32. package/dist/commands/setup/deploy/helpers/index.js +3 -1
  33. package/dist/commands/setup/deploy/providers/baremetal.js +7 -0
  34. package/dist/commands/setup/deploy/providers/baremetalHandler.js +128 -20
  35. package/dist/commands/setup/deploy/providers/netlifyHandler.js +25 -3
  36. package/dist/commands/setup/deploy/templates/baremetal.js +119 -9
  37. package/dist/commands/setup/deploy/templates/netlifyUD.js +3 -0
  38. package/dist/commands/setup/jobs/jobsHandler.js +2 -0
  39. package/dist/commands/setup/monitoring/sentry/sentryHandler.js +5 -2
  40. package/dist/commands/setup/monitoring/sentry/templates/sentryApi.ts.template +1 -4
  41. package/dist/commands/setup/monitoring/sentry/templates/sentryWeb.ts.template +7 -4
  42. package/dist/commands/setup/realtime/templates/defer/fastAndSlowFields/fastAndSlowFields.ts.template +4 -1
  43. package/dist/commands/setup/realtime/templates/liveQueries/auctions/auctions.ts.template +12 -4
  44. package/dist/commands/setup/realtime/templates/subscriptions/newMessage/newMessage.ts.template +1 -1
  45. package/dist/commands/setup/tenancy/signupCodemod.js +2 -1
  46. package/dist/commands/setup/tenancy/templates/InvitePage.tsx.template +10 -1
  47. package/dist/commands/setup/tenancy/templates/organizations.scenarios.ts.template +0 -2
  48. package/dist/commands/setup/tenancy/templates/organizations.test.ts.template +0 -8
  49. package/dist/commands/setup/tenancy/templates/organizations.ts.template +1 -1
  50. package/dist/commands/setup/tenancy/templates/requireMembership.test.ts.template +1 -1
  51. package/dist/commands/setup/tenancy/tenancyHandler.js +1 -1
  52. package/dist/commands/setup/ui/libraries/tailwindcssHandler.js +61 -81
  53. package/dist/commands/setup/uploads/gitignore.js +17 -0
  54. package/dist/commands/setup/uploads/serverFile.js +93 -27
  55. package/dist/commands/setup/uploads/templates/uploads.ts.template +14 -5
  56. package/dist/commands/setup/uploads/uploadsHandler.js +22 -1
  57. package/dist/lib/index.js +10 -6
  58. package/package.json +24 -24
  59. package/dist/commands/setup/ui/templates/postcss.config.cjs.template +0 -9
@@ -1,8 +1,8 @@
1
1
  import {
2
+ acceptedContentType,
2
3
  confirmUpload as confirmUploadRecord,
3
4
  createPresignedUpload,
4
5
  getUploadTokenPayload,
5
- isMimeTypeAllowed,
6
6
  issueUploadToken,
7
7
  resolveProfile,
8
8
  resolveTarget,
@@ -71,18 +71,27 @@ export const uploadFile = async ({
71
71
  )
72
72
  }
73
73
 
74
- if (!isMimeTypeAllowed(profile.allowedMimeTypes, input.mimeType)) {
74
+ // Checked by what the bytes are, not the type the client claimed, and
75
+ // stored under the type returned
76
+ const data = Buffer.from(input.data, 'base64')
77
+ const mimeType = acceptedContentType(
78
+ data,
79
+ profile.allowedMimeTypes,
80
+ input.mimeType,
81
+ )
82
+
83
+ if (!mimeType) {
75
84
  throw new UploadError(
76
85
  'MIME_TYPE_NOT_ALLOWED',
77
- `File type '${input.mimeType}' is not allowed for upload profile '${profile.name}'.`,
86
+ `That file is not a type allowed for upload profile '${profile.name}'.`,
78
87
  )
79
88
  }
80
89
 
81
90
  return storeFile(target, {
82
91
  db,
83
92
  filename: input.filename,
84
- mimeType: input.mimeType,
85
- data: Buffer.from(input.data, 'base64'),
93
+ mimeType,
94
+ data,
86
95
  maxSize: profile.maxFileSize,
87
96
  userId: context.currentUser ? String(context.currentUser.id) : undefined,
88
97
  })
@@ -18,6 +18,7 @@ import { getPaths, transformTSToJS, writeFile } from "../../../lib/index.js";
18
18
  import { isTypeScriptProject } from "../../../lib/project.js";
19
19
  import { generateSecret } from "../../generate/secret/secret.js";
20
20
  import { setupServerFileTasks } from "../server-file/serverFileHandler.js";
21
+ import { transformGitignore } from "./gitignore.js";
21
22
  import { addUploadModel } from "./schemaPrisma.js";
22
23
  import {
23
24
  addUploadsPlugin,
@@ -39,6 +40,12 @@ const S3_CLIENT = `
39
40
  export const s3Client = new S3Client({
40
41
  region: process.env.AWS_REGION,
41
42
  })
43
+
44
+ const s3Bucket = process.env.S3_BUCKET_UPLOADS
45
+
46
+ if (!s3Bucket) {
47
+ throw new Error('Set S3_BUCKET_UPLOADS in .env to use the S3 storage target')
48
+ }
42
49
  `;
43
50
  const TARGET_BLOCKS = {
44
51
  fs: ` // Files uploaded through the api server and stored on local disk. Good for
@@ -55,7 +62,7 @@ const TARGET_BLOCKS = {
55
62
  s3: ` // Files uploaded straight from the browser to S3 with presigned URLs.
56
63
  files: createS3Provider({
57
64
  client: s3Client,
58
- bucket: process.env.S3_BUCKET_UPLOADS,
65
+ bucket: s3Bucket,
59
66
  region: process.env.AWS_REGION,
60
67
  keyPrefix: 'uploads/',
61
68
  }),
@@ -264,6 +271,20 @@ const handler = async ({ targets, force }) => {
264
271
  }
265
272
  }
266
273
  },
274
+ {
275
+ title: "Adding the fs upload directory to .gitignore...",
276
+ skip: () => wantsFs ? false : "No fs target selected; skipping.",
277
+ task: (_ctx, task) => {
278
+ const gitignorePath = path.join(paths.base, ".gitignore");
279
+ const source = fs.existsSync(gitignorePath) ? fs.readFileSync(gitignorePath, "utf-8") : "";
280
+ const updated = transformGitignore(source);
281
+ if (updated === source) {
282
+ task.skip(".gitignore already up to date");
283
+ return;
284
+ }
285
+ fs.writeFileSync(gitignorePath, updated, "utf-8");
286
+ }
287
+ },
267
288
  {
268
289
  title: "Prettifying changed files",
269
290
  task: async (_ctx, task) => {
package/dist/lib/index.js CHANGED
@@ -286,18 +286,17 @@ const cleanupEmptyDirsTask = (files) => {
286
286
  })
287
287
  );
288
288
  };
289
- function wrapWithSet(routesContent, layout, routes, newLineAndIndent, props = {}, privateSetProps) {
289
+ function wrapWithSet(routesContent, layout, routes, newLineAndIndent, privateSetProps) {
290
290
  const [_, indentOne, indentTwo] = routesContent.match(
291
291
  /([ \t]*)<Router.*?>[^<]*[\r\n]+([ \t]+)/
292
292
  ) || ["", "", ""];
293
293
  const oneLevelIndent = indentTwo.slice(0, indentTwo.length - indentOne.length);
294
- const propsString = Object.entries(props).map((values) => `${values[0]}="${values[1]}"`).join(" ");
295
294
  if (!privateSetProps) {
296
295
  const newRoutesWithExtraIndent2 = routes.map(
297
296
  (route) => oneLevelIndent + route
298
297
  );
299
298
  return [
300
- `<Set wrap={${layout}}${propsString && " " + propsString}>`,
299
+ `<Set wrap={${layout}}>`,
301
300
  ...newRoutesWithExtraIndent2,
302
301
  `</Set>`
303
302
  ].join(newLineAndIndent);
@@ -308,13 +307,13 @@ function wrapWithSet(routesContent, layout, routes, newLineAndIndent, props = {}
308
307
  );
309
308
  return [
310
309
  `<PrivateSet${privateSetPropsString && " " + privateSetPropsString}>`,
311
- `${oneLevelIndent}<Set wrap={${layout}}${propsString && " " + propsString}>`,
310
+ `${oneLevelIndent}<Set wrap={${layout}}>`,
312
311
  ...newRoutesWithExtraIndent,
313
312
  `${oneLevelIndent}</Set>`,
314
313
  `</PrivateSet>`
315
314
  ].join(newLineAndIndent);
316
315
  }
317
- function addRoutesToRouterTask(routes, layout, setProps = {}, privateSetProps) {
316
+ function addRoutesToRouterTask(routes, layout, privateSetProps) {
318
317
  const cedarPaths = getPaths();
319
318
  const routesContent = readFile(cedarPaths.web.routes).toString();
320
319
  let newRoutes = routes.filter((route) => !routesContent.match(route));
@@ -338,7 +337,6 @@ ${route}`);
338
337
  layout,
339
338
  newRoutes,
340
339
  newLineAndIndent,
341
- setProps,
342
340
  privateSetProps
343
341
  ) : newRoutes.join(newLineAndIndent);
344
342
  const newRoutesContent = routesContent.replace(
@@ -377,6 +375,12 @@ function removeEmtpySet(routesContent, layout) {
377
375
  if (child.length > 0) {
378
376
  return routesContent;
379
377
  }
378
+ const privateSetWithLayoutReg = new RegExp(
379
+ `\\s*<PrivateSet[^>]*>\\s*<Set[^>]*wrap={${layout}}[^<]*>\\s*</Set>\\s*</PrivateSet>`
380
+ );
381
+ if (privateSetWithLayoutReg.test(routesContent)) {
382
+ return routesContent.replace(privateSetWithLayoutReg, "");
383
+ }
380
384
  return routesContent.replace(setWithLayoutReg, "");
381
385
  }
382
386
  function removeRoutesFromRouterTask(routes, layout) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "7.0.1-next.314",
3
+ "version": "7.0.1-next.466",
4
4
  "description": "The CedarJS Command Line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,25 +34,25 @@
34
34
  "@babel/core": "^7.26.10",
35
35
  "@babel/parser": "7.29.9",
36
36
  "@babel/preset-typescript": "7.29.7",
37
- "@babel/traverse": "7.29.8",
37
+ "@babel/traverse": "7.29.10",
38
38
  "@babel/types": "7.29.8",
39
- "@cedarjs/api-server": "7.0.1-next.314",
40
- "@cedarjs/babel-config": "7.0.1-next.314",
41
- "@cedarjs/cli-helpers": "7.0.1-next.314",
42
- "@cedarjs/internal": "7.0.1-next.314",
43
- "@cedarjs/prerender": "7.0.1-next.314",
44
- "@cedarjs/project-config": "7.0.1-next.314",
45
- "@cedarjs/structure": "7.0.1-next.314",
46
- "@cedarjs/telemetry": "7.0.1-next.314",
47
- "@cedarjs/utils": "7.0.1-next.314",
48
- "@cedarjs/vite": "7.0.1-next.314",
49
- "@cedarjs/web-server": "7.0.1-next.314",
50
- "@listr2/prompt-adapter-enquirer": "4.3.2",
39
+ "@cedarjs/api-server": "7.0.1-next.466",
40
+ "@cedarjs/babel-config": "7.0.1-next.466",
41
+ "@cedarjs/cli-helpers": "7.0.1-next.466",
42
+ "@cedarjs/internal": "7.0.1-next.466",
43
+ "@cedarjs/prerender": "7.0.1-next.466",
44
+ "@cedarjs/project-config": "7.0.1-next.466",
45
+ "@cedarjs/structure": "7.0.1-next.466",
46
+ "@cedarjs/telemetry": "7.0.1-next.466",
47
+ "@cedarjs/utils": "7.0.1-next.466",
48
+ "@cedarjs/vite": "7.0.1-next.466",
49
+ "@cedarjs/web-server": "7.0.1-next.466",
50
+ "@listr2/prompt-adapter-enquirer": "4.3.3",
51
51
  "@opentelemetry/api": "1.9.1",
52
- "@opentelemetry/core": "2.11.0",
53
- "@opentelemetry/exporter-trace-otlp-http": "0.222.0",
54
- "@opentelemetry/resources": "2.11.0",
55
- "@opentelemetry/sdk-trace-node": "2.11.0",
52
+ "@opentelemetry/core": "2.12.0",
53
+ "@opentelemetry/exporter-trace-otlp-http": "0.223.0",
54
+ "@opentelemetry/resources": "2.12.0",
55
+ "@opentelemetry/sdk-trace-node": "2.12.0",
56
56
  "@opentelemetry/semantic-conventions": "1.43.0",
57
57
  "@prisma/internals": "7.10.0",
58
58
  "ansis": "4.4.0",
@@ -62,7 +62,7 @@
62
62
  "camelcase": "6.3.0",
63
63
  "change-case": "4.1.2",
64
64
  "ci-info": "4.4.0",
65
- "concurrently": "9.2.4",
65
+ "concurrently": "9.2.5",
66
66
  "configstore": "7.1.0",
67
67
  "decamelize": "6.0.1",
68
68
  "dotenv-defaults": "5.0.2",
@@ -79,13 +79,13 @@
79
79
  "pascalcase": "1.0.0",
80
80
  "pluralize": "8.0.0",
81
81
  "portfinder": "1.0.38",
82
- "prettier": "3.9.9",
82
+ "prettier": "3.9.10",
83
83
  "prisma": "7.10.0",
84
84
  "prompts": "2.4.2",
85
- "smol-toml": "1.9.0",
85
+ "smol-toml": "1.9.1",
86
86
  "srvx": "0.12.8",
87
87
  "string-env-interpolation": "1.0.1",
88
- "systeminformation": "5.33.13",
88
+ "systeminformation": "5.33.15",
89
89
  "termi-link": "1.1.0",
90
90
  "title-case": "3.0.3",
91
91
  "unionfs": "4.6.0",
@@ -94,10 +94,10 @@
94
94
  "yargs": "17.7.3"
95
95
  },
96
96
  "devDependencies": {
97
- "@cedarjs/framework-tools": "7.0.1-next.314",
97
+ "@cedarjs/framework-tools": "7.0.1-next.466",
98
98
  "@prisma/dmmf": "7.10.0",
99
99
  "@types/archiver": "^7.0.0",
100
- "memfs": "4.79.0",
100
+ "memfs": "4.80.0",
101
101
  "node-ssh": "13.2.1",
102
102
  "ts-dedent": "2.3.0",
103
103
  "typescript": "5.9.3",
@@ -1,9 +0,0 @@
1
- const path = require('path')
2
-
3
- module.exports = {
4
- plugins: [
5
- require('tailwindcss/nesting'),
6
- require('tailwindcss')(path.resolve(__dirname, 'tailwind.config.cjs')),
7
- require('autoprefixer'),
8
- ],
9
- }