| | #!/bin/bash |
| | set -e |
| |
|
| | echo "π Starting Hugging Face Space..." |
| |
|
| | |
| | echo "π§ Setting up permissions..." |
| | chmod -R 755 /app/src/content/assets 2>/dev/null || echo "β οΈ Could not set permissions (non-critical)" |
| |
|
| | |
| | if [ "${ENABLE_NOTION_IMPORT:-false}" = "true" ] && [ -n "$NOTION_TOKEN" ] && [ -n "$NOTION_PAGE_ID" ]; then |
| | echo "π Notion import enabled - fetching content from Notion..." |
| | echo " Page ID: $NOTION_PAGE_ID" |
| | |
| | cd /app |
| | |
| | |
| | if npm run notion:import 2>&1; then |
| | echo "β
Notion import completed successfully!" |
| | |
| | |
| | echo "π¨ Rebuilding site with Notion content..." |
| | npm run build 2>&1 |
| | |
| | |
| | echo "π Generating PDF..." |
| | npm run export:pdf -- --theme=light --wait=full 2>&1 || echo "β οΈ PDF generation failed (non-critical)" |
| | |
| | echo "β
Site rebuilt and ready!" |
| | else |
| | echo "β οΈ Notion import failed - using pre-built content from build time" |
| | fi |
| | else |
| | if [ "${ENABLE_NOTION_IMPORT:-false}" = "true" ]; then |
| | echo "β οΈ Notion import enabled but NOTION_TOKEN or NOTION_PAGE_ID not found" |
| | echo " NOTION_TOKEN: ${NOTION_TOKEN:+SET}${NOTION_TOKEN:-NOT SET}" |
| | echo " NOTION_PAGE_ID: ${NOTION_PAGE_ID:+SET}${NOTION_PAGE_ID:-NOT SET}" |
| | echo " β Using pre-built content from build time" |
| | else |
| | echo "βοΈ Notion import disabled - using pre-built content from build time" |
| | fi |
| | fi |
| |
|
| | |
| | echo "π Starting nginx on port 8080..." |
| | exec nginx -g 'daemon off;' |
| |
|