@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "7.0.1-next.467",
3
+ "version": "7.1.0-rc.32",
4
4
  "description": "The CedarJS Command Line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,27 +34,27 @@
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.10",
37
+ "@babel/traverse": "7.29.8",
38
38
  "@babel/types": "7.29.8",
39
- "@cedarjs/api-server": "7.0.1-next.467",
40
- "@cedarjs/babel-config": "7.0.1-next.467",
41
- "@cedarjs/cli-helpers": "7.0.1-next.467",
42
- "@cedarjs/internal": "7.0.1-next.467",
43
- "@cedarjs/prerender": "7.0.1-next.467",
44
- "@cedarjs/project-config": "7.0.1-next.467",
45
- "@cedarjs/structure": "7.0.1-next.467",
46
- "@cedarjs/telemetry": "7.0.1-next.467",
47
- "@cedarjs/utils": "7.0.1-next.467",
48
- "@cedarjs/vite": "7.0.1-next.467",
49
- "@cedarjs/web-server": "7.0.1-next.467",
50
- "@listr2/prompt-adapter-enquirer": "4.3.3",
39
+ "@cedarjs/api-server": "7.1.0-rc.32",
40
+ "@cedarjs/babel-config": "7.1.0-rc.32",
41
+ "@cedarjs/cli-helpers": "7.1.0-rc.32",
42
+ "@cedarjs/internal": "7.1.0-rc.32",
43
+ "@cedarjs/prerender": "7.1.0-rc.32",
44
+ "@cedarjs/project-config": "7.1.0-rc.32",
45
+ "@cedarjs/structure": "7.1.0-rc.32",
46
+ "@cedarjs/telemetry": "7.1.0-rc.32",
47
+ "@cedarjs/utils": "7.1.0-rc.32",
48
+ "@cedarjs/vite": "7.1.0-rc.32",
49
+ "@cedarjs/web-server": "7.1.0-rc.32",
50
+ "@listr2/prompt-adapter-enquirer": "4.3.2",
51
51
  "@opentelemetry/api": "1.9.1",
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",
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",
56
56
  "@opentelemetry/semantic-conventions": "1.43.0",
57
- "@prisma/internals": "7.10.0",
57
+ "@prisma/internals": "7.8.0",
58
58
  "ansis": "4.4.0",
59
59
  "archiver": "7.0.1",
60
60
  "boxen": "5.1.2",
@@ -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.5",
65
+ "concurrently": "9.2.4",
66
66
  "configstore": "7.1.0",
67
67
  "decamelize": "6.0.1",
68
68
  "dotenv-defaults": "5.0.2",
@@ -79,25 +79,25 @@
79
79
  "pascalcase": "1.0.0",
80
80
  "pluralize": "8.0.0",
81
81
  "portfinder": "1.0.38",
82
- "prettier": "3.9.10",
82
+ "prettier": "3.9.8",
83
83
  "prisma": "7.10.0",
84
84
  "prompts": "2.4.2",
85
- "smol-toml": "1.9.1",
85
+ "semver": "7.8.5",
86
+ "smol-toml": "1.8.0",
86
87
  "srvx": "0.12.8",
87
88
  "string-env-interpolation": "1.0.1",
88
- "systeminformation": "5.33.15",
89
+ "systeminformation": "5.33.13",
89
90
  "termi-link": "1.1.0",
90
91
  "title-case": "3.0.3",
91
92
  "unionfs": "4.6.0",
92
93
  "uuid": "11.1.1",
93
- "verkit": "0.5.0",
94
94
  "yargs": "17.7.3"
95
95
  },
