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 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-kit --dev setup`);
57
+ logger.message(`${preferredPM} nextjs-cms --dev setup`);
58
58
  logger.message(`${preferredPM} dev`);
59
59
  }
60
60
  console.log('\n');
@@ -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-kit', '--dev', 'setup'], {
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-kit --dev setup`);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nextjs-cms",
3
- "version": "0.6.8",
3
+ "version": "0.7.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -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 auth()
36
+ const [session, cmsConfig] = await Promise.all([
37
+ auth(),
38
+ getCMSConfig(),
39
+ ])
40
+
35
41
  if (session) {
36
42
  redirect('/')
37
43
  }
38
- const cmsConfig = await getCMSConfig()
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
- <I18nProviderClient locale={locale}>
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': '@nextjs-cms-plugins/cpanel-dashboard/server',
5
- 'cpanel-emails': '@nextjs-cms-plugins/cpanel-emails/server',
6
- 'google-analytics': '@nextjs-cms-plugins/google-analytics/server',
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 auth()
34
- const cmsConfig = await getCMSConfig()
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?.user?.locale, supportedLanguages, fallbackLanguage)
47
+ const locale = resolveLocale(session.user.locale, supportedLanguages, fallbackLanguage)
37
48
  const isRTL = RTL_LOCALES.has(locale)
38
- await api.navigation.getSidebar.prefetch()
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
- <I18nProviderClient locale={locale}>
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
- </ThemeProvider>
63
- </I18nProviderClient>
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/dictionaries/en'
3
- import ar from 'nextjs-cms/translations/dictionaries/ar'
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: 'ar',
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={isRTL ? 'start' : 'end'}
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={isRTL ? 'start' : 'end'}
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)
@@ -64,7 +64,7 @@ export default function LocalePicker({
64
64
  </button>
65
65
  </DropdownMenuTrigger>
66
66
  <DropdownMenuContent
67
- align={isRTL ? 'start' : 'end'}
67
+ align={'end'}
68
68
  sideOffset={12}
69
69
  className='ring-1 ring-sky-400/80 dark:ring-amber-900'
70
70
  >
@@ -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.6.8",
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",