#!/usr/bin/env bash # mirror-source.sh — mirror the FULL patched anniversary-intimacy app source # (docs, src, configs — everything except node_modules/dist) to: # https://huggingface.co/datasets/dshunt/anniversary-intimacy-source # # Usage (after apply-push.sh, which clones + patches): # HF_TOKEN=hf_xxx bash mirror-source.sh # # Get a token at https://huggingface.co/settings/tokens (scope: write). set -euo pipefail : "${HF_TOKEN:?Set HF_TOKEN env var (https://huggingface.co/settings/tokens, write scope)}" TARGET="${TARGET:-dshunt/anniversary-intimacy-source}" APP_DIR="${APP_DIR:-$HOME/next18-build/app/anniversary-intimacy}" # workdir from apply-push.sh [ -f "$APP_DIR/src/App.tsx" ] || { echo "No patched app found at $APP_DIR — run apply-push.sh first."; exit 1; } cd "$APP_DIR" npm i --no-save @huggingface/hub >/dev/null 2>&1 node --input-type=module -e " import { uploadFolder } from '@huggingface/hub'; await uploadFolder({ repo: 'dataset', repoId: '${TARGET}', folder: '${APP_DIR}', ignorePatterns: ['node_modules/**', 'dist/**', '.vite/**', 'patch.mjs.bak'], credentials: { accessToken: process.env.HF_TOKEN }, }); console.log('source mirrored'); " echo "" echo "✅ Full app source mirrored to https://huggingface.co/datasets/${TARGET}"