create-ej-app 18.0.0 → 19.0.0

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 (35) hide show
  1. package/cli.js +1 -30
  2. package/cli.ts +1 -43
  3. package/package.json +2 -3
  4. package/template/api/package.json +4 -4
  5. package/template/nextjs/.vscode/extensions.json +11 -0
  6. package/template/nextjs/.vscode/settings.json +3 -0
  7. package/template/nextjs/components.json +4 -1
  8. package/template/nextjs/package.json +25 -27
  9. package/template/nextjs/src/app/(admin)/layout.tsx +2 -2
  10. package/template/nextjs/src/app/(app)/app/page.tsx +3 -0
  11. package/template/nextjs/src/app/(app)/layout.tsx +1 -1
  12. package/template/nextjs/src/app/(auth)/login/email-login-form.tsx +33 -34
  13. package/template/nextjs/src/app/globals.css +127 -15
  14. package/template/nextjs/src/app/layout.tsx +8 -4
  15. package/template/nextjs/src/app/not-found.tsx +1 -1
  16. package/template/nextjs/src/components/theme-provider.tsx +67 -0
  17. package/template/nextjs/src/components/ui/button.tsx +22 -15
  18. package/template/nextjs/src/components/ui/card.tsx +17 -6
  19. package/template/nextjs/src/components/ui/field.tsx +238 -0
  20. package/template/nextjs/src/components/ui/input.tsx +1 -3
  21. package/template/nextjs/src/components/ui/label.tsx +1 -1
  22. package/template/nextjs/src/components/ui/separator.tsx +2 -2
  23. package/template/nextjs/src/components/ui/sonner.tsx +5 -0
  24. package/template/nextjs/src/db/common.ts +31 -0
  25. package/template/nextjs/src/db/schema.ts +2 -28
  26. package/template/nextjs/src/hooks/use-mobile.ts +19 -0
  27. package/template/nextjs/src/lib/auth.ts +2 -6
  28. package/template/nextjs/src/lib/format-currency.ts +27 -0
  29. package/template/nextjs/src/lib/format-date.ts +12 -0
  30. package/template/nextjs/src/scripts/seed.ts +11 -0
  31. package/template/nextjs/src/scripts/test-mail.ts +11 -5
  32. package/template/nextjs/tsconfig.json +2 -0
  33. package/template/nextjs/src/app/api/[[...slugs]]/route.ts +0 -25
  34. package/template/nextjs/src/components/ui/form.tsx +0 -167
  35. package/template/nextjs/src/lib/eden.ts +0 -7
@@ -2,10 +2,10 @@ import { render, toPlainText } from '@react-email/render'
2
2
  import TestEmail from '~/emails/test'
3
3
  import { sendEmail } from '~/lib/nodemailer'
4
4
 
