Add Sanity seed migration to deploy scripts
This commit is contained in:
parent
94c22ab013
commit
1c91d57899
2 changed files with 22 additions and 0 deletions
20
src/scripts/deploy.ts
Normal file
20
src/scripts/deploy.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { ExecArgs } from "@medusajs/framework/types"
|
||||
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
|
||||
import syncSanity from "./sync-sanity"
|
||||
import linkProducts from "./link-products"
|
||||
|
||||
export default async function deploy({ container }: ExecArgs) {
|
||||
const logger = container.resolve(ContainerRegistrationKeys.LOGGER)
|
||||
|
||||
logger.info("=== Starting deployment sync ===")
|
||||
|
||||
// 1. Sync products from Sanity
|
||||
logger.info("--- Step 1: Syncing products from Sanity ---")
|
||||
await syncSanity({ container })
|
||||
|
||||
// 2. Link products to sales channel and set inventory
|
||||
logger.info("--- Step 2: Linking products and setting inventory ---")
|
||||
await linkProducts({ container })
|
||||
|
||||
logger.info("=== Deployment sync complete ===")
|
||||
}
|
||||
2
start.sh
2
start.sh
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/sh
|
||||
echo "Running database migrations..."
|
||||
npx medusa db:migrate
|
||||
echo "Running deployment sync (Sanity + product linking)..."
|
||||
npx medusa exec ./src/scripts/deploy.js
|
||||
echo "Starting Medusa server..."
|
||||
npx medusa start
|
||||
|
|
|
|||
Loading…
Reference in a new issue