create-nextjs-cms 0.9.7 → 0.9.9
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.
- package/package.json +3 -3
- package/templates/default/.env.test +19 -0
- package/templates/default/components/form/inputs/DateRangeFormInput.tsx +23 -5
- package/templates/default/components/form/inputs/DocumentFormInput.tsx +1 -1
- package/templates/default/components/form/inputs/VideoFormInput.tsx +1 -1
- package/templates/default/dynamic-schemas/schema.ts +30 -1
- package/templates/default/next-env.d.ts +1 -1
- package/templates/default/package.json +8 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-nextjs-cms",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"tsx": "^4.20.6",
|
|
30
30
|
"typescript": "^5.9.2",
|
|
31
31
|
"@lzcms/eslint-config": "0.3.0",
|
|
32
|
-
"@lzcms/
|
|
33
|
-
"@lzcms/
|
|
32
|
+
"@lzcms/prettier-config": "0.1.0",
|
|
33
|
+
"@lzcms/tsconfig": "0.1.0"
|
|
34
34
|
},
|
|
35
35
|
"prettier": "@lzcms/prettier-config",
|
|
36
36
|
"scripts": {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
####
|
|
2
|
+
# Test database configuration
|
|
3
|
+
# Used exclusively by the Playwright e2e test suite (globalSetup).
|
|
4
|
+
# Points to the Docker MySQL container started by `pnpm test:db:up`.
|
|
5
|
+
#
|
|
6
|
+
# NEVER point these at the dev database (port 3306).
|
|
7
|
+
####
|
|
8
|
+
DB_HOST=
|
|
9
|
+
DB_PORT=
|
|
10
|
+
DB_NAME=
|
|
11
|
+
DB_USER=
|
|
12
|
+
DB_PASSWORD=
|
|
13
|
+
|
|
14
|
+
# Override these to use a different admin account in tests
|
|
15
|
+
E2E_ADMIN_USERNAME=
|
|
16
|
+
E2E_ADMIN_PASSWORD=
|
|
17
|
+
|
|
18
|
+
# Set to "true" to stop the Docker container after the test run
|
|
19
|
+
E2E_TEARDOWN_DB=
|
|
@@ -57,7 +57,7 @@ function formatValue(date: Date | undefined, format: 'date' | 'datetime'): strin
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export default function DateRangeFormInput({ input }: { input: DateRangeFieldClientConfig }) {
|
|
60
|
-
const { control } = useFormContext()
|
|
60
|
+
const { control, setValue } = useFormContext()
|
|
61
61
|
const [open, setOpen] = React.useState(false)
|
|
62
62
|
const minDate = resolveBound(input.minDate)
|
|
63
63
|
const maxDate = resolveBound(input.maxDate)
|
|
@@ -65,6 +65,8 @@ export default function DateRangeFormInput({ input }: { input: DateRangeFieldCli
|
|
|
65
65
|
...(minDate ? [{ before: toCalendarDay(minDate) as Date }] : []),
|
|
66
66
|
...(maxDate ? [{ after: toCalendarDay(maxDate) as Date }] : []),
|
|
67
67
|
]
|
|
68
|
+
const initialFrom = toDate(input.startValue)
|
|
69
|
+
const initialTo = toDate(input.endValue)
|
|
68
70
|
|
|
69
71
|
const {
|
|
70
72
|
field: startField,
|
|
@@ -72,7 +74,7 @@ export default function DateRangeFormInput({ input }: { input: DateRangeFieldCli
|
|
|
72
74
|
} = useController({
|
|
73
75
|
name: input.startName,
|
|
74
76
|
control,
|
|
75
|
-
defaultValue:
|
|
77
|
+
defaultValue: initialFrom,
|
|
76
78
|
})
|
|
77
79
|
|
|
78
80
|
const {
|
|
@@ -81,14 +83,30 @@ export default function DateRangeFormInput({ input }: { input: DateRangeFieldCli
|
|
|
81
83
|
} = useController({
|
|
82
84
|
name: input.endName,
|
|
83
85
|
control,
|
|
84
|
-
defaultValue:
|
|
86
|
+
defaultValue: initialTo,
|
|
85
87
|
})
|
|
86
88
|
|
|
87
89
|
const [range, setRange] = React.useState<DateRange | undefined>({
|
|
88
|
-
from:
|
|
89
|
-
to:
|
|
90
|
+
from: initialFrom,
|
|
91
|
+
to: initialTo,
|
|
90
92
|
})
|
|
91
93
|
|
|
94
|
+
React.useEffect(() => {
|
|
95
|
+
const nextFrom = toDate(input.startValue)
|
|
96
|
+
const nextTo = toDate(input.endValue)
|
|
97
|
+
const nextRange =
|
|
98
|
+
nextFrom || nextTo
|
|
99
|
+
? {
|
|
100
|
+
from: nextFrom,
|
|
101
|
+
to: nextTo,
|
|
102
|
+
}
|
|
103
|
+
: undefined
|
|
104
|
+
|
|
105
|
+
setRange(nextRange)
|
|
106
|
+
setValue(input.startName, nextFrom)
|
|
107
|
+
setValue(input.endName, nextTo)
|
|
108
|
+
}, [input.startValue, input.endValue, input.startName, input.endName, setValue])
|
|
109
|
+
|
|
92
110
|
function handleSelect(selected: DateRange | undefined) {
|
|
93
111
|
setRange(selected)
|
|
94
112
|
startField.onChange(selected?.from ?? undefined)
|
|
@@ -15,7 +15,7 @@ export default function VideoFormInput({ input, sectionName }: { input: VideoFie
|
|
|
15
15
|
} = useController({
|
|
16
16
|
name: input.name,
|
|
17
17
|
control,
|
|
18
|
-
defaultValue:
|
|
18
|
+
defaultValue: undefined,
|
|
19
19
|
})
|
|
20
20
|
|
|
21
21
|
const [fileName, setFileName] = useState(t('noFileSelected'))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {mysqlTable,int,longtext,mysqlEnum,varchar,index,unique,primaryKey,boolean,double,timestamp} from 'drizzle-orm/mysql-core'
|
|
1
|
+
import {mysqlTable,int,longtext,mysqlEnum,varchar,index,unique,primaryKey,boolean,double,timestamp,float,date,datetime} from 'drizzle-orm/mysql-core'
|
|
2
2
|
|
|
3
3
|
export const AppInfoTable = mysqlTable('app_info', {
|
|
4
4
|
id: int('id').autoincrement().notNull().primaryKey(),
|
|
@@ -473,3 +473,32 @@ export const AddressTable = mysqlTable('address', {
|
|
|
473
473
|
level: int('level')
|
|
474
474
|
});
|
|
475
475
|
|
|
476
|
+
|
|
477
|
+
export const E2eAllFieldsTable = mysqlTable('e2e_all_fields', {
|
|
478
|
+
id: int('id').autoincrement().notNull().primaryKey(),
|
|
479
|
+
title: varchar('title', { length: 255 }).notNull(),
|
|
480
|
+
slug: varchar('slug', { length: 255 }),
|
|
481
|
+
subtitle: longtext('subtitle'),
|
|
482
|
+
secret: varchar('secret', { length: 255 }),
|
|
483
|
+
quantity: int('quantity'),
|
|
484
|
+
price: float('price'),
|
|
485
|
+
rating: double('rating'),
|
|
486
|
+
viewCount: int('view_count'),
|
|
487
|
+
isPublished: boolean('is_published'),
|
|
488
|
+
status: mysqlEnum('status', ['draft', 'published', 'archived', 'scheduled']).notNull(),
|
|
489
|
+
categories: varchar('categories', { length: 255 }),
|
|
490
|
+
tags: varchar('tags', { length: 255 }),
|
|
491
|
+
coverPhoto: varchar('cover_photo', { length: 255 }),
|
|
492
|
+
videoClip: varchar('video_clip', { length: 255 }),
|
|
493
|
+
attachment: varchar('attachment', { length: 255 }),
|
|
494
|
+
bodyContent: longtext('body_content'),
|
|
495
|
+
publishDate: date('publish_date'),
|
|
496
|
+
startsAt: datetime('starts_at'),
|
|
497
|
+
availableFrom: date('available_from'),
|
|
498
|
+
availableUntil: date('available_until'),
|
|
499
|
+
brandColor: varchar('brand_color', { length: 7 }),
|
|
500
|
+
mapLocation: varchar('map_location', { length: 255 })
|
|
501
|
+
}, (table) => [
|
|
502
|
+
index('e2e_title_index').on(table.title)
|
|
503
|
+
]);
|
|
504
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="next" />
|
|
2
2
|
/// <reference types="next/image-types/global" />
|
|
3
|
-
import "./.next/types/routes.d.ts";
|
|
3
|
+
import "./.next/dev/types/routes.d.ts";
|
|
4
4
|
|
|
5
5
|
// NOTE: This file should not be edited
|
|
6
6
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
"format": "prettier --check . --ignore-path ../../.gitignore",
|
|
11
11
|
"clean": "git clean -xdf .turbo .next node_modules",
|
|
12
12
|
"typecheck": "tsc --noEmit",
|
|
13
|
-
"postinstall": "node ./lib/postinstall.js"
|
|
13
|
+
"postinstall": "node ./lib/postinstall.js",
|
|
14
|
+
"test:e2e": "cross-env E2E_TEARDOWN_DB=true playwright test",
|
|
15
|
+
"test:e2e:ui": "playwright test --ui",
|
|
16
|
+
"test:e2e:debug": "playwright test --debug",
|
|
17
|
+
"test:e2e:report": "playwright show-report"
|
|
14
18
|
},
|
|
15
19
|
"dependencies": {
|
|
16
20
|
"@dnd-kit/core": "^6.3.1",
|
|
@@ -54,18 +58,18 @@
|
|
|
54
58
|
"clsx": "^2.1.1",
|
|
55
59
|
"cmdk": "^1.1.1",
|
|
56
60
|
"dayjs": "^1.11.19",
|
|
61
|
+
"dompurify": "^3.3.3",
|
|
57
62
|
"dotenv": "^17.2.3",
|
|
58
63
|
"drizzle-orm": "^0.45.1",
|
|
59
64
|
"drizzle-zod": "^0.8.3",
|
|
60
65
|
"eslint-plugin-drizzle": "^0.2.3",
|
|
61
66
|
"file-type": "^20.1.0",
|
|
62
|
-
"isomorphic-dompurify": "^3.7.1",
|
|
63
67
|
"lodash-es": "^4.17.21",
|
|
64
68
|
"lucide-react": "^0.563.0",
|
|
65
69
|
"nanoid": "^5.1.2",
|
|
66
70
|
"next": "16.1.1",
|
|
67
71
|
"next-themes": "^0.4.6",
|
|
68
|
-
"nextjs-cms": "0.9.
|
|
72
|
+
"nextjs-cms": "0.9.9",
|
|
69
73
|
"plaiceholder": "^3.0.0",
|
|
70
74
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
71
75
|
"qrcode": "^1.5.4",
|
|
@@ -87,6 +91,7 @@
|
|
|
87
91
|
"zod": "4.1.12"
|
|
88
92
|
},
|
|
89
93
|
"devDependencies": {
|
|
94
|
+
"@playwright/test": "^1.59.1",
|
|
90
95
|
"@tailwindcss/postcss": "^4.1.18",
|
|
91
96
|
"@types/lodash-es": "^4.17.12",
|
|
92
97
|
"@types/node": "22.13.8",
|