create-nextjs-cms 0.6.8 → 0.7.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.
- package/dist/index.js +1 -1
- package/dist/lib/cms-setup.js +2 -2
- package/package.json +1 -1
- package/templates/default/app/(auth)/layout.tsx +12 -3
- package/templates/default/app/(rootLayout)/(plugins)/[...slug]/plugin-server-registry.ts +3 -3
- package/templates/default/app/(rootLayout)/layout.tsx +20 -7
- package/templates/default/cms.config.ts +4 -4
- package/templates/default/components/Navbar.tsx +2 -5
- package/templates/default/components/VariantCard.tsx +1 -0
- package/templates/default/components/locale-picker.tsx +1 -1
- package/templates/default/components/ui/direction.tsx +22 -0
- package/templates/default/package.json +5 -2
package/dist/index.js
CHANGED
|
@@ -54,7 +54,7 @@ async function createNextjsCms() {
|
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
56
|
logger.message(`${preferredPM} install`);
|
|
57
|
-
logger.message(`${preferredPM} nextjs-cms
|
|
57
|
+
logger.message(`${preferredPM} nextjs-cms --dev setup`);
|
|
58
58
|
logger.message(`${preferredPM} dev`);
|
|
59
59
|
}
|
|
60
60
|
console.log('\n');
|
package/dist/lib/cms-setup.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as p from '@clack/prompts';
|
|
|
5
5
|
const runCmsSetupCommand = async ({ preferredPM, projectDir, }) => {
|
|
6
6
|
// For all package managers, use inherit for stdout/stderr to avoid hanging issues
|
|
7
7
|
// The command will show its own output and the spinner will just indicate progress
|
|
8
|
-
await execWithoutSpinner(preferredPM, ['nextjs-cms
|
|
8
|
+
await execWithoutSpinner(preferredPM, ['nextjs-cms', '--dev', 'setup'], {
|
|
9
9
|
cwd: projectDir,
|
|
10
10
|
stdout: 'inherit',
|
|
11
11
|
stderr: 'inherit',
|
|
@@ -19,7 +19,7 @@ export const runCmsSetup = async ({ dir, preferredPM }) => {
|
|
|
19
19
|
}
|
|
20
20
|
catch (error) {
|
|
21
21
|
logger.error('⚠️ CMS setup failed. You may need to run it manually:');
|
|
22
|
-
logger.warn(`${preferredPM} nextjs-cms
|
|
22
|
+
logger.warn(`${preferredPM} nextjs-cms --dev setup`);
|
|
23
23
|
logger.error(` Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
24
24
|
throw error;
|
|
25
25
|
}
|
package/package.json
CHANGED
|
@@ -9,8 +9,10 @@ import auth from 'nextjs-cms/auth'
|
|
|
9
9
|
import { getCMSConfig } from 'nextjs-cms/core'
|
|
10
10
|
import { I18nProviderClient } from 'nextjs-cms/translations/client'
|
|
11
11
|
import { resolveLocale, RTL_LOCALES, LOCALE_COOKIE_NAME } from 'nextjs-cms/translations'
|
|
12
|
+
import { getClientDictionaries } from 'nextjs-cms/translations/server'
|
|
12
13
|
import { redirect } from 'next/navigation'
|
|
13
14
|
import { AuthLocaleProvider } from './auth-locale-provider'
|
|
15
|
+
import { DirectionProvider } from "@/components/ui/direction"
|
|
14
16
|
|
|
15
17
|
const inter = Inter({
|
|
16
18
|
subsets: ['latin'],
|
|
@@ -31,16 +33,21 @@ export async function generateMetadata(): Promise<Metadata> {
|
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
|
34
|
-
const session = await
|
|
36
|
+
const [session, cmsConfig] = await Promise.all([
|
|
37
|
+
auth(),
|
|
38
|
+
getCMSConfig(),
|
|
39
|
+
])
|
|
40
|
+
|
|
35
41
|
if (session) {
|
|
36
42
|
redirect('/')
|
|
37
43
|
}
|
|
38
|
-
|
|
44
|
+
|
|
39
45
|
const { supportedLanguages, fallbackLanguage } = cmsConfig.i18n
|
|
40
46
|
const cookieStore = await cookies()
|
|
41
47
|
const cookieLocale = cookieStore.get(LOCALE_COOKIE_NAME)?.value
|
|
42
48
|
const locale = resolveLocale(cookieLocale, supportedLanguages, fallbackLanguage)
|
|
43
49
|
const isRTL = RTL_LOCALES.has(locale)
|
|
50
|
+
const dictionaries = getClientDictionaries(supportedLanguages)
|
|
44
51
|
|
|
45
52
|
return (
|
|
46
53
|
<html lang={locale} dir={isRTL ? 'rtl' : 'ltr'} suppressHydrationWarning>
|
|
@@ -50,7 +57,8 @@ export default async function RootLayout({ children }: { children: React.ReactNo
|
|
|
50
57
|
isRTL ? cairo.variable : inter.variable,
|
|
51
58
|
)}
|
|
52
59
|
>
|
|
53
|
-
<
|
|
60
|
+
<DirectionProvider dir={isRTL ? 'rtl' : 'ltr'} direction={isRTL ? 'rtl' : 'ltr'}>
|
|
61
|
+
<I18nProviderClient locale={locale} dictionaries={dictionaries}>
|
|
54
62
|
<ThemeProvider
|
|
55
63
|
attribute='class'
|
|
56
64
|
defaultTheme={cmsConfig.ui.defaultTheme}
|
|
@@ -66,6 +74,7 @@ export default async function RootLayout({ children }: { children: React.ReactNo
|
|
|
66
74
|
</AuthLocaleProvider>
|
|
67
75
|
</ThemeProvider>
|
|
68
76
|
</I18nProviderClient>
|
|
77
|
+
</DirectionProvider>
|
|
69
78
|
</body>
|
|
70
79
|
</html>
|
|
71
80
|
)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import dynamic from 'next/dynamic'
|
|
2
2
|
|
|
3
3
|
export const pluginNamesMap: Record<string, string> = {
|
|
4
|
-
'cpanel-dashboard': '@
|
|
5
|
-
'cpanel-emails': '@
|
|
6
|
-
'google-analytics': '@
|
|
4
|
+
'cpanel-dashboard': '@nextjscms/plugins/cpanel-dashboard/server',
|
|
5
|
+
'cpanel-emails': '@nextjscms/plugins/cpanel-emails/server',
|
|
6
|
+
'google-analytics': '@nextjscms/plugins/google-analytics/server',
|
|
7
7
|
// A workaround to avoid importing error if no plugins are installed
|
|
8
8
|
blank: 'nextjs-cms/plugins/blank-component',
|
|
9
9
|
}
|
|
@@ -8,8 +8,11 @@ import auth from 'nextjs-cms/auth'
|
|
|
8
8
|
import { getCMSConfig } from 'nextjs-cms/core'
|
|
9
9
|
import { I18nProviderClient } from 'nextjs-cms/translations/client'
|
|
10
10
|
import { resolveLocale, RTL_LOCALES } from 'nextjs-cms/translations'
|
|
11
|
+
import { getClientDictionaries } from 'nextjs-cms/translations/server'
|
|
11
12
|
import { api, HydrateClient } from 'nextjs-cms/api/trpc/server'
|
|
12
13
|
import Layout from '@/components/Layout'
|
|
14
|
+
import { redirect } from 'next/navigation'
|
|
15
|
+
import { DirectionProvider } from "@/components/ui/direction"
|
|
13
16
|
|
|
14
17
|
const inter = Inter({
|
|
15
18
|
subsets: ['latin'],
|
|
@@ -30,12 +33,20 @@ export async function generateMetadata(): Promise<Metadata> {
|
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
export default async function CMSLayout({ children }: { children: React.ReactNode }) {
|
|
33
|
-
const session = await
|
|
34
|
-
|
|
36
|
+
const [session, cmsConfig, _] = await Promise.all([
|
|
37
|
+
auth(),
|
|
38
|
+
getCMSConfig(),
|
|
39
|
+
api.navigation.getSidebar.prefetch(),
|
|
40
|
+
])
|
|
41
|
+
|
|
42
|
+
if (!session) {
|
|
43
|
+
redirect('/auth/login')
|
|
44
|
+
}
|
|
45
|
+
|
|
35
46
|
const { supportedLanguages, fallbackLanguage } = cmsConfig.i18n
|
|
36
|
-
const locale = resolveLocale(session
|
|
47
|
+
const locale = resolveLocale(session.user.locale, supportedLanguages, fallbackLanguage)
|
|
37
48
|
const isRTL = RTL_LOCALES.has(locale)
|
|
38
|
-
|
|
49
|
+
const dictionaries = getClientDictionaries(supportedLanguages)
|
|
39
50
|
|
|
40
51
|
return (
|
|
41
52
|
<html lang={locale} dir={isRTL ? 'rtl' : 'ltr'} suppressHydrationWarning>
|
|
@@ -45,7 +56,8 @@ export default async function CMSLayout({ children }: { children: React.ReactNod
|
|
|
45
56
|
isRTL ? cairo.variable : inter.variable,
|
|
46
57
|
)}
|
|
47
58
|
>
|
|
48
|
-
<
|
|
59
|
+
<DirectionProvider dir={isRTL ? 'rtl' : 'ltr'} direction={isRTL ? 'rtl' : 'ltr'}>
|
|
60
|
+
<I18nProviderClient locale={locale} dictionaries={dictionaries}>
|
|
49
61
|
<ThemeProvider
|
|
50
62
|
attribute='class'
|
|
51
63
|
defaultTheme={cmsConfig.ui.defaultTheme}
|
|
@@ -59,8 +71,9 @@ export default async function CMSLayout({ children }: { children: React.ReactNod
|
|
|
59
71
|
</Layout>
|
|
60
72
|
</HydrateClient>
|
|
61
73
|
</Providers>
|
|
62
|
-
|
|
63
|
-
|
|
74
|
+
</ThemeProvider>
|
|
75
|
+
</I18nProviderClient>
|
|
76
|
+
</DirectionProvider>
|
|
64
77
|
</body>
|
|
65
78
|
</html>
|
|
66
79
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CMSConfig } from 'nextjs-cms/core/config'
|
|
2
|
-
import en from 'nextjs-cms/translations/
|
|
3
|
-
import ar from '
|
|
2
|
+
import en from 'nextjs-cms/translations/base/en'
|
|
3
|
+
import ar from '@nextjscms/translations/ar'
|
|
4
4
|
import process from 'process'
|
|
5
5
|
import { resolve } from 'path'
|
|
6
6
|
|
|
@@ -46,7 +46,7 @@ export const config: CMSConfig = {
|
|
|
46
46
|
},
|
|
47
47
|
},
|
|
48
48
|
i18n: {
|
|
49
|
-
supportedLanguages: { ar },
|
|
50
|
-
fallbackLanguage: '
|
|
49
|
+
supportedLanguages: { ar, en },
|
|
50
|
+
fallbackLanguage: 'en',
|
|
51
51
|
},
|
|
52
52
|
}
|
|
@@ -42,7 +42,6 @@ const formatTimestamp = (value?: Date | string | null) => {
|
|
|
42
42
|
|
|
43
43
|
export default function Navbar(props: Props) {
|
|
44
44
|
const t = useI18n()
|
|
45
|
-
const { theme, setTheme } = useTheme()
|
|
46
45
|
const session = useSession()
|
|
47
46
|
const { toast } = useToast()
|
|
48
47
|
const locale = session?.data?.user?.locale ?? 'en'
|
|
@@ -132,9 +131,8 @@ export default function Navbar(props: Props) {
|
|
|
132
131
|
</DropdownMenuTrigger>
|
|
133
132
|
<DropdownMenuContent
|
|
134
133
|
sideOffset={12}
|
|
135
|
-
align={
|
|
134
|
+
align={'end'}
|
|
136
135
|
side='bottom'
|
|
137
|
-
alignOffset={isRTL ? 20 : -20}
|
|
138
136
|
className='w-[400px] max-w-full ring-1 ring-sky-400/80 dark:ring-amber-900'
|
|
139
137
|
>
|
|
140
138
|
<DropdownMenuLabel>{t('notifications')}</DropdownMenuLabel>
|
|
@@ -225,9 +223,8 @@ export default function Navbar(props: Props) {
|
|
|
225
223
|
</DropdownMenuTrigger>
|
|
226
224
|
<DropdownMenuContent
|
|
227
225
|
sideOffset={12}
|
|
228
|
-
align={
|
|
226
|
+
align={'end'}
|
|
229
227
|
side='bottom'
|
|
230
|
-
alignOffset={isRTL ? 10 : -10}
|
|
231
228
|
className='w-56 max-w-full ring-1 ring-sky-400/80 dark:ring-amber-900'
|
|
232
229
|
>
|
|
233
230
|
<DropdownMenuLabel>{session.data?.user.name}</DropdownMenuLabel>
|
|
@@ -24,6 +24,7 @@ const VariantCard = ({
|
|
|
24
24
|
const axiosPrivate = useAxiosPrivate()
|
|
25
25
|
const controller = new AbortController()
|
|
26
26
|
const { toast } = useToast()
|
|
27
|
+
const t = useI18n()
|
|
27
28
|
|
|
28
29
|
const handleDelete = async () => {
|
|
29
30
|
const response = await handleVariantDeletion(variant.variant_name, variantItem.id, axiosPrivate, controller)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Direction } from "radix-ui"
|
|
5
|
+
|
|
6
|
+
function DirectionProvider({
|
|
7
|
+
dir,
|
|
8
|
+
direction,
|
|
9
|
+
children,
|
|
10
|
+
}: React.ComponentProps<typeof Direction.DirectionProvider> & {
|
|
11
|
+
direction?: React.ComponentProps<typeof Direction.DirectionProvider>["dir"]
|
|
12
|
+
}) {
|
|
13
|
+
return (
|
|
14
|
+
<Direction.DirectionProvider dir={direction ?? dir}>
|
|
15
|
+
{children}
|
|
16
|
+
</Direction.DirectionProvider>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const useDirection = Direction.useDirection
|
|
21
|
+
|
|
22
|
+
export { DirectionProvider, useDirection }
|
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
"@formkit/auto-animate": "^0.9.0",
|
|
20
20
|
"@hookform/resolvers": "^5.2.2",
|
|
21
21
|
"@next/env": "16.1.1",
|
|
22
|
+
"@nextjscms/plugins/cpanel-dashboard": "workspace:*",
|
|
23
|
+
"@nextjscms/plugins/cpanel-emails": "workspace:*",
|
|
24
|
+
"@nextjscms/plugins/google-analytics": "workspace:*",
|
|
22
25
|
"@radix-ui/react-accordion": "^1.2.3",
|
|
23
26
|
"@radix-ui/react-alert-dialog": "^1.1.15",
|
|
24
27
|
"@radix-ui/react-aspect-ratio": "^1.1.2",
|
|
@@ -65,10 +68,11 @@
|
|
|
65
68
|
"nanoid": "^5.1.2",
|
|
66
69
|
"next": "16.1.1",
|
|
67
70
|
"next-themes": "^0.4.6",
|
|
68
|
-
"nextjs-cms": "0.
|
|
71
|
+
"nextjs-cms": "0.7.0",
|
|
69
72
|
"plaiceholder": "^3.0.0",
|
|
70
73
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
71
74
|
"qrcode": "^1.5.4",
|
|
75
|
+
"radix-ui": "^1.4.3",
|
|
72
76
|
"react": "19.2.3",
|
|
73
77
|
"react-day-picker": "9.12.0",
|
|
74
78
|
"react-dom": "19.2.3",
|
|
@@ -98,7 +102,6 @@
|
|
|
98
102
|
"eslint-config-prettier": "^10.0.1",
|
|
99
103
|
"eslint-plugin-prettier": "^5.2.3",
|
|
100
104
|
"fs-extra": "^11.3.3",
|
|
101
|
-
"nextjs-cms-kit": "0.6.8",
|
|
102
105
|
"postcss": "^8.5.1",
|
|
103
106
|
"prettier": "3.5.0",
|
|
104
107
|
"raw-loader": "^4.0.2",
|