Skip to content

feat: add build-local script, bump @tinacms/cli to 2.3.1#332

Open
kulesy wants to merge 1 commit into
mainfrom
add-build-local-script
Open

feat: add build-local script, bump @tinacms/cli to 2.3.1#332
kulesy wants to merge 1 commit into
mainfrom
add-build-local-script

Conversation

@kulesy
Copy link
Copy Markdown

@kulesy kulesy commented May 21, 2026

Summary

Adds a build-local script and bumps the Tina deps so it works:

  "build": "echo 'Starting TinaCMS build...' && tinacms build && echo 'TinaCMS build completed. Starting Next.js build...' && next build",
+ "build-local": "tinacms build --content=local --skip-cloud-checks -c \"next build\"",
  "postbuild": "npx pagefind --site .next --output-path .next/static/pagefind && next-sitemap",

- "@tinacms/cli": "^2.2.3",
+ "@tinacms/cli": "^2.3.1",

- "tinacms": "^3.7.3",
+ "tinacms": "^3.8.1",

Why

The other Tina starters ship a build-local script that lets contributors and CI build the project without provisioning a real TinaCloud project. tina-docs has a build-local-pagefind script, but despite the name it doesn't actually use local mode — it's tinacms build && next build && npx pagefind ..., which still calls TinaCloud the same way as build. So there's no real fork-safe/no-secrets build path today.

The --content=local flag (added in @tinacms/cli@2.3.0 via tinacms/tinacms#6636) is the right tool: it indexes content from the filesystem during the build so no GraphQL network calls happen, but generates a production-shaped client that points at TinaCloud at runtime — so the build artifact is deployable as-is.

This makes the template:

  • Fork-PR-safe in CI smoke tests — works with dummy NEXT_PUBLIC_TINA_CLIENT_ID / TINA_TOKEN env vars
  • Faster to build locally for users who have content checked in
  • Verifiable end-to-end without provisioning a cloud project

The existing postbuild hook (pagefind + next-sitemap) still runs automatically after build-local, so the produced artifact is search-ready.

A note on build-local-pagefind

That script is preserved untouched in this PR (it does the same thing as build + postbuild minus the explicit echo lines, but with pagefind output written to a different path). It's misnamed and largely redundant with the postbuild step. Cleaning it up is worth a separate small PR — I didn't want to expand the scope here.

Verification

NEXT_PUBLIC_TINA_CLIENT_ID=fake-id-for-smoke \
TINA_TOKEN=fake-token-for-smoke \
NEXT_PUBLIC_TINA_BRANCH=main \
pnpm run build-local

Result: ✓ 42/42 pages prerendered clean (including all /docs/api-documentation/* SSG routes), zero Tina Cloud network calls.

Test plan

  • CI: pnpm install resolves to @tinacms/cli@2.3.1 and tinacms@3.8.1
  • pnpm run build still works with real Tina Cloud creds (unchanged script)
  • pnpm run build-local works with dummy/no creds
  • pnpm run dev still works (unchanged script)
  • Playwright tests still pass (no app code changed)

🤖 Generated with Claude Code

Adds a build-local script that produces a deployable build without
needing real Tina Cloud credentials:

  "build-local": "tinacms build --content=local --skip-cloud-checks -c \"next build\""

--content=local (introduced in @tinacms/cli@2.3.0 via tinacms/tinacms#6636)
indexes content from the filesystem during the build while generating a
production-shaped client that points at TinaCloud at runtime — so the
artifact is deployable as-is. Useful for:

  - CI smoke tests on fork PRs (no secrets needed)
  - Faster local production builds
  - Verifying the build pipeline without provisioning a cloud project

The existing postbuild hook (pagefind + next-sitemap) runs automatically
after build-local too, so the produced artifact is search-ready.

The existing build-local-pagefind script is preserved untouched (it does
not actually use local mode despite the name — separate cleanup).

Bumps @tinacms/cli from ^2.2.3 to ^2.3.1 and tinacms from ^3.7.3 to ^3.8.1
to pick up the flag.

Verified locally with dummy NEXT_PUBLIC_TINA_CLIENT_ID / TINA_TOKEN /
NEXT_PUBLIC_TINA_BRANCH env vars: 42/42 pages prerender clean, zero Tina
Cloud network calls.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tina-docs Ready Ready Preview, Comment May 21, 2026 5:36am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant