@@ -8,32 +8,59 @@ npm install
88npm run build
99cd ..
1010
11- # Create template-ui directory in docs/assets
12- echo " Setting up template UI in docs..."
13- mkdir -p docs/assets/template-ui
14- cp -r frontend/out/* docs/assets/template-ui/
11+ # Create template-ui directory in docs/assets if static export exists
12+ if [ -d frontend/out ]; then
13+ echo " Setting up template UI in docs..."
14+ mkdir -p docs/assets/template-ui
15+ cp -r frontend/out/* docs/assets/template-ui/
1516
16- # Ensure images are available in multiple locations
17- mkdir -p docs/assets/template-ui/images
18- cp -r frontend/public/images/* docs/assets/template-ui/images/
17+ # Ensure images are available in multiple locations
18+ mkdir -p docs/assets/template-ui/images
19+ cp -r frontend/public/images/* docs/assets/template-ui/images/
1920
20- # Also copy images to root of template-ui
21- cp -r frontend/public/images/* docs/assets/template-ui/
21+ # Also copy images to root of template-ui
22+ cp -r frontend/public/images/* docs/assets/template-ui/
2223
23- # And to assets directory
24- mkdir -p docs/assets/images
25- cp -r frontend/public/images/* docs/assets/images/
24+ # And to assets directory
25+ mkdir -p docs/assets/images
26+ cp -r frontend/public/images/* docs/assets/images/
27+ else
28+ echo " Warning: frontend/out not found; skipping template UI asset copy." >&2
29+ fi
2630
2731# Build MkDocs site (which will include the template UI)
2832echo " Building MkDocs site..."
33+
34+ # Ensure the backend virtualenv is activated before generating the OpenAPI spec
35+ if [ -d " backend/.venv" ]; then
36+ # shellcheck disable=SC1091
37+ source backend/.venv/bin/activate
38+ else
39+ echo " Error: backend virtualenv not found at backend/.venv" >&2
40+ exit 1
41+ fi
42+
43+ export HYGRAPH_WEBHOOK_SECRET=" ${HYGRAPH_WEBHOOK_SECRET:- dummy-hygraph-secret} "
44+ export SHOPIFY_STORE=" ${SHOPIFY_STORE:- dummy-store} "
45+ export SHOPIFY_TOKEN=" ${SHOPIFY_TOKEN:- dummy-shopify-token} "
46+ export SHOPIFY_WEBHOOK_SECRET=" ${SHOPIFY_WEBHOOK_SECRET:- dummy-shopify-webhook} "
47+ export PYTHONPATH=" ${PWD}${PYTHONPATH: +: $PYTHONPATH } "
48+
49+ python backend/scripts/generate_openapi.py > docs/API_SPEC.md
50+
51+ # Deactivate the virtualenv to avoid affecting subsequent commands
52+ deactivate
53+
2954mkdocs build
3055
3156# Copy images to multiple locations in the site directory
3257mkdir -p site/assets/template-ui/images
3358cp -r frontend/public/images/* site/assets/template-ui/images/
3459
35- # Copy to root of template-ui
36- cp -r frontend/public/images/* site/assets/template-ui/
60+ # Copy to root of template-ui if available
61+ if [ -d frontend/out ]; then
62+ cp -r frontend/public/images/* site/assets/template-ui/
63+ fi
3764
3865# Copy to site/assets/images
3966mkdir -p site/assets/images
0 commit comments