Download deploy-space.sh from dshunt/next18-anniversary-patch: direct link, hf CLI and curl.
- Browser
- Download file 1.53 kB
-
https://huggingface.co/datasets/dshunt/next18-anniversary-patch/resolve/main/deploy-space.sh
- Command line
-
hf download hf://datasets/dshunt/next18-anniversary-patch/deploy-space.sh
-
curl -L -o deploy-space.sh https://huggingface.co/datasets/dshunt/next18-anniversary-patch/resolve/main/deploy-space.sh
1.53 kB
| # deploy-space.sh — upload the built app (dist/) to the private static Space | |
| # https://huggingface.co/spaces/dshunt/anniversary-intimacy | |
| # | |
| # Usage (after apply-push.sh has produced a build): | |
| # HF_TOKEN=hf_xxx bash deploy-space.sh | |
| # | |
| # Get a token at https://huggingface.co/settings/tokens (scope: write). | |
| # Keep it as an env var — never paste it into chats or issues. | |
| set -euo pipefail | |
| : "${HF_TOKEN:?Set HF_TOKEN env var (https://huggingface.co/settings/tokens, write scope)}" | |
| SPACE="${SPACE:-dshunt/anniversary-intimacy}" | |
| APP_DIR="${APP_DIR:-$HOME/next18-build/app/anniversary-intimacy}" # workdir from apply-push.sh | |
| DIST="${DIST:-$APP_DIR/dist}" | |
| [ -f "$DIST/index.html" ] || { echo "No build found at $DIST — 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 fs from 'fs'; | |
| import path from 'path'; | |
| import { uploadFile } from '@huggingface/hub'; | |
| const dist = '${DIST}'; | |
| const files = []; | |
| const walk = d => fs.readdirSync(d, { withFileTypes: true }).forEach(e => { | |
| const p = path.join(d, e.name); | |
| e.isDirectory() ? walk(p) : files.push(p); | |
| }); | |
| walk(dist); | |
| for (const f of files) { | |
| await uploadFile({ | |
| repo: 'space', | |
| repoId: '${SPACE}', | |
| path: path.relative(dist, f), | |
| file: fs.createReadStream(f), | |
| credentials: { accessToken: process.env.HF_TOKEN }, | |
| }); | |
| console.log('uploaded:', path.relative(dist, f)); | |
| } | |
| " | |
| echo "" | |
| echo "✅ Deployed to https://huggingface.co/spaces/${SPACE}" | |