File size: 2,420 Bytes
cf5bb57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Deployment Guide

## HuggingFace Spaces Deployment

Your Space is live at: **https://huggingface.co/spaces/Chunte/Thumbnail_miniCrafter**

## Quick Deploy

### **Windows:**
Simply run the batch file:
```bash
deploy-hf.bat
```

### **Mac/Linux:**
Use npm script:
```bash
npm run deploy:hf
```

## What the Script Does

1. **Builds** production bundle (`npm run build`)
2. **Creates** deployment branch (`hf-deploy`)
3. **Moves** `dist/` contents to root
4. **Commits** changes
5. **Pushes** to HuggingFace Spaces
6. **Returns** to main branch

## Manual Deployment (Alternative)

If you prefer manual control:

```bash
# 1. Build
npx vite build

# 2. Create deployment branch
git checkout -b hf-deploy

# 3. Move dist contents to root
# (Windows)
xcopy /E /Y dist\* .
rd /s /q dist

# 4. Copy README
git checkout main -- README.md

# 5. Commit and push
git add -A
git commit -m "Deploy to HF Spaces"
git push huggingface hf-deploy:main --force

# 6. Return to main
git checkout main
```

## First-Time Setup (Already Done!)

✅ Git remote added:
```bash
git remote add huggingface https://huggingface.co/spaces/Chunte/Thumbnail_miniCrafter
```

## Authentication

If you get authentication errors:

1. **Generate HuggingFace Token:**
   - Go to https://huggingface.co/settings/tokens
   - Create a new token with "write" access
   - Copy the token

2. **Configure Git Credential Helper:**
   ```bash
   git config credential.helper store
   ```

3. **On next push, enter:**
   - Username: `Chunte`
   - Password: `[your token]`

## Workflow for Updates

1. Make changes in your code
2. Test locally: `npm run dev`
3. Commit to GitHub: `git add . && git commit -m "..." && git push`
4. Deploy to HF Spaces: **`deploy-hf.bat`** (or `npm run deploy:hf`)
5. Done! Changes live in ~30 seconds

## Troubleshooting

### Build Fails
```bash
# Clean and rebuild
rm -rf dist node_modules
npm install
npx vite build
```

### Push Fails
```bash
# Check remotes
git remote -v

# Force push if needed
git push huggingface hf-deploy:main --force
```

### Branch Issues
```bash
# Delete local deployment branch
git branch -D hf-deploy

# Start fresh
deploy-hf.bat
```

## Notes

- The `hf-deploy` branch contains only built files (from `dist/`)
- Your main branch remains unchanged with source code
- GitHub repo and HF Spaces are separate (both get updates)
- HF Spaces updates in real-time when you push

---

🚀 Happy deploying!