feat: Next 16 + Payload 3 scaffold with Kaniko CI and Swarm deploy (#1)
Some checks failed
ci/woodpecker/push/web Pipeline failed
Some checks failed
ci/woodpecker/push/web Pipeline failed
Co-authored-by: Jason Woltje <jason@diversecanvas.com> Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #1.
This commit is contained in:
18
src/app/(payload)/admin/[[...segments]]/not-found.tsx
Normal file
18
src/app/(payload)/admin/[[...segments]]/not-found.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import type { Metadata } from "next";
|
||||
import config from "@payload-config";
|
||||
import { NotFoundPage, generatePageMetadata } from "@payloadcms/next/views";
|
||||
import { importMap } from "../importMap";
|
||||
|
||||
type Args = {
|
||||
params: Promise<{ [key: string]: string | string[] | undefined }>;
|
||||
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
|
||||
};
|
||||
|
||||
export const generateMetadata = ({ params, searchParams }: Args): Promise<Metadata> =>
|
||||
generatePageMetadata({ config, params: params as any, searchParams: searchParams as any });
|
||||
|
||||
const NotFound = ({ params, searchParams }: Args) =>
|
||||
NotFoundPage({ config, params: params as any, searchParams: searchParams as any, importMap });
|
||||
|
||||
export default NotFound;
|
||||
18
src/app/(payload)/admin/[[...segments]]/page.tsx
Normal file
18
src/app/(payload)/admin/[[...segments]]/page.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import type { Metadata } from "next";
|
||||
import config from "@payload-config";
|
||||
import { RootPage, generatePageMetadata } from "@payloadcms/next/views";
|
||||
import { importMap } from "../importMap";
|
||||
|
||||
type Args = {
|
||||
params: Promise<{ [key: string]: string | string[] | undefined }>;
|
||||
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
|
||||
};
|
||||
|
||||
export const generateMetadata = ({ params, searchParams }: Args): Promise<Metadata> =>
|
||||
generatePageMetadata({ config, params: params as any, searchParams: searchParams as any });
|
||||
|
||||
const Page = ({ params, searchParams }: Args) =>
|
||||
RootPage({ config, params: params as any, searchParams: searchParams as any, importMap });
|
||||
|
||||
export default Page;
|
||||
2
src/app/(payload)/admin/importMap.js
Normal file
2
src/app/(payload)/admin/importMap.js
Normal file
@@ -0,0 +1,2 @@
|
||||
// Auto-generated stub. Regenerate with `pnpm generate:importmap` after adding custom components.
|
||||
export const importMap = {};
|
||||
16
src/app/(payload)/api/[...slug]/route.ts
Normal file
16
src/app/(payload)/api/[...slug]/route.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import config from "@payload-config";
|
||||
import {
|
||||
REST_DELETE,
|
||||
REST_GET,
|
||||
REST_OPTIONS,
|
||||
REST_PATCH,
|
||||
REST_POST,
|
||||
REST_PUT,
|
||||
} from "@payloadcms/next/routes";
|
||||
|
||||
export const GET = REST_GET(config);
|
||||
export const POST = REST_POST(config);
|
||||
export const DELETE = REST_DELETE(config);
|
||||
export const PATCH = REST_PATCH(config);
|
||||
export const PUT = REST_PUT(config);
|
||||
export const OPTIONS = REST_OPTIONS(config);
|
||||
4
src/app/(payload)/api/graphql-playground/route.ts
Normal file
4
src/app/(payload)/api/graphql-playground/route.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import config from "@payload-config";
|
||||
import { GRAPHQL_PLAYGROUND_GET } from "@payloadcms/next/routes";
|
||||
|
||||
export const GET = GRAPHQL_PLAYGROUND_GET(config);
|
||||
5
src/app/(payload)/api/graphql/route.ts
Normal file
5
src/app/(payload)/api/graphql/route.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import config from "@payload-config";
|
||||
import { GRAPHQL_POST, REST_OPTIONS } from "@payloadcms/next/routes";
|
||||
|
||||
export const POST = GRAPHQL_POST(config);
|
||||
export const OPTIONS = REST_OPTIONS(config);
|
||||
16
src/app/(payload)/api/health/route.ts
Normal file
16
src/app/(payload)/api/health/route.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export const runtime = "nodejs";
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export function GET() {
|
||||
return NextResponse.json(
|
||||
{
|
||||
status: "ok",
|
||||
buildSha: process.env.NEXT_PUBLIC_BUILD_SHA ?? "dev",
|
||||
buildRev: process.env.NEXT_PUBLIC_BUILD_REV ?? "local",
|
||||
timestamp: new Date().toISOString(),
|
||||
},
|
||||
{ status: 200 },
|
||||
);
|
||||
}
|
||||
1
src/app/(payload)/custom.scss
Normal file
1
src/app/(payload)/custom.scss
Normal file
@@ -0,0 +1 @@
|
||||
/* Payload admin UI customizations. Keep minimal for v0.0.x. */
|
||||
22
src/app/(payload)/layout.tsx
Normal file
22
src/app/(payload)/layout.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
/* Payload admin layout — do not modify unless you understand the Payload 3 requirements. */
|
||||
import type { ServerFunctionClient } from "payload";
|
||||
import config from "@payload-config";
|
||||
import { RootLayout, handleServerFunctions } from "@payloadcms/next/layouts";
|
||||
import "@payloadcms/next/css";
|
||||
import { importMap } from "./admin/importMap";
|
||||
import "./custom.scss";
|
||||
|
||||
type Args = { children: React.ReactNode };
|
||||
|
||||
const serverFunction: ServerFunctionClient = async function (args) {
|
||||
"use server";
|
||||
return handleServerFunctions({ ...args, config, importMap });
|
||||
};
|
||||
|
||||
const Layout = ({ children }: Args) => (
|
||||
<RootLayout config={config} importMap={importMap} serverFunction={serverFunction}>
|
||||
{children}
|
||||
</RootLayout>
|
||||
);
|
||||
|
||||
export default Layout;
|
||||
Reference in New Issue
Block a user