96
96
  "devDependencies": {
97
- "@cedarjs/framework-tools": "7.0.1-next.467",
98
- "@prisma/dmmf": "7.10.0",
97
+ "@cedarjs/framework-tools": "7.1.0-rc.32",
98
+ "@prisma/dmmf": "7.8.0",
99
99
  "@types/archiver": "^7.0.0",
100
- "memfs": "4.80.0",
100
+ "memfs": "4.78.1",
101
101
  "node-ssh": "13.2.1",
102
102
  "ts-dedent": "2.3.0",
103
103
  "typescript": "5.9.3",
@@ -1,66 +0,0 @@
1
- const MONITORS = ["pm2", "systemd-user", "systemd-system"];
2
- const pm2 = {
3
- defaultCommand: "pm2",
4
- firstRunConfigFile: "ecosystem.config.js",
5
- firstRunSetup: [],
6
- firstRun: (processName) => [
7
- {
8
- title: `Starting ${processName} process for the first time...`,
9
- args: ["start", "current/ecosystem.config.js", "--only", processName]
10
- },
11
- {
12
- title: `Saving ${processName} state for future startup...`,
13
- args: ["save"]
14
- }
15
- ],
16
- restart: (processName) => ({
17
- title: `Restarting ${processName} process...`,
18
- args: ["restart", processName]
19
- }),
20
- stop: (processNames) => ({
21
- title: `Stopping ${processNames.join(", ")} processes...`,
22
- args: ["stop", ...processNames]
23
- }),
24
- start: (processNames) => ({
25
- title: `Starting ${processNames.join(", ")} processes...`,
26
- args: ["start", ...processNames]
27
- })
28
- };
29
- const systemd = (defaultCommand) => ({
30
- defaultCommand,
31
- firstRunSetup: [
32
- {
33
- title: "Reloading systemd unit files...",
34
- args: ["daemon-reload"]
35
- }
36
- ],
37
- firstRun: (processName) => [
38
- {
39
- title: `Enabling and starting ${processName} for the first time...`,
40
- args: ["enable", "--now", processName]
41
- }
42
- ],
43
- restart: (processName) => ({
44
- title: `Restarting ${processName}...`,
45
- args: ["restart", processName]
46
- }),
47
- stop: (processNames) => ({
48
- title: `Stopping ${processNames.join(", ")}...`,
49
- args: ["stop", ...processNames]
50
- }),
51
- start: (processNames) => ({
52
- title: `Starting ${processNames.join(", ")}...`,
53
- args: ["start", ...processNames]
54
- })
55
- });
56
- const MONITOR_ADAPTERS = {
57
- pm2,
58
- "systemd-user": systemd("systemctl --user"),
59
- "systemd-system": systemd("sudo systemctl")
60
- };
61
- const isMonitor = (value) => typeof value === "string" && MONITORS.includes(value);
62
- export {
63
- MONITORS,
64
- MONITOR_ADAPTERS,
65
- isMonitor
66
- };
@@ -1,43 +0,0 @@
1
- import type { ${fragmentName} } from 'types/graphql'
2
-
3
- import type {
4
- CellSuccessProps,<% if (afterQuery || isEmpty) { %>
5
- DataObject,<% } %>
6
- } from '@cedarjs/web'
7
-
8
- // A parent Cell spreads this fragment by name in its own QUERY, and passes
9
- // the matching field down as the `${camelName}` prop - no import needed,
10
- // just render <${pascalName}Cell />:
11
- //
12
- // query FindSomething($id: Int!) {
13
- // something(id: $id) {
14
- // id
15
- // ...${fragmentName}
16
- // }
17
- // }
18
- //
19
- // <${pascalName}Cell ${camelName}={something} />
20
- export const FRAGMENT = gql`
21
- fragment ${fragmentName} on ${fragmentOnType} {
22
- id
23
- }
24
- `
25
- <% if (isEmpty) { %>
26
- export const isEmpty = (
27
- data: DataObject,
28
- { isDataEmpty }: { isDataEmpty: (data: DataObject) => boolean },
29
- ) => {
30
- return isDataEmpty(data)
31
- }
32
- <% } %><% if (afterQuery) { %>
33
- export const afterQuery = (data: DataObject): DataObject => {
34
- return data
35
- }
36
- <% } %>
37
- export const Empty = () => <div>Empty</div>
38
-
39
- export const Success = ({
40
- ${camelName},
41
- }: CellSuccessProps<{ ${camelName}: ${fragmentName} }>) => {
42
- return <div>{JSON.stringify(${camelName})}</div>
43
- }
@@ -1,23 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
-
3
- import { Empty, Success } from './${pascalName}Cell'
4
- import { standard } from './${pascalName}Cell.mock'
5
-
6
- const meta: Meta = {
7
- title: 'Cells/${pascalName}Cell',
8
- tags: ['autodocs']
9
- }
10
-
11
- export default meta
12
-
13
- export const empty: StoryObj<typeof Empty> = {
14
- render: () => {
15
- return Empty ? <Empty /> : <></>
16
- }
17
- }
18
-
19
- export const success: StoryObj<typeof Success> = {
20
- render: (args) => {
21
- return Success ? <Success {...standard()} {...args} /> : <></>
22
- }
23
- }
@@ -1,30 +0,0 @@
1
- import { render } from '@cedarjs/testing/web'
2
-
3
- import { Empty, Success } from './${pascalName}Cell'
4
- import { standard } from './${pascalName}Cell.mock'
5
-
6
- // Generated boilerplate tests do not account for all circumstances
7
- // and can fail without adjustments, e.g. Float and DateTime types.
8
- // Please refer to the RedwoodJS Testing Docs:
9
- // https://cedarjs.com/docs/testing#testing-cells
10
- // https://cedarjs.com/docs/testing#expect-type-considerations
11
-
12
- describe('${pascalName}Cell', () => {
13
- it('renders Empty successfully', async () => {
14
- expect(() => {
15
- render(<Empty />)
16
- }).not.toThrow()
17
- })
18
-
19
- // When you're ready to test the actual output of your component render
20
- // you could test that, for example, certain text is present:
21
- //
22
- // 1. import { screen } from '@cedarjs/testing/web'
23
- // 2. Add test: expect(screen.getByText('Hello, world')).toBeInTheDocument()
24
-
25
- it('renders Success successfully', async () => {
26
- expect(() => {
27
- render(<Success ${camelName}={standard().${camelName}} />)
28
- }).not.toThrow()
29
- })
30
- })
@@ -1,131 +0,0 @@
1
- import { useEffect, useRef } from 'react'
2
-
3
- import {
4
- Form,
5
- Label,
6
- PasswordField,
7
- Submit,
8
- FieldError,
9
- } from '@cedarjs/forms'
10
- import { navigate, routes } from '@cedarjs/router'
11
- import { Metadata } from '@cedarjs/web'
12
- import { toast, Toaster } from '@cedarjs/web/toast'
13
-
14
- import { useAuth } from 'src/auth'
15
-
16
- const ChangePasswordPage = () => {
17
- const { loading, isAuthenticated, reauthenticate, changePassword } =
18
- useAuth()
19
-
20
- // Only a logged in user can change their password
21
- useEffect(() => {
22
- if (!loading && !isAuthenticated) {
23
- navigate(routes.login())
24
- }
25
- }, [loading, isAuthenticated])
26
-
27
- const current${passwordPascalCase}Ref = useRef<HTMLInputElement>(null)
28
- useEffect(() => {
29
- current${passwordPascalCase}Ref.current?.focus()
30
- }, [])
31
-
32
- const onSubmit = async (data: Record<string, string>) => {
33
- const response = await changePassword({
34
- currentPassword: data.current${passwordPascalCase},
35
- newPassword: data.new${passwordPascalCase},
36
- })
37
-
38
- if (response.error) {
39
- toast.error(response.error)
40
- } else {
41
- // The function `changePassword.handler` in api/src/functions/auth.js
42
- // decides if the user stays logged in. `reauthenticate()` picks up
43
- // whichever it was
44
- toast.success('${passwordTitleCase} changed!')
45
- await reauthenticate()
46
- navigate(routes.home())
47
- }
48
- }
49
-
50
- return (
51
- <>
52
- <Metadata title="Change ${passwordTitleCase}" />
53
-
54
- <main className="rw-main">
55
- <Toaster toastOptions={{ className: 'rw-toast', duration: 6000 }} />
56
- <div className="rw-scaffold rw-login-container">
57
- <div className="rw-segment">
58
- <header className="rw-segment-header">
59
- <h2 className="rw-heading rw-heading-secondary">
60
- Change ${passwordTitleCase}
61
- </h2>
62
- </header>
63
-
64
- <div className="rw-segment-main">
65
- <div className="rw-form-wrapper">
66
- <Form onSubmit={onSubmit} className="rw-form-wrapper">
67
- <Label
68
- name="current${passwordPascalCase}"
69
- className="rw-label"
70
- errorClassName="rw-label rw-label-error"
71
- >
72
- Current ${passwordTitleCase}
73
- </Label>
74
- <PasswordField
75
- name="current${passwordPascalCase}"
76
- autoComplete="current-password"
77
- className="rw-input"
78
- errorClassName="rw-input rw-input-error"
79
- ref={current${passwordPascalCase}Ref}
80
- validation={{
81
- required: {
82
- value: true,
83
- message: 'Current ${passwordTitleCase} is required',
84
- },
85
- }}
86
- />
87
-
88
- <FieldError
89
- name="current${passwordPascalCase}"
90
- className="rw-field-error"
91
- />
92
-
93
- <Label
94
- name="new${passwordPascalCase}"
95
- className="rw-label"
96
- errorClassName="rw-label rw-label-error"
97
- >
98
- New ${passwordTitleCase}
99
- </Label>
100
- <PasswordField
101
- name="new${passwordPascalCase}"
102
- autoComplete="new-password"
103
- className="rw-input"
104
- errorClassName="rw-input rw-input-error"
105
- validation={{
106
- required: {
107
- value: true,
108
- message: 'New ${passwordTitleCase} is required',
109
- },
110
- }}
111
- />
112
-
113
- <FieldError
114
- name="new${passwordPascalCase}"
115
- className="rw-field-error"
116
- />
117
-
118
- <div className="rw-button-group">
119
- <Submit className="rw-button rw-button-blue">Submit</Submit>
120
- </div>
121
- </Form>
122
- </div>
123
- </div>
124
- </div>
125
- </div>
126
- </main>
127
- </>
128
- )
129
- }
130
-
131
- export default ChangePasswordPage
@@ -1,164 +0,0 @@
1
- import { useEffect, useRef } from 'react'
2
-
3
- import {
4
- Form,
5
- Label,
6
- TextField,
7
- PasswordField,
8
- Submit,
9
- FieldError,
10
- } from '@cedarjs/forms'
11
- import { Link, navigate, routes } from '@cedarjs/router'
12
- import { Metadata } from '@cedarjs/web'
13
- import { toast, Toaster } from '@cedarjs/web/toast'
14
-
15
- import { getOAuthUrl, getOAuthError } from '@cedarjs/auth-dbauth-web/oauth'
16
-
17
- import { useAuth } from 'src/auth'
18
-
19
- const LoginPage = () => {
20
- const { isAuthenticated, logIn } = useAuth()
21
-
22
- useEffect(() => {
23
- if (isAuthenticated) {
24
- navigate(routes.home())
25
- }
26
- }, [isAuthenticated])
27
-
28
- // Surface an error that the OAuth provider redirect sent back, e.g.
29
- // after the user cancels the provider's consent screen.
30
- useEffect(() => {
31
- const oauthError = getOAuthError(window.location.search)
32
-
33
- if (oauthError) {
34
- toast.error('Could not log in: ' + oauthError)
35
- }
36
- }, [])
37
-
38
- const ${usernameCamelCase}Ref = useRef<HTMLInputElement>(null)
39
- useEffect(() => {
40
- ${usernameCamelCase}Ref.current?.focus()
41
- }, [])
42
-
43
- const onSubmit = async (data: Record<string, string>) => {
44
- const response = await logIn({ username: data.${usernameCamelCase}, password: data.${passwordCamelCase} })
45
-
46
- if (response.message) {
47
- toast(response.message)
48
- } else if (response.error) {
49
- toast.error(response.error)
50
- } else {
51
- toast.success('Welcome back!')
52
- }
53
- }
54
-
55
- return (
56
- <>
57
- <Metadata title="Login" />
58
-
59
- <main className="rw-main">
60
- <Toaster toastOptions={{ className: 'rw-toast', duration: 6000 }} />
61
- <div className="rw-scaffold rw-login-container">
62
- <div className="rw-segment">
63
- <header className="rw-segment-header">
64
- <h2 className="rw-heading rw-heading-secondary">Login</h2>
65
- </header>
66
-
67
- <div className="rw-segment-main">
68
- <div className="rw-form-wrapper">
69
- <Form onSubmit={onSubmit} className="rw-form-wrapper">
70
- <Label
71
- name="${usernameCamelCase}"
72
- className="rw-label"
73
- errorClassName="rw-label rw-label-error"
74
- >
75
- ${usernameTitleCase}
76
- </Label>
77
- <TextField
78
- name="${usernameCamelCase}"
79
- className="rw-input"
80
- errorClassName="rw-input rw-input-error"
81
- ref={${usernameCamelCase}Ref}
82
- validation={{
83
- required: {
84
- value: true,
85
- message: '${usernameTitleCase} is required',
86
- },
87
- }}
88
- />
89
-
90
- <FieldError name="${usernameCamelCase}" className="rw-field-error" />
91
-
92
- <Label
93
- name="${passwordCamelCase}"
94
- className="rw-label"
95
- errorClassName="rw-label rw-label-error"
96
- >
97
- ${passwordTitleCase}
98
- </Label>
99
- <PasswordField
100
- name="${passwordCamelCase}"
101
- className="rw-input"
102
- errorClassName="rw-input rw-input-error"
103
- autoComplete="current-password"
104
- validation={{
105
- required: {
106
- value: true,
107
- message: '${passwordTitleCase} is required',
108
- },
109
- }}
110
- />
111
-
112
- <div className="rw-forgot-link">
113
- <Link
114
- to={routes.forgotPassword()}
115
- className="rw-forgot-link"
116
- >
117
- Forgot ${passwordTitleCase}?
118
- </Link>
119
- </div>
120
-
121
- <FieldError name="${passwordCamelCase}" className="rw-field-error" />
122
-
123
- <div className="rw-button-group">
124
- <Submit className="rw-button rw-button-blue">Login</Submit>
125
- </div>
126
- </Form>
127
-
128
- {/*
129
- * OAuth login buttons. Delete the ones for providers you
130
- * haven't configured in `cedar setup auth dbAuth --oauth`.
131
- * Each link is a full-page navigation to the provider's
132
- * authorize route — it must not be turned into a fetch/XHR
133
- * call.
134
- */}
135
- <div className="rw-button-group">
136
- <a
137
- href={getOAuthUrl('google', { flow: 'login' })}
138
- className="rw-button rw-button-blue"
139
- >
140
- Continue with Google
141
- </a>
142
- <a
143
- href={getOAuthUrl('github', { flow: 'login' })}
144
- className="rw-button rw-button-blue"
145
- >
146
- Continue with GitHub
147
- </a>
148
- </div>
149
- </div>
150
- </div>
151
- </div>
152
- <div className="rw-login-link">
153
- <span>Don&apos;t have an account?</span>{' '}
154
- <Link to={routes.signup()} className="rw-link">
155
- Sign up!
156
- </Link>
157
- </div>
158
- </div>
159
- </main>
160
- </>
161
- )
162
- }
163
-
164
- export default LoginPage