Seed the dev store's collections from a production snapshot
The AFK half of the wayfinder ticket "Seed the dev store from the live catalogue". Products, metafields and images still come from the CSV export — the CSV re-hosts images for free — but collection membership cannot: the Collection column is import-only, takes one collection per product, and this catalogue runs 1.6 memberships per product across 16 collections. - scripts/seed-dev-store.mjs (`npm run seed:dev-store`): creates each missing collection with its members in one call and publishes it. Uses CollectionCreateInput.sources because collectionAddProducts is deprecated at 2026-10, and publishes because collectionCreate leaves a collection unpublished — invisible to the Storefront API the dev store exists to serve. Idempotent, never deletes, reports handles it cannot find (which is how a partial CSV import shows up), and is a dry run unless given --apply. - assets/dev-store-seed.json: the baseline the seed is checked against and the membership map it consumes — 61 products with option values, weights and product types, 16 collections with 100 memberships, and the 10 metafield definitions that must exist before the import. - The ticket now records what the probes settled: the option shape is readable from the Storefront API (all 61 use Option1 name=Title; 22 are `Default Title`, 39 carry real values, so the import must not normalise), and the repo's production credentials are Storefront-scoped only — `products`, `collections` and `productsCount` are Access denied without read_products — so the ticket's "Admin API script using the credentials the repo already mints" was never available. A dev-store custom app is required instead.
This commit is contained in:
1 parent
de0553d0d4
commit
1bc1d5f753
4 files changed
+1354
-2
No files matched your search
+2
-1
@@ -14,7 +14,8 @@
|
||||
"lint": "eslint . && prettier --check .",
|
||||
"format": "prettier --write .",
|
||||
"pb": "bash -c 'if [ ! -f .pb/pocketbase ]; then mkdir -p .pb && curl -sL -o .pb/pb.zip https://github.com/pocketbase/pocketbase/releases/download/v0.40.2/pocketbase_0.40.2_linux_amd64.zip && (cd .pb && unzip -o -q pb.zip pocketbase && rm pb.zip); fi; cd .pb && ./pocketbase serve --http=127.0.0.1:8090 --dir=./pb_data'",
|
||||
"seed": "node --env-file-if-exists=.env scripts/pb-seed.mjs"
|
||||
"seed": "node --env-file-if-exists=.env scripts/pb-seed.mjs",
|
||||
"seed:dev-store": "node --env-file-if-exists=.env scripts/seed-dev-store.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sentry/tanstackstart-react": "^10.73.0",
|
||||
|
||||
Reference in new issue
Block a user