AbiirSkincare/Hydrogen/web/scripts/README-sanity-rollout.txt

52 lines
2.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Sanity CMS rollout scripts (Hydrogen/web)
1) Verify env + document presence (read-only):
cd Hydrogen/web
node --env-file=.env ./scripts/sanity-rollout-verify.mjs
npm shortcut:
npm run sanity:rollout:verify
2) Seed PDP editorial (writes product.abiirPdp):
cp scripts/pdp-seed.example.json scripts/pdp-seed.json
Edit handles and copy; then:
node --env-file=.env ./scripts/sanity-seed-pdp.mjs scripts/pdp-seed.json
npm shortcut:
npm run sanity:rollout:seed-pdp -- scripts/pdp-seed.json
Seed ALL products from storefront defaults (Hydrogen `abiirPdpDefaults` — same copy as the PDP mock, with subtitle/chips/ratings for featured handles). By default only patches products that are still missing subtitle or short description (skips products that already have both); add -- --force to overwrite every product.
node --env-file=.env --experimental-strip-types ./scripts/sanity-seed-pdp-all.mjs
node --env-file=.env --experimental-strip-types ./scripts/sanity-seed-pdp-all.mjs -- --force
npm shortcut:
npm run sanity:rollout:seed-pdp-all
npm run sanity:rollout:seed-pdp-all -- --force
3) Seed all storefront singletons + static pages (home, settings, about, FAQ, shipping, track, quiz, contact, press, privacy, terms):
Regenerate JSON when mocks change (Node 22+; rewrites scripts/seed-data/cms-seed.json):
node --experimental-strip-types ./scripts/build-cms-seed-json.mjs
npm shortcut:
npm run sanity:rollout:build-seed
Push into Sanity (requires SANITY_API_WRITE_TOKEN):
node --env-file=.env ./scripts/sanity-seed-all.mjs
npm shortcut:
npm run sanity:rollout:seed-all
Optional — chain PDP seed after CMS:
node --env-file=.env ./scripts/sanity-seed-all.mjs -- --with-pdp scripts/pdp-seed.example.json
Notes:
- Uploads PNGs from app/assets when present; otherwise uses a 1×1 placeholder so required Studio images validate.
- Journal index/posts are not included; keep authoring those in Studio or extend the seed bundle.
4) Manual checklist (sanity.io/manage):
- API: CORS origins for local dev + production storefront
- Tokens: SANITY_API_WRITE_TOKEN for seed + product reviews API (server-only, never commit)
5) Shopify → Sanity: ensure product documents exist before seeding PDP (store.slug.current must match URL handle).