fix: syntax issues

This commit is contained in:
2026-06-17 23:16:46 +05:30
parent 91fc2525b2
commit 90fb9922ac
11 changed files with 6889 additions and 39 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
+6720
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -21,7 +21,7 @@
"@payloadcms/richtext-lexical": "3.36.0",
"cross-env": "7.0.3",
"graphql": "16.10.0",
"next": "15.1.4",
"next": "15.2.3",
"payload": "3.36.0",
"react": "19.0.0",
"react-dom": "19.0.0",
+1 -3
View File
@@ -1,3 +1 @@
{
"importMap": {}
}
export const importMap = {};
@@ -4,7 +4,7 @@ import config from '@payload-config';
import '@payloadcms/next/css';
import type { ServerFunctionClient } from 'payload';
import { handleServerFunctions, RootLayout } from '@payloadcms/next/layouts';
import { importMap } from '../../../admin/importMap';
import { importMap } from '../../../../admin/importMap';
type Args = { children: React.ReactNode };
@@ -3,7 +3,7 @@
import type { Metadata } from 'next';
import config from '@payload-config';
import { generatePageMetadata, RootPage } from '@payloadcms/next/views';
import { importMap } from '../../admin/importMap';
import { importMap } from '../../../../admin/importMap';
type Args = {
params: Promise<{ segments: string[] }>;
+1 -1
View File
@@ -4,7 +4,7 @@ import config from '@payload-config';
import '@payloadcms/next/css';
import type { ServerFunctionClient } from 'payload';
import { handleServerFunctions, RootLayout } from '@payloadcms/next/layouts';
import { importMap } from './admin/importMap';
import { importMap } from '../admin/importMap';
import './custom.scss';
type Args = {
+19
View File
@@ -0,0 +1,19 @@
import type { CollectionConfig } from 'payload';
import { revalidateAstro } from '../hooks/revalidateAstro';
/**
* Returns a new collection config that appends the Astro revalidation hook
* to `hooks.afterChange` without mutating the original module-level config.
*/
export function withRevalidate<T extends CollectionConfig>(config: T): T {
const existing = (config.hooks?.afterChange ?? []) as NonNullable<
NonNullable<CollectionConfig['hooks']>['afterChange']
>;
return {
...config,
hooks: {
...config.hooks,
afterChange: [...existing, revalidateAstro],
},
};
}
+14 -4
View File
@@ -13,7 +13,7 @@ import { Tags } from './collections/Tags';
import { Editions } from './collections/Editions';
import { Subscribers } from './collections/Subscribers';
import { revalidateAstro } from './hooks/revalidateAstro';
import { withRevalidate } from './lib/withRevalidate';
const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);
@@ -23,6 +23,13 @@ const corsOrigins = (process.env.CORS_ORIGINS || '')
.map((s) => s.trim())
.filter(Boolean);
// Wrap each publishing collection so a save fires the Astro rebuild webhook.
const articles = withRevalidate(Articles);
const authors = withRevalidate(Authors);
const categories = withRevalidate(Categories);
const tags = withRevalidate(Tags);
const editions = withRevalidate(Editions);
export default buildConfig({
serverURL: process.env.SERVER_URL,
cors: corsOrigins,
@@ -34,7 +41,7 @@ export default buildConfig({
titleSuffix: ' · SoftVowels CMS',
},
},
collections: [Users, Media, Articles, Authors, Categories, Tags, Editions, Subscribers],
collections: [Users, Media, articles, authors, categories, tags, editions, Subscribers],
editor: lexicalEditor(),
secret: process.env.PAYLOAD_SECRET || 'dev-secret-change-me',
typescript: {
@@ -45,7 +52,6 @@ export default buildConfig({
connectionString: process.env.DATABASE_URI || '',
},
}),
sharp: (sharp) => sharp,
upload: {
limits: {
fileSize: 25_000_000,
@@ -53,6 +59,10 @@ export default buildConfig({
},
endpoints: [],
hooks: {
afterChange: [revalidateAstro],
afterError: [
async (err) => {
console.error('[payload] afterError', err.error);
},
],
},
});
+30 -6
View File
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "ES2022",
"lib": ["DOM", "DOM.Iterable", "ES2022"],
"lib": [
"DOM",
"DOM.Iterable",
"ES2022"
],
"module": "ESNext",
"moduleResolution": "Bundler",
"jsx": "preserve",
@@ -16,10 +20,30 @@
"noEmit": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
"@payload-config": ["./src/payload.config.ts"]
}
"@/*": [
"./src/*"
],
"@payload-config": [
"./src/payload.config.ts"
]
},
"plugins": [
{
"name": "next"
}
]
},
"include": ["src/**/*", "next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules", "dist", "build", ".next"]
"include": [
"**/*.ts",
"**/*.tsx",
"next-env.d.ts",
"src/**/*",
".next/types/**/*.ts"
],
"exclude": [
"node_modules",
"dist",
"build",
".next"
]
}