Merge claude/project-starter-build: ipal-kit create (project starter)
ipal-kit create <domain> generates a new site from the reference site (bin ipal-kit, /starter entry, gzipped template bundle built at prepublishOnly, starter:gate); exact pins of the plugin's own four dependencies (D15, nodemailer 10.3.1); the single-language / non-pl-default refusal; reference/ @starter:if markers, packageManager, cookieCrawl. Conflicts resolved: - reference/src/instrumentation.ts: the starter's multi-line ipalEnvRules with the @starter:if markers (the doctor's cookieCrawl comment line merged above assertEnv already). - reference/ipal-doctor.json: the doctor's version, keeping the four live-seo silences (until 2026-11-30) — the starter's side was the pre-silence copy. - docs/agent/skills/ipal-reference/resources/api.md: both /starter and /doctor. - docs/CHANGELOG.md: both sides in both hunks; one Unreleased section. - docs/agent/reference-site/INDEX.md: regenerated with pnpm reference:index.
This commit is contained in:
@@ -42,7 +42,18 @@ export default async function LocaleLayout({ children, params }: Props) {
|
||||
{/* NO <head> — Next manages it */}
|
||||
<body className="flex min-h-screen flex-col bg-bg font-body text-fg antialiased">
|
||||
<SiteProviders
|
||||
// @starter:if consentBasic
|
||||
//: analytics={{ consentMode: 'basic' }} // no request to Google before consent (AGENTS.md → Project decisions)
|
||||
// @starter:endif
|
||||
// @starter:if bannerInline
|
||||
//: banner={<CookieBanner controls="switch" equalChoice settings="inline" />}
|
||||
// @starter:endif
|
||||
// @starter:if bannerModal
|
||||
//: banner={<CookieBanner controls="switch" equalChoice settings="modal" />}
|
||||
// @starter:endif
|
||||
// @starter:if bannerDetailed
|
||||
banner={<CookieBanner controls="switch" equalChoice settings="detailed" />}
|
||||
// @starter:endif
|
||||
lightbox
|
||||
logEndpoint="/api/ipal/consent"
|
||||
shell={shell}
|
||||
|
||||
@@ -7,12 +7,18 @@ import { libraryBlocks, type LibraryBlocksOptions } from '@intecion/ipal-kit/blo
|
||||
export const blockOptions = {
|
||||
contact: true,
|
||||
cta: true,
|
||||
// @starter:if collections
|
||||
entryList: {
|
||||
collections: [
|
||||
// @starter:if posts
|
||||
{ label: { en: 'Blog posts', pl: 'Wpisy' }, value: 'posts' },
|
||||
// @starter:endif
|
||||
// @starter:if caseStudies
|
||||
{ label: { en: 'Case studies', pl: 'Realizacje' }, value: 'caseStudies' },
|
||||
// @starter:endif
|
||||
],
|
||||
},
|
||||
// @starter:endif
|
||||
faq: true,
|
||||
featureGrid: true,
|
||||
gallery: true,
|
||||
|
||||
@@ -6,7 +6,11 @@ import type { ContentOption } from '@intecion/ipal-kit'
|
||||
*/
|
||||
export const contentConfig: ContentOption = {
|
||||
collections: [
|
||||
// @starter:if posts
|
||||
{ slug: 'posts', label: 'Blog', perPage: 9 },
|
||||
// @starter:endif
|
||||
// @starter:if caseStudies
|
||||
{ slug: 'caseStudies', label: 'Case studies', perPage: 9 },
|
||||
// @starter:endif
|
||||
],
|
||||
}
|
||||
|
||||
@@ -8,8 +8,20 @@ export function register() {
|
||||
// databaseName: DATABASE_URI must name example-studiopl_dev / example-studiopl_prod (databaseNamesFor).
|
||||
// R2_PUBLIC_URL optional: media are served through the app by default (storage.md, env.md).
|
||||
assertEnv(
|
||||
ipalEnvRules({ cookieCrawl: true, databaseName: { domain: 'example-studio.pl' }, ipHeader: true, storage: process.env.ALLOW_LOCAL_MEDIA !== '1' }).map((rule) =>
|
||||
rule.name === 'R2_PUBLIC_URL' ? { ...rule, required: false } : rule,
|
||||
),
|
||||
ipalEnvRules({
|
||||
// @starter:if crawl
|
||||
cookieCrawl: true, // IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN in production — the shared cookie-crawler service
|
||||
// @starter:endif
|
||||
databaseName: { domain: 'example-studio.pl' },
|
||||
// @starter:if graph
|
||||
//: emailGraph: true, // GRAPH_* — e-mail through Microsoft Graph
|
||||
// @starter:endif
|
||||
ipHeader: true,
|
||||
// @starter:if r2
|
||||
storage: process.env.ALLOW_LOCAL_MEDIA !== '1',
|
||||
// @starter:else
|
||||
//: storage: false, // media on local disk — a Coolify persistent volume (AGENTS.md → Project decisions)
|
||||
// @starter:endif
|
||||
}).map((rule) => (rule.name === 'R2_PUBLIC_URL' ? { ...rule, required: false } : rule)),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
import { faqItemsFromLayout } from '@intecion/ipal-kit/blocks'
|
||||
// @starter:if localBusiness
|
||||
import { buildLocalBusinessJsonLd, createContentHelpers } from '@intecion/ipal-kit'
|
||||
|
||||
import { getPayload } from 'payload'
|
||||
import { contentConfig } from '@/content.config'
|
||||
import { i18nConfig, type Locale } from '@/i18n.config'
|
||||
// @starter:else
|
||||
//: import { createContentHelpers } from '@intecion/ipal-kit'
|
||||
//:
|
||||
//: import { contentConfig } from '@/content.config'
|
||||
//: import { i18nConfig } from '@/i18n.config'
|
||||
// @starter:endif
|
||||
import config from '@/payload.config'
|
||||
|
||||
/** The ONLY access to Payload, routes, links and navigation (AGENT.md §3, PROGRAMISTA §2.7). */
|
||||
@@ -49,6 +56,13 @@ export const {
|
||||
markdownAlternate: true, // GEO: <link rel="alternate" type="text/markdown"> on every page
|
||||
mcp: { serverName: 'example-studio-site' },
|
||||
pageJsonLd: { faq: (doc) => faqItemsFromLayout(doc) }, // FAQ blocks → FAQPage rich results
|
||||
// @starter:if aiBotsBlockTraining
|
||||
//: robots: { aiBots: 'block-training' }, // client decision — AGENTS.md → Project decisions (ipal-audit-skip: aibots)
|
||||
// @starter:endif
|
||||
// @starter:if aiBotsDisallow
|
||||
//: robots: { aiBots: 'disallow' }, // client decision — AGENTS.md → Project decisions (ipal-audit-skip: aibots)
|
||||
// @starter:endif
|
||||
// @starter:if localBusiness
|
||||
// LocalBusiness from the Company global (replaces the default WebSite + Organization from Site settings)
|
||||
siteJsonLd: async ({ baseUrl, locale }) => {
|
||||
const payload = await getPayload({ config })
|
||||
@@ -65,5 +79,6 @@ export const {
|
||||
}),
|
||||
]
|
||||
},
|
||||
// @starter:endif
|
||||
summaryField: 'aiSummary',
|
||||
})
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// @starter:if twoFactor
|
||||
import { payloadTotp } from '@clocklimited/payload-2fa'
|
||||
// @starter:endif
|
||||
import { buildR2Storage, ipalKit, mailAdapter } from '@intecion/ipal-kit'
|
||||
import { lexicalEditor } from '@payloadcms/richtext-lexical'
|
||||
import { s3Storage } from '@payloadcms/storage-s3'
|
||||
@@ -8,10 +10,14 @@ import { buildConfig } from 'payload'
|
||||
import sharp from 'sharp'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
// @starter:if caseStudies
|
||||
import { CaseStudies } from './collections/CaseStudies'
|
||||
// @starter:endif
|
||||
import { Media } from './collections/Media'
|
||||
import { Pages } from './collections/Pages'
|
||||
// @starter:if posts
|
||||
import { Posts } from './collections/Posts'
|
||||
// @starter:endif
|
||||
import { contentConfig } from './content.config'
|
||||
import { db } from './db'
|
||||
import { Company } from './globals/Company'
|
||||
@@ -28,7 +34,17 @@ export default buildConfig({
|
||||
},
|
||||
// absolute URLs in form e-mails (logo, links)
|
||||
serverURL: process.env.NEXT_PUBLIC_SERVER_URL,
|
||||
collections: [Pages, Posts, CaseStudies, Media], // ipalKit injects `users` (roles + 2FA)
|
||||
// ipalKit injects `users` (roles + 2FA)
|
||||
collections: [
|
||||
Pages,
|
||||
// @starter:if posts
|
||||
Posts,
|
||||
// @starter:endif
|
||||
// @starter:if caseStudies
|
||||
CaseStudies,
|
||||
// @starter:endif
|
||||
Media,
|
||||
],
|
||||
globals: [Header, Footer, Company],
|
||||
db,
|
||||
editor: lexicalEditor(),
|
||||
@@ -42,14 +58,44 @@ export default buildConfig({
|
||||
access: { authCollection: 'users' },
|
||||
pages: { slug: 'pages' },
|
||||
content: contentConfig,
|
||||
seo: { collections: ['pages', 'posts', 'caseStudies'] },
|
||||
seo: {
|
||||
collections: [
|
||||
'pages',
|
||||
// @starter:if posts
|
||||
'posts',
|
||||
// @starter:endif
|
||||
// @starter:if caseStudies
|
||||
'caseStudies',
|
||||
// @starter:endif
|
||||
],
|
||||
},
|
||||
forms: { redirectRelationships: ['pages'], emailLayout: true },
|
||||
// @starter:if twoFactor
|
||||
twoFactor: { issuer: 'Example Studio', plugin: payloadTotp },
|
||||
// @starter:else
|
||||
//: twoFactor: false, // turned off by the owner — AGENTS.md → Project decisions, ipal-doctor.json
|
||||
// @starter:endif
|
||||
// @starter:if whiteLabel
|
||||
whiteLabel: true,
|
||||
// @starter:endif
|
||||
// @starter:if !adminMeta
|
||||
//: adminMeta: false, // turned off by the owner — AGENTS.md → Project decisions
|
||||
// @starter:endif
|
||||
// @starter:if agencyNone
|
||||
//: agency: false, // no agency credit (owner's choice)
|
||||
// @starter:endif
|
||||
// @starter:if agencyCustom
|
||||
//: agency: { name: 'Example Agency', url: 'https://agency.example' },
|
||||
// @starter:endif
|
||||
indexNow: true,
|
||||
consentLog: true,
|
||||
// Privacy → Cookie review: scan + approval; crawl needs IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN
|
||||
// @starter:if crawl
|
||||
cookieScanner: { crawl: true },
|
||||
// @starter:endif
|
||||
// @starter:if scannerWithoutCrawl
|
||||
//: cookieScanner: true,
|
||||
// @starter:endif
|
||||
lightbox: true,
|
||||
revalidatePath,
|
||||
}),
|
||||
|
||||
@@ -16,11 +16,24 @@ import { pageLink, tx } from './lib'
|
||||
const blocks = libraryBlockSlugs(blockOptions)
|
||||
|
||||
export async function seedBaseGlobals(seed: Seeder) {
|
||||
await seed.fillGlobal('company', { email: '[TO FILL: e-mail that receives form submissions]', name: '[TO FILL: company name]' })
|
||||
// the inbox and the name come from the starter's answers (AGENTS.md → Project decisions)
|
||||
await seed.fillGlobal('company', { email: '[email protected]', name: 'Example Studio' })
|
||||
await seed.fillGlobal('site-settings', {
|
||||
// @starter:if themeToggle
|
||||
allowThemeToggle: true,
|
||||
// @starter:else
|
||||
//: allowThemeToggle: false,
|
||||
// @starter:endif
|
||||
// @starter:if defaultLight
|
||||
//: defaultTheme: 'light',
|
||||
// @starter:endif
|
||||
// @starter:if defaultDark
|
||||
//: defaultTheme: 'dark',
|
||||
// @starter:endif
|
||||
// @starter:if defaultSystem
|
||||
defaultTheme: 'system',
|
||||
siteName: '[TO FILL: site name]',
|
||||
// @starter:endif
|
||||
siteName: 'Example Studio',
|
||||
themeToggleLabel: tx('Tryb ciemny', 'Dark mode'),
|
||||
})
|
||||
}
|
||||
@@ -32,7 +45,9 @@ export async function seedBasePages(seed: Seeder) {
|
||||
pageTemplates.services({ blocks }),
|
||||
pageTemplates.contact({ blocks, form: { $form: 'Contact form' } }),
|
||||
// The archive page lists its entries with an entry list block (the editor decides where)
|
||||
// @starter:if posts
|
||||
pageTemplates.blogIndex({ blocks, layout: (b) => [b[0], { blockType: 'entryList', entryCollection: 'posts', limit: 9, mode: 'latest', variant: 'cards' }, ...b.slice(1)] }),
|
||||
// @starter:endif
|
||||
pageTemplates.legal('privacyPolicy', { blocks }),
|
||||
pageTemplates.legal('termsOfService', { blocks }),
|
||||
pageTemplates.cookiePolicy({ blocks }),
|
||||
@@ -44,15 +59,35 @@ export async function seedBaseNavigation(seed: Seeder) {
|
||||
const link = (label: { en: string; pl: string }, slug: string) => ({ link: { label, page: { $page: slug }, type: 'internal' } })
|
||||
await seed.fillGlobal('site-settings', {
|
||||
...systemPageRefs({ cookiePolicy: 'polityka-cookies', homepage: 'start', notFound: 'nie-znaleziono', privacyPolicy: 'polityka-prywatnosci', termsOfService: 'regulamin' }),
|
||||
// @starter:if posts
|
||||
postsArchive: { $page: 'blog' },
|
||||
// @starter:endif
|
||||
})
|
||||
await seed.fillGlobal('header', {
|
||||
links: [pageLink(tx('Kontakt', 'Contact'), 'kontakt')],
|
||||
menuLabel: tx('Menu', 'Menu'),
|
||||
navItems: [link(tx('O nas', 'About'), 'o-nas'), link(tx('Usługi', 'Services'), 'uslugi'), link(tx('Blog', 'Blog'), 'blog'), link(tx('Kontakt', 'Contact'), 'kontakt')],
|
||||
navItems: [
|
||||
link(tx('O nas', 'About'), 'o-nas'),
|
||||
link(tx('Usługi', 'Services'), 'uslugi'),
|
||||
// @starter:if posts
|
||||
link(tx('Blog', 'Blog'), 'blog'),
|
||||
// @starter:endif
|
||||
link(tx('Kontakt', 'Contact'), 'kontakt'),
|
||||
],
|
||||
})
|
||||
await seed.fillGlobal('footer', {
|
||||
columns: [{ heading: tx('Strona', 'Site'), items: [link(tx('O nas', 'About'), 'o-nas'), link(tx('Usługi', 'Services'), 'uslugi'), link(tx('Blog', 'Blog'), 'blog')] }],
|
||||
columns: [
|
||||
{
|
||||
heading: tx('Strona', 'Site'),
|
||||
items: [
|
||||
link(tx('O nas', 'About'), 'o-nas'),
|
||||
link(tx('Usługi', 'Services'), 'uslugi'),
|
||||
// @starter:if posts
|
||||
link(tx('Blog', 'Blog'), 'blog'),
|
||||
// @starter:endif
|
||||
],
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
/**
|
||||
* Seeds of the reference site — rules: node_modules/@intecion/ipal-kit/docs/seeding.md.
|
||||
*
|
||||
* pnpm seed # everything: demo layer first (filled pages win), then the base layer
|
||||
* pnpm seed:base # only what every new site keeps (the project starter runs this one)
|
||||
* pnpm seed:demo # only the made-up company's content (needs the base forms)
|
||||
* pnpm seed # the reference site: demo layer first (filled pages win), then the base layer;
|
||||
* # a site made by `ipal-kit create`: the base layer only
|
||||
* pnpm seed:base # only what every new site keeps
|
||||
* pnpm seed:demo # reference site only: the made-up company's content (needs the base forms)
|
||||
* SEED_DRY_RUN=1 pnpm seed # print the plan, write nothing
|
||||
*
|
||||
* VERY IMPORTANT — after launch: never the whole seed again. Name the records the run may touch:
|
||||
@@ -16,34 +17,50 @@ import { createSeeder } from '@intecion/ipal-kit/seed'
|
||||
import { getPayload } from 'payload'
|
||||
|
||||
import { seedBaseGlobals, seedBaseNavigation, seedBasePages, seedBaseTexts } from './base'
|
||||
// @starter:if demo
|
||||
import { DEMO_NOTIFY_EMAIL, seedDemoGlobals, seedDemoNavigation, seedDemoPages } from './demo'
|
||||
// @starter:endif
|
||||
import { seedForms } from './forms'
|
||||
// @starter:if demo
|
||||
import { seedMedia } from './media'
|
||||
// @starter:endif
|
||||
|
||||
// @starter:if demo
|
||||
const layer = process.env.SEED_LAYER ?? 'all'
|
||||
const withDemo = layer === 'all' || layer === 'demo'
|
||||
const withBase = layer === 'all' || layer === 'base'
|
||||
// @starter:else
|
||||
//: const withBase = true // a new site has only the base layer (the reference site's demo is not copied)
|
||||
// @starter:endif
|
||||
|
||||
const payload = await getPayload({ config })
|
||||
const seed = createSeeder(payload)
|
||||
|
||||
// @starter:if demo
|
||||
const media = withDemo ? await seedMedia(payload) : {}
|
||||
if (withDemo) {await seedDemoGlobals(seed, media)}
|
||||
// @starter:endif
|
||||
if (withBase) {await seedBaseGlobals(seed)}
|
||||
|
||||
// Forms need the inbox that receives submissions: SEED_NOTIFY_EMAIL, else the Company global — never a guess.
|
||||
const company = (await payload.findGlobal({ slug: 'company' })) as { email?: null | string }
|
||||
// @starter:if demo
|
||||
const notifyTo = process.env.SEED_NOTIFY_EMAIL?.trim() || (withDemo ? DEMO_NOTIFY_EMAIL : company.email?.trim()) || ''
|
||||
// @starter:else
|
||||
//: const notifyTo = process.env.SEED_NOTIFY_EMAIL?.trim() || company.email?.trim() || ''
|
||||
// @starter:endif
|
||||
if (/^[^\s@,;]+@[^\s@,;]+\.[^\s@,;]+$/.test(notifyTo)) {
|
||||
await seedForms(seed, notifyTo)
|
||||
} else {
|
||||
console.error('[seed] Forms skipped: fill Company → E-mail in the panel or run with SEED_NOTIFY_EMAIL=… (ask the client which inbox).')
|
||||
}
|
||||
|
||||
// @starter:if demo
|
||||
if (withDemo) {
|
||||
await seedDemoPages(seed, media)
|
||||
await seedDemoNavigation(seed)
|
||||
}
|
||||
// @starter:endif
|
||||
if (withBase) {
|
||||
await seedBasePages(seed)
|
||||
await seedBaseNavigation(seed)
|
||||
|
||||
Reference in New Issue
Block a user