From 30b0db634a6cf576347464cdcbd75b003f2fd46d Mon Sep 17 00:00:00 2001 From: maxitect Date: Thu, 26 Nov 2026 19:00:59 +0000 Subject: [PATCH 1/4] refactor(content): remove the Google Sheet source, importer and CSV parsers --- package.json | 4 - pnpm-lock.yaml | 18 --- src/lib/data/carouselFallback.ts | 2 +- src/lib/data/content.ts | 20 +-- src/lib/data/payload.ts | 18 ++- src/lib/data/sheet.ts | 52 ------- src/scripts/compareSources.ts | 65 --------- src/scripts/importSheet.ts | 238 ------------------------------- src/utils/fetchSheet.ts | 12 -- src/utils/parseCsv.ts | 18 --- src/utils/parsePageCsv.ts | 33 ----- 11 files changed, 24 insertions(+), 456 deletions(-) delete mode 100644 src/lib/data/sheet.ts delete mode 100644 src/scripts/compareSources.ts delete mode 100644 src/scripts/importSheet.ts delete mode 100644 src/utils/fetchSheet.ts delete mode 100644 src/utils/parseCsv.ts delete mode 100644 src/utils/parsePageCsv.ts diff --git a/package.json b/package.json index 0f28cf7..68c6b7f 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,6 @@ "start": "next start", "lint": "eslint", "typecheck": "tsc --noEmit", - "content:import": "NODE_ENV=production payload run src/scripts/importSheet.ts", - "content:compare": "NODE_ENV=production payload run src/scripts/compareSources.ts", "payload": "payload" }, "dependencies": { @@ -26,7 +24,6 @@ "hls.js": "^1.7.4", "next": "16.4.6", "nodemailer": "^10.5.0", - "papaparse": "^5.7.0", "payload": "3.93.0", "react": "^19.3.1", "react-dom": "^19.3.1", @@ -39,7 +36,6 @@ "@tailwindcss/postcss": "^4.3.5", "@types/node": "^26.6.6", "@types/nodemailer": "^8.0.2", - "@types/papaparse": "^5.5.2", "@types/react": "^19.3.0", "@types/react-dom": "^19.3.0", "@types/three": "^0.187.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e43d840..3593980 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -202,9 +202,6 @@ importers: nodemailer: specifier: ^10.5.0 version: 10.5.0 - papaparse: - specifier: ^5.7.0 - version: 5.7.0 payload: specifier: 3.93.0 version: 3.93.0(graphql@16.15.0)(typescript@6.0.3) @@ -236,9 +233,6 @@ importers: '@types/nodemailer': specifier: ^8.0.2 version: 8.0.2 - '@types/papaparse': - specifier: ^5.5.2 - version: 5.5.2 '@types/react': specifier: ^19.3.0 version: 19.3.0 @@ -1558,9 +1552,6 @@ packages: '@types/nodemailer@8.0.2': resolution: {integrity: sha512-c7M5ox8p0nEOfbJ2E9Qcmt8/QCu/VzsiAhzBiZbvky2PhKZDHpKB3sQHBM5MEZNkCfBOaS6S9//AGPRTNB7IaA==} - '@types/papaparse@5.5.2': - resolution: {integrity: sha512-gFnFp/JMzLHCwRf7tQHrNnfhN4eYBVYYI897CGX4MY1tzY9l2aLkVyx2IlKZ/SAqDbB3I1AOZW5gTMGGsqWliA==} - '@types/parse-json@4.0.2': resolution: {integrity: sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==} @@ -3098,9 +3089,6 @@ packages: resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} engines: {node: '>=10'} - papaparse@5.7.0: - resolution: {integrity: sha512-qBGxg/7Q3Kl9Wfhrz2Z74UnvnHTXLNG6jmKJFeBvP2+y4lV7So+7SR62+Zd47JvdrCkX+nDcnr0ObPzek/+6RA==} - parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} @@ -5090,10 +5078,6 @@ snapshots: dependencies: '@types/node': 26.6.6 - '@types/papaparse@5.5.2': - dependencies: - '@types/node': 26.6.6 - '@types/parse-json@4.0.2': {} '@types/pg@8.20.0': @@ -6763,8 +6747,6 @@ snapshots: dependencies: p-limit: 3.1.0 - papaparse@5.7.0: {} - parent-module@1.0.1: dependencies: callsites: 3.1.0 diff --git a/src/lib/data/carouselFallback.ts b/src/lib/data/carouselFallback.ts index a9786ed..6c48430 100644 --- a/src/lib/data/carouselFallback.ts +++ b/src/lib/data/carouselFallback.ts @@ -1,4 +1,4 @@ -import type { CarouselPhoto } from "./sheet"; +import type { CarouselPhoto } from "./payload"; /** Shown until the About page has photos in Payload; delete with public/images/carousel/. */ export const fallbackCarousel: CarouselPhoto[] = [ diff --git a/src/lib/data/content.ts b/src/lib/data/content.ts index f7fb416..548ae58 100644 --- a/src/lib/data/content.ts +++ b/src/lib/data/content.ts @@ -1,22 +1,16 @@ import { cacheLife, cacheTag } from "next/cache"; import { fallbackCarousel } from "./carouselFallback"; import * as payloadSource from "./payload"; -import * as sheetSource from "./sheet"; -export type { BilingualPage, CarouselPhoto } from "./sheet"; - -// Production reads the sheet until DATABASE_URL is set there (switchover step 4). -const source = process.env.DATABASE_URL ? payloadSource : sheetSource; +export type { BilingualPage, CarouselPhoto } from "./payload"; export async function getAboutPage() { "use cache"; cacheLife("minutes"); cacheTag("about"); - const carousel = process.env.DATABASE_URL - ? await payloadSource.getCarousel() - : []; + const carousel = await payloadSource.getCarousel(); return { - ...(await source.getAboutPage()), + ...(await payloadSource.getAboutPage()), carousel: carousel.length ? carousel : fallbackCarousel, }; } @@ -25,26 +19,26 @@ export async function getTourPage() { "use cache"; cacheLife("minutes"); cacheTag("tour"); - return source.getTourPage(); + return payloadSource.getTourPage(); } export async function getTourDates() { "use cache"; cacheLife("minutes"); cacheTag("tour-dates"); - return source.getTourDates(); + return payloadSource.getTourDates(); } export async function getMusicItems() { "use cache"; cacheLife("minutes"); cacheTag("music"); - return source.getMusicItems(); + return payloadSource.getMusicItems(); } export async function getLyrics() { "use cache"; cacheLife("minutes"); cacheTag("lyrics"); - return source.getLyrics(); + return payloadSource.getLyrics(); } diff --git a/src/lib/data/payload.ts b/src/lib/data/payload.ts index 13794c9..99385ad 100644 --- a/src/lib/data/payload.ts +++ b/src/lib/data/payload.ts @@ -1,7 +1,21 @@ import { getPayload } from "payload"; import config from "../../payload.config"; -import type { IFrameProps, LyricsProps, TourDateType } from "../../utils/types"; -import type { BilingualPage, CarouselPhoto } from "./sheet"; +import type { + IFrameProps, + LyricsProps, + Page, + TourDateType, +} from "../../utils/types"; + +export interface BilingualPage { + french: Page; + english: Page; +} + +export interface CarouselPhoto { + src: string; + alt: { english: string; french: string }; +} const locales = ["en", "fr"] as const; const read = { depth: 0, fallbackLocale: "en", limit: 0, pagination: false } as const; diff --git a/src/lib/data/sheet.ts b/src/lib/data/sheet.ts deleted file mode 100644 index 271ea91..0000000 --- a/src/lib/data/sheet.ts +++ /dev/null @@ -1,52 +0,0 @@ -import fetchSheet from "../../utils/fetchSheet"; -import parseCsv from "../../utils/parseCsv"; -import parsePageCsv from "../../utils/parsePageCsv"; -import { - IFrameProps, - LyricsProps, - Page, - TourDateType, -} from "../../utils/types"; - -export interface BilingualPage { - french: Page; - english: Page; -} - -export interface CarouselPhoto { - src: string; - alt: { english: string; french: string }; -} - -async function getPage(tabGid: number): Promise { - const [french, english] = parsePageCsv(await fetchSheet(tabGid)); - if (!french || !english) { - throw new Error(`Sheet tab ${tabGid} is missing a language column`); - } - return { french, english }; -} - -export const getAboutPage = () => getPage(0); - -export const getTourPage = () => getPage(127405583); - -export async function getTourDates(): Promise { - return parseCsv( - await fetchSheet(572869052), - (row) => !!row.eventDate - ); -} - -export async function getMusicItems(): Promise { - return parseCsv( - await fetchSheet(1713768433), - (row) => !!row.title && !!row.type - ); -} - -export async function getLyrics(): Promise { - return parseCsv( - await fetchSheet(145198726), - (row) => !!row.title && !!row.lyrics - ); -} diff --git a/src/scripts/compareSources.ts b/src/scripts/compareSources.ts deleted file mode 100644 index 369a33b..0000000 --- a/src/scripts/compareSources.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { isDeepStrictEqual } from "node:util"; -import * as payloadSource from "../lib/data/payload"; -import * as sheetSource from "../lib/data/sheet"; -import type { LyricsProps, TourDateType } from "../utils/types"; - -const normalise = { - tourDates: (dates: TourDateType[]) => - dates.map((date) => { - const [day, month, year] = date.eventDate.split("/").map(Number); - return { - eventDate: `${year}-${month}-${day}`, - location: date.location.trim(), - venue: date.venue, - locationUrl: date.locationUrl || "", - ticketUrl: date.ticketUrl || "", - }; - }), - withEmpty: (items: T[]) => - items.map((item) => - Object.fromEntries( - Object.entries(item).map(([key, value]) => [key, value ?? ""]) - ) - ), - lyrics: (songs: LyricsProps[]) => - normalise.withEmpty( - songs.map((song) => ({ ...song, paroles: song.paroles || song.lyrics })) - ), -}; - -const comparisons = [ - ["about page", () => sheetSource.getAboutPage(), () => payloadSource.getAboutPage()], - ["tour page", () => sheetSource.getTourPage(), () => payloadSource.getTourPage()], - [ - "tour dates", - async () => normalise.tourDates(await sheetSource.getTourDates()), - async () => normalise.tourDates(await payloadSource.getTourDates()), - ], - [ - "music items", - async () => normalise.withEmpty(await sheetSource.getMusicItems()), - async () => normalise.withEmpty(await payloadSource.getMusicItems()), - ], - [ - "lyrics", - async () => normalise.lyrics(await sheetSource.getLyrics()), - async () => normalise.lyrics(await payloadSource.getLyrics()), - ], -] as const; - -let differences = 0; -for (const [name, fromSheet, fromPayload] of comparisons) { - const [sheet, payload] = await Promise.all([fromSheet(), fromPayload()]); - if (isDeepStrictEqual(sheet, payload)) { - const count = Array.isArray(sheet) ? ` (${sheet.length})` : ""; - console.log(`SAME ${name}${count}`); - continue; - } - differences++; - console.log(`DIFF ${name}`); - console.log(" sheet: ", JSON.stringify(sheet).slice(0, 600)); - console.log(" payload:", JSON.stringify(payload).slice(0, 600)); -} - -console.log(differences === 0 ? "No difference." : `${differences} differ.`); -process.exit(differences === 0 ? 0 : 1); diff --git a/src/scripts/importSheet.ts b/src/scripts/importSheet.ts deleted file mode 100644 index 5d0e177..0000000 --- a/src/scripts/importSheet.ts +++ /dev/null @@ -1,238 +0,0 @@ -import { getPayload } from "payload"; -import path from "path"; -import Papa from "papaparse"; -import config from "../payload.config"; -import { fallbackCarousel } from "../lib/data/carouselFallback"; -import fetchSheet from "../utils/fetchSheet"; -import parsePageCsv from "../utils/parsePageCsv"; -import type { IFrameProps, LyricsProps, TourDateType } from "../utils/types"; - -const context = { skipRevalidate: true }; -const payload = await getPayload({ config }); - -const parseRows = (csv: string): T[] => - Papa.parse(csv, { header: true, skipEmptyLines: true }).data; - -function toIsoDate(eventDate: string): string { - const [day, month, year] = eventDate.split("/").map(Number); - return new Date(Date.UTC(year, month - 1, day, 12)).toISOString(); -} - -const tally = (counts: Record, id?: number) => { - const key = id ? "updated" : "created"; - counts[key] = (counts[key] ?? 0) + 1; -}; - -async function importPages() { - const tabs = [ - { slug: "about-page", gid: 0 }, - { slug: "tour-page", gid: 127405583 }, - ] as const; - for (const { slug, gid } of tabs) { - const [french, english] = parsePageCsv(await fetchSheet(gid)); - for (const [locale, page] of [ - ["en", english], - ["fr", french], - ] as const) { - await payload.updateGlobal({ slug, data: page, locale, context }); - } - console.log(`${slug}: updated`); - } -} - -async function importCarousel() { - const about = await payload.findGlobal({ slug: "about-page", depth: 0 }); - if (about.carousel?.length) { - console.log(`carousel: ${about.carousel.length} photos already there, skipped`); - return; - } - const photos: number[] = []; - for (const { src, alt } of fallbackCarousel) { - const filename = path.basename(src); - const { docs } = await payload.find({ - collection: "media", - where: { filename: { equals: filename } }, - limit: 1, - depth: 0, - }); - const id = - docs[0]?.id ?? - ( - await payload.create({ - collection: "media", - data: { alt: alt.english }, - filePath: path.resolve("public", src.slice(1)), - context: { ...context }, - }) - ).id; - photos.push(id); - } - for (const [locale, key] of [ - ["en", "english"], - ["fr", "french"], - ] as const) { - const current = await payload.findGlobal({ slug: "about-page", depth: 0 }); - await payload.updateGlobal({ - slug: "about-page", - locale, - data: { - carousel: photos.map((photo, index) => ({ - id: current.carousel?.[index]?.id, - photo, - alt: fallbackCarousel[index].alt[key], - })), - }, - context, - }); - } - console.log("carousel:", photos.length, "photos imported"); -} - -async function importTourDates() { - const rows = parseRows(await fetchSheet(572869052)).filter( - (row) => !!row.eventDate - ); - const counts: Record = {}; - for (const row of rows) { - const data = { - eventDate: toIsoDate(row.eventDate), - venue: row.venue.trim(), - location: row.location.trim(), - locationUrl: row.locationUrl?.trim() || null, - ticketUrl: row.ticketUrl?.trim() || null, - }; - const { docs } = await payload.find({ - collection: "tour-dates", - where: { - eventDate: { equals: data.eventDate }, - venue: { equals: data.venue }, - }, - limit: 1, - depth: 0, - }); - if (docs[0]) { - await payload.update({ - collection: "tour-dates", - id: docs[0].id, - data, - context, - }); - } else { - await payload.create({ collection: "tour-dates", data, context }); - } - tally(counts, docs[0]?.id); - } - console.log("tour-dates:", counts); -} - -async function importMusicItems() { - const rows = parseRows(await fetchSheet(1713768433)).filter( - (row) => !!row.title && !!row.type - ); - const counts: Record = {}; - for (const row of rows) { - const src = row.src.trim(); - const data = { - title: row.title.trim(), - type: row.type as "youtube" | "spotify" | "bandcamp", - src, - href: row.href?.trim() || null, - }; - const { docs } = await payload.find({ - collection: "music-items", - where: { src: { equals: src } }, - limit: 1, - depth: 0, - }); - let id = docs[0]?.id; - if (id) { - await payload.update({ - collection: "music-items", - id, - data: { ...data, category: row.category?.trim() }, - locale: "en", - context, - }); - } else { - id = ( - await payload.create({ - collection: "music-items", - data: { ...data, category: row.category?.trim() ?? "" }, - locale: "en", - context, - }) - ).id; - } - await payload.update({ - collection: "music-items", - id, - data: { category: row.categorie?.trim() }, - locale: "fr", - context, - }); - tally(counts, docs[0]?.id); - } - console.log("music-items:", counts); -} - -async function importLyrics() { - const rows = parseRows(await fetchSheet(145198726)).filter( - (row) => !!row.title - ); - const counts: Record = {}; - for (const row of rows) { - const data = { - title: row.title.trim(), - album: row.album?.trim() ?? "", - date: row.date?.trim() || null, - status: row.lyrics ? ("published" as const) : ("draft" as const), - lyrics: row.lyrics || null, - }; - const { docs } = await payload.find({ - collection: "lyrics", - where: { - title: { equals: data.title }, - album: { equals: data.album }, - }, - limit: 1, - depth: 0, - }); - let id = docs[0]?.id; - if (id) { - await payload.update({ - collection: "lyrics", - id, - data, - locale: "en", - context, - }); - } else { - id = ( - await payload.create({ - collection: "lyrics", - data, - locale: "en", - context, - }) - ).id; - } - if (row.paroles) { - await payload.update({ - collection: "lyrics", - id, - data: { lyrics: row.paroles }, - locale: "fr", - context, - }); - } - tally(counts, docs[0]?.id); - } - console.log("lyrics:", counts); -} - -await importPages(); -await importCarousel(); -await importTourDates(); -await importMusicItems(); -await importLyrics(); -process.exit(0); diff --git a/src/utils/fetchSheet.ts b/src/utils/fetchSheet.ts deleted file mode 100644 index 802c92e..0000000 --- a/src/utils/fetchSheet.ts +++ /dev/null @@ -1,12 +0,0 @@ -export default async function fetchSheet(tabGid: number): Promise { - const response = await fetch(`${process.env.SHEET_CSV_URL}&gid=${tabGid}`, { - signal: AbortSignal.timeout(8000), - }); - const contentType = response.headers.get("content-type") ?? ""; - if (!response.ok || !contentType.startsWith("text/csv")) { - throw new Error( - `Sheet tab ${tabGid} responded ${response.status} ${contentType}` - ); - } - return response.text(); -} diff --git a/src/utils/parseCsv.ts b/src/utils/parseCsv.ts deleted file mode 100644 index d7a6a10..0000000 --- a/src/utils/parseCsv.ts +++ /dev/null @@ -1,18 +0,0 @@ -import Papa from "papaparse"; - -export default function parseCsv( - csv: string, - isValidRow: (row: T) => boolean -): T[] { - const parsed = Papa.parse(csv, { - header: true, - skipEmptyLines: true, - }); - - if (parsed.errors.length > 0) { - console.error("CSV parsing errors:", parsed.errors); - return []; - } - - return parsed.data.filter(isValidRow); -} diff --git a/src/utils/parsePageCsv.ts b/src/utils/parsePageCsv.ts deleted file mode 100644 index 597168d..0000000 --- a/src/utils/parsePageCsv.ts +++ /dev/null @@ -1,33 +0,0 @@ -import Papa from "papaparse"; -import { Page } from "./types"; - -export default function parsePageCsv(csv: string): Page[] { - const parsed = Papa.parse(csv, { - header: false, - skipEmptyLines: true, - }); - - if (parsed.errors.length > 0) { - console.error("CSV parsing errors:", parsed.errors); - return []; - } - - const [headers, ...rows] = parsed.data; - - if (!headers || headers.length <= 1) { - console.error("Invalid CSV format: No valid headers found."); - return []; - } - - const languages = headers.slice(1); - const result: Page[] = languages.map(() => ({ title: "", content: "" })); - - rows.forEach((row) => { - const key = row[0]; - row.slice(1).forEach((value, index) => { - result[index][key as keyof Page] = value; - }); - }); - - return result; -} From 9e6eb25122758cfee928e61facc511362a76424c Mon Sep 17 00:00:00 2001 From: maxitect Date: Thu, 26 Nov 2026 19:01:03 +0000 Subject: [PATCH 2/4] chore(ci): drop SHEET_CSV_URL from CI and the docs --- .claude/skills/orchestrate-tickets/SKILL.md | 2 +- .github/workflows/ci.yml | 2 -- README.md | 29 +++++---------------- docs/tickets/INSTRUCTIONS.md | 5 ++-- 4 files changed, 10 insertions(+), 28 deletions(-) diff --git a/.claude/skills/orchestrate-tickets/SKILL.md b/.claude/skills/orchestrate-tickets/SKILL.md index cc4c358..fd8709a 100644 --- a/.claude/skills/orchestrate-tickets/SKILL.md +++ b/.claude/skills/orchestrate-tickets/SKILL.md @@ -66,6 +66,6 @@ You drive; the agents do the work. Never implement, review, run `check.sh` or ed - A dependent starts only once its parent's PR is ready for review, so the code it builds on has stopped moving; it stacks on the parent's branch. Two unmerged parents means it waits for the user to merge one. In a `merge on` run there is no stacking: a dependent waits until its parent has merged and starts from `main`. `$R ready` enforces all of this. - Only you merge, only with `$R merge`, and only in a run started with `--merge`. Agents never merge or push to `main`. You may commit and push your own fixes to the ticket tooling (`.claude/`, `docs/tickets/`) straight to `main` as you go, never site code. - When a parent changes or merges under a stacked child still in flight, send the child's reviewer (or implementer) to rebase with the `gh-stack` skill, then `check.sh` and `ship.sh`. -- Every push costs a Netlify build on the free plan, and parallel agents multiply Google Sheet requests (INSTRUCTIONS.md ยง4). Keep `--parallel` at 3 or below unless the user asks. +- Every push costs a Netlify build on the free plan, and parallel agents multiply them. Keep `--parallel` at 3 or below unless the user asks. - The hard rules in `docs/tickets/INSTRUCTIONS.md` ยง5 apply to every agent; a reviewer that finds one broken reports it as critical and the loop fixes it like any other finding. - `/tickets` is the same loop one ticket at a time on the main checkout; `/ticket` is one ticket in your own session. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 840c753..9961f2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,5 +17,3 @@ jobs: - run: pnpm lint - run: pnpm typecheck - run: pnpm build - env: - SHEET_CSV_URL: ${{ vars.SHEET_CSV_URL }} diff --git a/README.md b/README.md index 3df4b87..d42b236 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Tailwind CSS](https://img.shields.io/badge/Tailwind_CSS-4-06B6D4?style=flat-square&logo=tailwindcss&logoColor=white)](https://tailwindcss.com/) [![Three.js](https://img.shields.io/badge/Three.js-0.187-black?style=flat-square&logo=three.js&logoColor=white)](https://threejs.org/) -A dynamic Next.js website for the 6-piece funk/pop band Clark's Bowling Club, featuring bilingual content, interactive 3D elements, and content management via Google Sheets. +A dynamic Next.js website for the 6-piece funk/pop band Clark's Bowling Club, featuring bilingual content, interactive 3D elements, and content managed in Payload CMS. ## Table of Contents @@ -33,7 +33,7 @@ A dynamic Next.js website for the 6-piece funk/pop band Clark's Bowling Club, fe ๐ŸŽค **Lyrics Display**: Searchable lyrics organised by album ๐Ÿ” **SEO Optimised**: Automatic sitemap generation, robots.txt, and LLMs.txt โ™ฟ **Accessibility**: ARIA labels, keyboard navigation, reduced motion support -๐Ÿ“Š **Dynamic Content**: Pages populated from Google Sheets CMS +๐Ÿ“Š **Dynamic Content**: Pages populated from the Payload CMS ## Tech Stack @@ -41,7 +41,7 @@ A dynamic Next.js website for the 6-piece funk/pop band Clark's Bowling Club, fe - **Styling**: [Tailwind CSS](https://tailwindcss.com/) with custom fonts - **3D Graphics**: [Three.js](https://threejs.org/) for interactive elements - **Email**: [Nodemailer](https://nodemailer.com/) for contact forms -- **Data**: Google Sheets as CMS via CSV exports +- **Data**: [Payload CMS](https://payloadcms.com/) on Neon Postgres - **Icons**: [React Icons](https://react-icons.github.io/react-icons/) (Font Awesome 6) - **State**: React Context for language switching - **Deployment**: [Netlify](https://www.netlify.com/) @@ -109,8 +109,9 @@ src/ Create a `.env.local` file in the root directory: ```bash -# Google Sheets Configuration -SHEET_CSV_URL=https://docs.google.com/spreadsheets/d/[SHEET_ID]/export?format=csv +# Payload Configuration +DATABASE_URL=postgres://user:password@host/db +PAYLOAD_SECRET=a_long_random_string # Site Configuration NEXT_PUBLIC_SITE_URL=https://clarksbowlingclub.com @@ -125,23 +126,7 @@ EMAIL_PASSWORD=your_app_password ## Content Management -Content is managed via Google Sheets with specific tab GIDs: - -- **About Page**: GID 0 (title, content) -- **Music**: GID 1713768433 (embedded media, categories) -- **Lyrics**: GID 145198726 (songs, albums, lyrics) -- **Tour Page**: GID 127405583 (page content) -- **Tour Dates**: GID 572869052 (events, venues, tickets) - -### Sheet Format - -Pages use this structure: - -```csv -key,english,french -title,About,Bio -content,"Band description...","Description du groupe..." -``` +Content is edited in the Payload admin at `/admin`. See `docs/admin-guide.md`. ## Key Components diff --git a/docs/tickets/INSTRUCTIONS.md b/docs/tickets/INSTRUCTIONS.md index 9520d26..ce60e69 100644 --- a/docs/tickets/INSTRUCTIONS.md +++ b/docs/tickets/INSTRUCTIONS.md @@ -75,14 +75,13 @@ One checkout, one ticket in flight at a time, except under `/orchestrate-tickets | Dev server | `pnpm dev --port <4000 + issue number>`, e.g. ticket 27 uses 4027. Run it in the background and stop it when you're done | | The user's own server | Port 3000 belongs to the user. Never use it, never stop it | | Env file | `.env.local` in the repo root. Read variable names only. Once Payload lands (#33), its `DATABASE_URL` must point at the Neon `dev` branch, because `pnpm dev` will push the Payload schema to it | -| Content | Payload when `DATABASE_URL` is set (`src/lib/data/payload.ts`), otherwise the published Google Sheet (`src/lib/data/sheet.ts`). Production reads the sheet until the switchover in #33. Local storage variables are `S3_ENDPOINT`, `S3_REGION`, `S3_ACCESS_KEY_ID`, `S3_SECRET_ACCESS_KEY` and `S3_BUCKET`; `neon checkout` writes Neon's `AWS_*` names, so copy them across. `pnpm content:import` and `pnpm content:compare` run against whatever `DATABASE_URL` points at | +| Content | Payload (`src/lib/data/payload.ts`), which needs `DATABASE_URL`. Local storage variables are `S3_ENDPOINT`, `S3_REGION`, `S3_ACCESS_KEY_ID`, `S3_SECRET_ACCESS_KEY` and `S3_BUCKET`; `neon checkout` writes Neon's `AWS_*` names, so copy them across. | | Artefacts | Screenshots, logs and scratch scripts go in `.git/ticket//artefacts/`, never in the working tree | Rules: - Stop only your own dev server, by port: `lsof -tiTCP: -sTCP:LISTEN | xargs kill`. Never `pkill`. - Never print `.env.local` or any secret, and never commit one. -- The Google Sheet throttles: a burst of requests made it stop answering for about 15 minutes on 11 November 2026, and pages sat on "Loading...". Load pages that read it as few times as you need, and don't script loops against it. - The contact form sends real email through the band's mailbox. Never submit it against production. To test it locally, start the dev server with `EMAIL_HOST`, `EMAIL_PORT` and `EMAIL_SECURE` overridden in the shell to point at a local SMTP catcher (for example `maildev`), and read the message there. - Parallel sessions share the Playwright browser tab; prefer an isolated headless script. @@ -130,7 +129,7 @@ The Netlify, Neon and GitHub tools are installed and signed in. Use them to find | Deploy previews | One per PR, at `https://deploy-preview---clarksbowlingclub.netlify.app`. `gh pr checks ` shows when it is ready | | Build | `@netlify/plugin-nextjs`; settings are in the Netlify UI until `netlify.toml` lands (#26) | | Free plan limits | 100 GB bandwidth, 300 build minutes and 125,000 function calls a month. Each push to a PR costs a build, so push as few times as you can | -| Environment variables | All contexts: `EMAIL_HOST`, `EMAIL_PORT`, `EMAIL_SECURE`, `EMAIL_USER`, `EMAIL_PASSWORD` (secret), `SHEET_CSV_URL` (server-only; it replaced `NEXT_PUBLIC_CSV_URL` in #27). Deploy previews only, until the migration: `DATABASE_URL`, `PAYLOAD_SECRET`, `S3_ACCESS_KEY_ID`, `S3_SECRET_ACCESS_KEY` (secrets), `S3_ENDPOINT`, `S3_REGION`, `S3_BUCKET`. Netlify reserves the `AWS_*` names, so Neon's storage credentials are stored as `S3_*` | +| Environment variables | All contexts: `EMAIL_HOST`, `EMAIL_PORT`, `EMAIL_SECURE`, `EMAIL_USER`, `EMAIL_PASSWORD` (secret). Also `DATABASE_URL`, `PAYLOAD_SECRET`, `S3_ACCESS_KEY_ID`, `S3_SECRET_ACCESS_KEY` (secrets), `S3_ENDPOINT`, `S3_REGION`, `S3_BUCKET`. Netlify reserves the `AWS_*` names, so Neon's storage credentials are stored as `S3_*` | | Database | Neon project `cbc` (`damp-truth-56586096`), Frankfurt, free plan, in the Tandem Neon account: run Neon commands with `NEON_PROFILE=tandem`. Branches: `main` (production, empty until the migration), `preview` (shared by every deploy preview), `dev` (local). Bucket `media` on each branch. Spiked in #32; migration in #33 | Reads are always fine: deploy logs (`netlify api getDeploy`, `listSiteDeploys`), variable names, DNS lookups. Anything that changes a hosted service needs the user's approval first; agents ask the `/tickets` driver, and the driver asks the user. The one standing exception is the Neon `dev` and `preview` branches: a ticket may push schema to `dev`, run `payload migrate` on `preview` and create test content on either. Both are disposable: a ticket or driver may reset them to their parent (`neon branches reset --parent`) whenever work needs it. Deleting a branch still needs approval, and `main` is never written. From 300364b7ab2aabae6612af77a66b9a479fbd9a53 Mon Sep 17 00:00:00 2001 From: maxitect Date: Thu, 26 Nov 2026 19:01:55 +0000 Subject: [PATCH 3/4] ci: build with the database secrets now the sheet is gone --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9961f2b..266bdb1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,3 +17,6 @@ jobs: - run: pnpm lint - run: pnpm typecheck - run: pnpm build + env: + DATABASE_URL: ${{ secrets.DATABASE_URL }} + PAYLOAD_SECRET: ${{ secrets.PAYLOAD_SECRET }} From c17ec699729ba9b77140e54dc77c01ef7d6605dc Mon Sep 17 00:00:00 2001 From: maxitect Date: Thu, 26 Nov 2026 19:05:06 +0000 Subject: [PATCH 4/4] docs(readme): list the S3 media storage variables Payload reads --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index d42b236..f8160b3 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,13 @@ Create a `.env.local` file in the root directory: DATABASE_URL=postgres://user:password@host/db PAYLOAD_SECRET=a_long_random_string +# Media storage (S3-compatible, Neon object storage) +S3_ENDPOINT=https://storage.example.com +S3_REGION=eu-central-1 +S3_BUCKET=media +S3_ACCESS_KEY_ID=your_access_key_id +S3_SECRET_ACCESS_KEY=your_secret_access_key + # Site Configuration NEXT_PUBLIC_SITE_URL=https://clarksbowlingclub.com