5
- async function main() {
5
+ async function sendTestMail() {
6
6
  const html = await render(
7
7
  TestEmail({
8
- name: 'Ekansh Jain'
8
+ name: 'John Doe'
9
9
  }),
10
10
  {
11
11
  pretty: true
@@ -22,8 +22,14 @@ async function main() {
22
22
  })
23
23
 
24
24
  console.info('Test email sent successfully', result)
25
-
26
- process.exit()
27
25
  }
28
26
 
29
- main()
27
+ if (import.meta.main) {
28
+ try {
29
+ await sendTestMail()
30
+ } catch (err) {
31
+ console.error('Error sending test mail:', err)
32
+ } finally {
33
+ process.exit(0)
34
+ }
35
+ }
@@ -15,6 +15,8 @@
15
15
  "noUnusedParameters": true,
16
16
  "noImplicitReturns": true,
17
17
  "noFallthroughCasesInSwitch": true,
18
+ "allowUnreachableCode": false,
19
+ "noUncheckedSideEffectImports": false,
18
20
  "forceConsistentCasingInFileNames": true,
19
21
  "noEmit": true,
20
22
  "esModuleInterop": true,
@@ -1,25 +0,0 @@
1
- import { Elysia } from 'elysia'
2
- import z from 'zod'
3
-
4
- export const elysiaApi = new Elysia({ prefix: '/api' })
5
- .get('/', 'Hello from Elysia')
6
- .post(
7
- '/',
8
- ({ body }) => {
9
- return `Hello, ${body.name}!`
10
- },
11
- {
12
- body: z.object({
13
- name: z.string().trim().min(1).describe('Name of the user')
14
- }),
15
- detail: {
16
- description: 'Greet a user by name'
17
- }
18
- }
19
- )
20
-
21
- export const GET = elysiaApi.fetch
22
- export const POST = elysiaApi.fetch
23
- export const PUT = elysiaApi.fetch
24
- export const PATCH = elysiaApi.fetch
25
- export const DELETE = elysiaApi.fetch
@@ -1,167 +0,0 @@
1
- 'use client'
2
-
3
- import * as LabelPrimitive from '@radix-ui/react-label'
4
- import { Slot } from '@radix-ui/react-slot'
5
- import * as React from 'react'
6
- import {
7
- Controller,
8
- FormProvider,
9
- useFormContext,
10
- useFormState,
11
- type ControllerProps,
12
- type FieldPath,
13
- type FieldValues
14
- } from 'react-hook-form'
15
-
16
- import { Label } from '~/components/ui/label'
17
- import { cn } from '~/lib/cn'
18
-
19
- const Form = FormProvider
20
-
21
- type FormFieldContextValue<
22
- TFieldValues extends FieldValues = FieldValues,
23
- TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
24
- > = {
25
- name: TName
26
- }
27
-
28
- const FormFieldContext = React.createContext<FormFieldContextValue>(
29
- {} as FormFieldContextValue
30
- )
31
-
32
- const FormField = <
33
- TFieldValues extends FieldValues = FieldValues,
34
- TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
35
- >({
36
- ...props
37
- }: ControllerProps<TFieldValues, TName>) => {
38
- return (
39
- <FormFieldContext.Provider value={{ name: props.name }}>
40
- <Controller {...props} />
41
- </FormFieldContext.Provider>
42
- )
43
- }
44
-
45
- const useFormField = () => {
46
- const fieldContext = React.useContext(FormFieldContext)
47
- const itemContext = React.useContext(FormItemContext)
48
- const { getFieldState } = useFormContext()
49
- const formState = useFormState({ name: fieldContext.name })
50
- const fieldState = getFieldState(fieldContext.name, formState)
51
-
52
- if (!fieldContext) {
53
- throw new Error('useFormField should be used within <FormField>')
54
- }
55
-
56
- const { id } = itemContext
57
-
58
- return {
59
- id,
60
- name: fieldContext.name,
61
- formItemId: `${id}-form-item`,
62
- formDescriptionId: `${id}-form-item-description`,
63
- formMessageId: `${id}-form-item-message`,
64
- ...fieldState
65
- }
66
- }
67
-
68
- type FormItemContextValue = {
69
- id: string
70
- }
71
-
72
- const FormItemContext = React.createContext<FormItemContextValue>(
73
- {} as FormItemContextValue
74
- )
75
-
76
- function FormItem({ className, ...props }: React.ComponentProps<'div'>) {
77
- const id = React.useId()
78
-
79
- return (
80
- <FormItemContext.Provider value={{ id }}>
81
- <div
82
- data-slot="form-item"
83
- className={cn('grid gap-2', className)}
84
- {...props}
85
- />
86
- </FormItemContext.Provider>
87
- )
88
- }
89
-
90
- function FormLabel({
91
- className,
92
- ...props
93
- }: React.ComponentProps<typeof LabelPrimitive.Root>) {
94
- const { error, formItemId } = useFormField()
95
-
96
- return (
97
- <Label
98
- data-slot="form-label"
99
- data-error={!!error}
100
- className={cn('data-[error=true]:text-destructive', className)}
101
- htmlFor={formItemId}
102
- {...props}
103
- />
104
- )
105
- }
106
-
107
- function FormControl({ ...props }: React.ComponentProps<typeof Slot>) {
108
- const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
109
-
110
- return (
111
- <Slot
112
- data-slot="form-control"
113
- id={formItemId}
114
- aria-describedby={
115
- !error
116
- ? `${formDescriptionId}`
117
- : `${formDescriptionId} ${formMessageId}`
118
- }
119
- aria-invalid={!!error}
120
- {...props}
121
- />
122
- )
123
- }
124
-
125
- function FormDescription({ className, ...props }: React.ComponentProps<'p'>) {
126
- const { formDescriptionId } = useFormField()
127
-
128
- return (
129
- <p
130
- data-slot="form-description"
131
- id={formDescriptionId}
132
- className={cn('text-muted-foreground text-sm', className)}
133
- {...props}
134
- />
135
- )
136
- }
137
-
138
- function FormMessage({ className, ...props }: React.ComponentProps<'p'>) {
139
- const { error, formMessageId } = useFormField()
140
- const body = error ? String(error?.message ?? '') : props.children
141
-
142
- if (!body) {
143
- return null
144
- }
145
-
146
- return (
147
- <p
148
- data-slot="form-message"
149
- id={formMessageId}
150
- className={cn('text-destructive text-sm', className)}
151
- {...props}
152
- >
153
- {body}
154
- </p>
155
- )
156
- }
157
-
158
- export {
159
- Form,
160
- FormControl,
161
- FormDescription,
162
- FormField,
163
- FormItem,
164
- FormLabel,
165
- FormMessage,
166
- useFormField
167
- }
@@ -1,7 +0,0 @@
1
- import { treaty } from '@elysiajs/eden'
2
- import { elysiaApi } from '~/app/api/[[...slugs]]/route'
3
-
4
- export const api =
5
- typeof process !== 'undefined'
6
- ? treaty(elysiaApi).api
7
- : treaty<typeof elysiaApi>(window.location.host).api