diff --git a/.env.test b/.env.test index bb2f23dc..d965c94a 100644 --- a/.env.test +++ b/.env.test @@ -1,13 +1,14 @@ # Test environment — committed on purpose. # Dummy but format-valid values that satisfy src/types/environment.ts so the # app can boot for E2E tests. Flows depending on real external services will -# not work with these: AI generation (OpenAI/Anthropic), Mapbox geocoding, +# not work with these: AI generation (Anthropic), Mapbox geocoding, # email (UseSend), Umami analytics, status-page heartbeat. # Prerequisite: `docker compose up -d` (Mongo, Redis, S3 must be reachable). # Not the real dev-server port (3000): that literal can also appear hardcoded # in vendor code. SERVER_HOST=localhost:39217 +PRODUCTION_HOST=daniel.heene.io SERVER_URL=http://localhost:39217 NEXT_PUBLIC_SERVER_URL=http://localhost:39217 NEXT_PUBLIC_STATUS_PAGE_URL=http://localhost:3001 @@ -37,7 +38,6 @@ USESEND_API_KEY=test-key USESEND_DEFAULT_FROM_ADDRESS=test@example.com USESEND_DEFAULT_FROM_NAME=Test -OPENAI_API_KEY=sk-test ANTHROPIC_API_KEY=sk-ant-test MAPBOX_API_KEY=pk.test UNSPLASH_ACCESS_KEY= diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml deleted file mode 100644 index 56d26d63..00000000 --- a/.github/actionlint.yaml +++ /dev/null @@ -1,7 +0,0 @@ -paths: - .github/workflows/ci.yml: - ignore: - # The E2E job reads these from the Testing environment (`environment: - # Testing`), which a reusable workflow gets without declaring them under - # `workflow_call.secrets`; declaring them there left them empty. - - 'property "(test_services_host|database_url|redis_url|s3_endpoint|s3_bucket|s3_region|s3_access_key|s3_secret_key|ts_oauth_client_id|ts_oauth_secret)" is not defined' diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 6ba40c2a..dbfb8e3b 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -17,7 +17,7 @@ runs: node-version: 26 - name: Cache Bun packages - uses: actions/cache@v4 # TODO: pin to a commit SHA like the other actions + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: ~/.bun/install/cache key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }} diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 201aa418..5a83ab3c 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -154,6 +154,7 @@ jobs: # per-branch NODE_ENV build arg is gone with the Docker build phase. NODE_ENV: production SERVER_HOST: ${{ secrets.SERVER_HOST }} + PRODUCTION_HOST: ${{ secrets.PRODUCTION_HOST }} SERVER_URL: ${{ secrets.SERVER_URL }} NEXT_PUBLIC_SERVER_URL: ${{ secrets.NEXT_PUBLIC_SERVER_URL }} NEXT_PUBLIC_STATUS_PAGE_URL: ${{ secrets.NEXT_PUBLIC_STATUS_PAGE_URL }} @@ -177,7 +178,6 @@ jobs: USESEND_API_KEY: ${{ secrets.USESEND_API_KEY }} USESEND_DEFAULT_FROM_ADDRESS: ${{ secrets.USESEND_DEFAULT_FROM_ADDRESS }} USESEND_DEFAULT_FROM_NAME: ${{ secrets.USESEND_DEFAULT_FROM_NAME }} - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} MAPBOX_API_KEY: ${{ secrets.MAPBOX_API_KEY }} UNSPLASH_ACCESS_KEY: ${{ secrets.UNSPLASH_ACCESS_KEY }} @@ -209,6 +209,17 @@ jobs: - name: Run database migrations run: bun run migrate + # Webpack's persistent cache; the only part of .next worth restoring + # between builds. + - name: Restore Next.js build cache + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: .next/cache + key: next-${{ runner.os }}-${{ hashFiles('bun.lock') }}-${{ github.sha }} + restore-keys: | + next-${{ runner.os }}-${{ hashFiles('bun.lock') }}- + next-${{ runner.os }}- + # One build against this environment's real values — no separate # test-env compile to reconcile with afterward (see lint-and-test.yml's # `e2e` job for the PR-time equivalent, which uses .env.test instead). diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index b14a0a22..2fad0356 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -43,7 +43,7 @@ jobs: run: bun run lint - name: Check dependency version groups - run: bun run deps:lint + run: bun run packages:lint # Generated files are committed; a stale one means someone changed a # collection/field/block without running `bun run generate`. @@ -94,7 +94,7 @@ jobs: - name: Upload coverage if: always() - uses: actions/upload-artifact@v4 # TODO: pin to a commit SHA like the other actions + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: coverage path: coverage/ diff --git a/AGENTS.md b/AGENTS.md index e59ace98..d22924d2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -30,15 +30,17 @@ See `README.md` for setup/run instructions; this file focuses on conventions and ```bash bun install # install deps (Bun only — see packageManager in package.json) -bun run dev # runs Next.js dev server + Storybook in parallel -bun run dev:app # Next.js dev server only -bun run generate # regenerate Payload types + import map (run after changing collections/fields) -bun run build # production build +bun run dev # Next.js dev server via scripts/dev.mjs (--tunnel opens the Cloudflare Tunnel) +bun run dev:app # plain `next dev`, without the tunnel wrapper +bun run dev:storybook # Storybook on :6006 (not started by `bun run dev`) +bun run generate # regenerate Next route types, Payload types + import map +bun run build # production build (`next build --webpack`) +bun run typecheck # tsc --noEmit +bun run analyze # production build with @next/bundle-analyzer reports bun run lint # oxlint + oxfmt --check (does NOT auto-fix) bun run lint:fix # oxlint --fix + oxfmt (auto-fixes what it can) -bun run format # oxfmt (formatting and import order only) bun run test # unit tests (Vitest) -bun run deps:lint # syncpack: dependency version groups +bun run packages:lint # syncpack: dependency version groups bun run test:e2e # Playwright E2E (needs docker compose up -d) ``` @@ -55,11 +57,19 @@ files import generated types from `src/types/payload.ts` and `@/types/collection Don't let those block your task, but do not introduce new lint errors or warnings, and prefer fixing warnings in files you already touch. +`syncpack.config.mjs` pins each package family (Payload, Storybook, Vitest, Playwright, React) to +one version with `pinVersion`; to upgrade a family, change its pin and run `bun run packages:fix` +(`packages:update` skips pinned families). Pins rather than `sameRange`: syncpack only compares +one dependency across packages, so in this single-package repo no policy catches `react` and +`react-dom` drifting apart. `scripts/e2e-docker.sh` derives its image tag from the installed +`@playwright/test`. + Always spell scripts `bun run