create-nextjs-cms 0.5.69 → 0.5.70
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 +1 -1
- package/templates/default/app/(rootLayout)/(plugins)/[...slug]/.plugin-registry.mjs +7 -0
- package/templates/default/app/(rootLayout)/(plugins)/[...slug]/page.tsx +36 -36
- package/templates/default/app/(rootLayout)/(plugins)/[...slug]/plugin-server-registry.ts +21 -25
- package/templates/default/app/(rootLayout)/dashboard/page.tsx +44 -44
- package/templates/default/app/_trpc/client.ts +3 -3
- package/templates/default/app/api/trpc/[trpc]/route.ts +3 -3
- package/templates/default/components/form/helpers/_section-hot-reload.js +1 -1
- package/templates/default/next.config.ts +4 -0
- package/templates/default/package.json +2 -2
- package/templates/default/app/(rootLayout)/page.tsx +0 -10
package/package.json
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// AUTO GENERATED FILE, DO NOT DELETE OR EDIT
|
|
2
|
+
// THIS FILE IS GENERATED BY THE PLUGIN SYSTEM
|
|
3
|
+
export const _pluginNamesMap = {
|
|
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',
|
|
7
|
+
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { notFound } from 'next/navigation'
|
|
2
|
-
import auth from 'nextjs-cms/auth'
|
|
3
|
-
import { getAdminPrivileges } from 'nextjs-cms/api/helpers'
|
|
4
|
-
import { findPluginRouteByPath } from 'nextjs-cms/plugins/server'
|
|
5
|
-
import { getPluginServerComponent } from './plugin-server-registry'
|
|
6
|
-
|
|
7
|
-
export const dynamic = 'force-dynamic'
|
|
8
|
-
type Params = Promise<{ slug?: string[] }>
|
|
9
|
-
|
|
10
|
-
export default async function Page(props: { params: Params }) {
|
|
11
|
-
const params = await props.params
|
|
12
|
-
const slug = params.slug ?? []
|
|
13
|
-
|
|
14
|
-
const path = `/${slug.join('/')}`
|
|
15
|
-
const session = await auth()
|
|
16
|
-
if (!session?.user) {
|
|
17
|
-
notFound()
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const plugin = await findPluginRouteByPath(path)
|
|
21
|
-
if (!plugin) {
|
|
22
|
-
notFound()
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const privilegeSet = await getAdminPrivileges(session.user.id)
|
|
26
|
-
if (!privilegeSet.has(plugin.pluginName)) {
|
|
27
|
-
notFound()
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const PluginComponent = await getPluginServerComponent(plugin.
|
|
31
|
-
if (!PluginComponent) {
|
|
32
|
-
notFound()
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return <PluginComponent />
|
|
36
|
-
}
|
|
1
|
+
import { notFound } from 'next/navigation'
|
|
2
|
+
import auth from 'nextjs-cms/auth'
|
|
3
|
+
import { getAdminPrivileges } from 'nextjs-cms/api/helpers'
|
|
4
|
+
import { findPluginRouteByPath } from 'nextjs-cms/plugins/server'
|
|
5
|
+
import { getPluginServerComponent } from './plugin-server-registry'
|
|
6
|
+
|
|
7
|
+
export const dynamic = 'force-dynamic'
|
|
8
|
+
type Params = Promise<{ slug?: string[] }>
|
|
9
|
+
|
|
10
|
+
export default async function Page(props: { params: Params }) {
|
|
11
|
+
const params = await props.params
|
|
12
|
+
const slug = params.slug ?? []
|
|
13
|
+
|
|
14
|
+
const path = `/${slug.join('/')}`
|
|
15
|
+
const session = await auth()
|
|
16
|
+
if (!session?.user) {
|
|
17
|
+
notFound()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const plugin = await findPluginRouteByPath(path)
|
|
21
|
+
if (!plugin) {
|
|
22
|
+
notFound()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const privilegeSet = await getAdminPrivileges(session.user.id)
|
|
26
|
+
if (!privilegeSet.has(plugin.pluginName)) {
|
|
27
|
+
notFound()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const PluginComponent = await getPluginServerComponent(plugin.pluginRegistryName, plugin.component)
|
|
31
|
+
if (!PluginComponent) {
|
|
32
|
+
notFound()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return <PluginComponent />
|
|
36
|
+
}
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return resolved
|
|
25
|
-
}
|
|
1
|
+
import dynamic from 'next/dynamic'
|
|
2
|
+
import { _pluginNamesMap } from './.plugin-registry.mjs'
|
|
3
|
+
|
|
4
|
+
export const pluginNamesMap: Record<string, string> = {
|
|
5
|
+
..._pluginNamesMap,
|
|
6
|
+
// A workaround to avoid importing error if no plugins are installed
|
|
7
|
+
blank: 'nextjs-cms/plugins/blank-component',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const getPluginServerComponent = async (registryName: string, componentName: string | undefined) => {
|
|
11
|
+
const pluginName = pluginNamesMap[registryName]
|
|
12
|
+
const ClientComponent = dynamic(
|
|
13
|
+
() =>
|
|
14
|
+
import(pluginName ?? 'nextjs-cms/plugins/blank-component').then((mod) =>
|
|
15
|
+
componentName ? mod[componentName] : mod.default,
|
|
16
|
+
),
|
|
17
|
+
{ ssr: true },
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
return ClientComponent
|
|
21
|
+
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
export const dynamic = 'force-dynamic'
|
|
2
|
-
|
|
3
|
-
export default function DashboardPage() {
|
|
4
|
-
return (
|
|
5
|
-
<div className='w-full'>
|
|
6
|
-
<div className='bg-linear-to-r from-amber-200 via-orange-200 to-rose-200 p-8 text-foreground dark:from-amber-900 dark:via-orange-900 dark:to-rose-900'>
|
|
7
|
-
<h1 className='text-3xl font-extrabold tracking-tight'>Welcome to Mission Control</h1>
|
|
8
|
-
<p className='mt-2 text-base text-muted-foreground'>
|
|
9
|
-
Your CMS is ready. Chart a course, publish boldly, and keep the lights green.
|
|
10
|
-
</p>
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
<div className='space-y-6 p-6'>
|
|
14
|
-
<section className='rounded-lg border bg-card p-6 text-card-foreground shadow-sm'>
|
|
15
|
-
<h2 className='text-xl font-semibold'>Today's focus</h2>
|
|
16
|
-
<p className='mt-2 text-sm text-muted-foreground'>
|
|
17
|
-
Start with one small win: verify a section, ship a quick update, or polish a headline.
|
|
18
|
-
</p>
|
|
19
|
-
</section>
|
|
20
|
-
|
|
21
|
-
<section className='grid gap-4 md:grid-cols-3'>
|
|
22
|
-
<div className='rounded-lg border bg-card p-4 text-card-foreground shadow-sm'>
|
|
23
|
-
<div className='text-sm font-semibold'>Ship with confidence</div>
|
|
24
|
-
<div className='mt-2 text-sm text-muted-foreground'>
|
|
25
|
-
Keep changes tight and reversible. Small releases, fast feedback.
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
<div className='rounded-lg border bg-card p-4 text-card-foreground shadow-sm'>
|
|
29
|
-
<div className='text-sm font-semibold'>Stay organized</div>
|
|
30
|
-
<div className='mt-2 text-sm text-muted-foreground'>
|
|
31
|
-
Group your content by intent, not just by type.
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
<div className='rounded-lg border bg-card p-4 text-card-foreground shadow-sm'>
|
|
35
|
-
<div className='text-sm font-semibold'>Delight users</div>
|
|
36
|
-
<div className='mt-2 text-sm text-muted-foreground'>
|
|
37
|
-
A clean headline and a single strong image can do the heavy lifting.
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
</section>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
)
|
|
44
|
-
}
|
|
1
|
+
export const dynamic = 'force-dynamic'
|
|
2
|
+
|
|
3
|
+
export default function DashboardPage() {
|
|
4
|
+
return (
|
|
5
|
+
<div className='w-full'>
|
|
6
|
+
<div className='bg-linear-to-r from-amber-200 via-orange-200 to-rose-200 p-8 text-foreground dark:from-amber-900 dark:via-orange-900 dark:to-rose-900'>
|
|
7
|
+
<h1 className='text-3xl font-extrabold tracking-tight'>Welcome to Mission Control</h1>
|
|
8
|
+
<p className='mt-2 text-base text-muted-foreground'>
|
|
9
|
+
Your CMS is ready. Chart a course, publish boldly, and keep the lights green.
|
|
10
|
+
</p>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<div className='space-y-6 p-6'>
|
|
14
|
+
<section className='rounded-lg border bg-card p-6 text-card-foreground shadow-sm'>
|
|
15
|
+
<h2 className='text-xl font-semibold'>Today's focus</h2>
|
|
16
|
+
<p className='mt-2 text-sm text-muted-foreground'>
|
|
17
|
+
Start with one small win: verify a section, ship a quick update, or polish a headline.
|
|
18
|
+
</p>
|
|
19
|
+
</section>
|
|
20
|
+
|
|
21
|
+
<section className='grid gap-4 md:grid-cols-3'>
|
|
22
|
+
<div className='rounded-lg border bg-card p-4 text-card-foreground shadow-sm'>
|
|
23
|
+
<div className='text-sm font-semibold'>Ship with confidence</div>
|
|
24
|
+
<div className='mt-2 text-sm text-muted-foreground'>
|
|
25
|
+
Keep changes tight and reversible. Small releases, fast feedback.
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
<div className='rounded-lg border bg-card p-4 text-card-foreground shadow-sm'>
|
|
29
|
+
<div className='text-sm font-semibold'>Stay organized</div>
|
|
30
|
+
<div className='mt-2 text-sm text-muted-foreground'>
|
|
31
|
+
Group your content by intent, not just by type.
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
<div className='rounded-lg border bg-card p-4 text-card-foreground shadow-sm'>
|
|
35
|
+
<div className='text-sm font-semibold'>Delight users</div>
|
|
36
|
+
<div className='mt-2 text-sm text-muted-foreground'>
|
|
37
|
+
A clean headline and a single strong image can do the heavy lifting.
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</section>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
export { trpc } from 'nextjs-cms/api/trpc/client'
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
export { trpc } from 'nextjs-cms/api/trpc/client'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fetchRequestHandler } from '@trpc/server/adapters/fetch'
|
|
2
|
-
import { createTRPCContext, getAppRouter } from 'nextjs-cms/api'
|
|
2
|
+
import { createTRPCContext, getAppRouter } from 'nextjs-cms/api'
|
|
3
3
|
import { NextRequest } from 'next/server'
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -13,11 +13,11 @@ const context = async (req: NextRequest) => {
|
|
|
13
13
|
})
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const handler = async (req: NextRequest) =>
|
|
16
|
+
const handler = async (req: NextRequest) =>
|
|
17
17
|
fetchRequestHandler({
|
|
18
18
|
endpoint: '/api/trpc',
|
|
19
19
|
req,
|
|
20
|
-
router: await getAppRouter(),
|
|
20
|
+
router: await getAppRouter(),
|
|
21
21
|
createContext: () => context(req),
|
|
22
22
|
/*onError(opts) {
|
|
23
23
|
return opts.error
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"nanoid": "^5.1.2",
|
|
65
65
|
"next": "16.1.1",
|
|
66
66
|
"next-themes": "^0.4.6",
|
|
67
|
-
"nextjs-cms": "0.5.
|
|
67
|
+
"nextjs-cms": "0.5.70",
|
|
68
68
|
"plaiceholder": "^3.0.0",
|
|
69
69
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
70
70
|
"qrcode": "^1.5.4",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"eslint-config-prettier": "^10.0.1",
|
|
98
98
|
"eslint-plugin-prettier": "^5.2.3",
|
|
99
99
|
"fs-extra": "^11.3.3",
|
|
100
|
-
"nextjs-cms-kit": "0.5.
|
|
100
|
+
"nextjs-cms-kit": "0.5.70",
|
|
101
101
|
"postcss": "^8.5.1",
|
|
102
102
|
"prettier": "3.5.0",
|
|
103
103
|
"raw-loader": "^4.0.2",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { redirect } from 'next/navigation'
|
|
2
|
-
import { getPluginRoutes } from 'nextjs-cms/plugins/server'
|
|
3
|
-
|
|
4
|
-
export const dynamic = 'force-dynamic'
|
|
5
|
-
|
|
6
|
-
export default async function Home() {
|
|
7
|
-
const routes = await getPluginRoutes()
|
|
8
|
-
const target = routes[0]?.path ?? '/admins'
|
|
9
|
-
redirect(target)
|
|
10
|
-
}
|