| # 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! | |