PozoAppOptimandSEO/BAT-FILES-GUIDE.md

294 lines
6.0 KiB
Markdown
Raw Normal View History

# 🚀 POZO - BAT Files Usage Guide
## 📁 Available BAT Files
### 🔨 BUILD-PROJECT.bat (RECOMMENDED)
**What it does:**
- Stops all running servers
- Installs npm dependencies if needed
- Runs complete build with `npm run convert-jsx-to-html`
- Copies server files to dist
- Generates SEO files
- Verifies all output files
**When to use:**
- First time setup
- After making code changes
- When you need a fresh, complete build
**How to use:**
1. Double-click `BUILD-PROJECT.bat`
2. Wait for completion (1-2 minutes)
3. Check for success message
---
### ⚡ SIMPLE-BUILD.bat (ALTERNATIVE)
**What it does:**
- Same as BUILD-PROJECT but with better error handling
- Skips react-snap (faster)
- Still generates SEO files
**When to use:**
- If BUILD-PROJECT.bat fails
- When you want faster builds
- When react-snap causes issues
**How to use:**
1. Double-click `SIMPLE-BUILD.bat`
2. Wait for completion
3. Check output messages
---
### 🚀 QUICK-START.bat (FASTEST)
**What it does:**
- Just starts the server (no build)
- Uses existing dist folder
- Installs dependencies if missing
**When to use:**
- When you already have a build
- Just want to start/restart server
- Testing without rebuilding
**How to use:**
1. Make sure you've built at least once
2. Double-click `QUICK-START.bat`
3. Server starts immediately
---
### ▶️ START-SERVER.bat
**What it does:**
- Starts the Node.js server from dist folder
- Shows all test URLs
- Checks if dist/server.js exists
**When to use:**
- After building
- When QUICK-START seems too minimal
**How to use:**
1. Ensure build is complete
2. Double-click `START-SERVER.bat`
3. Browser-ல URLs open பண்ணு
---
### ⏹️ STOP-SERVER.bat
**What it does:**
- Kills all Node.js processes
- Confirms servers stopped
**When to use:**
- When you're done testing
- Before starting a new build
- When server is stuck
**How to use:**
1. Double-click `STOP-SERVER.bat`
2. Wait for confirmation
3. Done!
---
## 🎯 Recommended Workflow
### First Time / Fresh Setup:
```
1. BUILD-PROJECT.bat (Build everything)
2. START-SERVER.bat (Start server)
3. Test in browser (Verify SEO)
4. STOP-SERVER.bat (Stop when done)
```
### Regular Development:
```
1. Make code changes
2. STOP-SERVER.bat (Stop old server)
3. BUILD-PROJECT.bat (Rebuild)
4. START-SERVER.bat (Start new server)
5. Test in browser
6. STOP-SERVER.bat (Stop when done)
```
### Quick Testing (No Changes):
```
1. QUICK-START.bat (Just start server)
2. Test in browser
3. Press Ctrl+C in window (Stop server)
```
---
## 🐛 Troubleshooting
### Issue: BUILD-PROJECT.bat fails
**Solution 1:** Try SIMPLE-BUILD.bat instead
```
Double-click: SIMPLE-BUILD.bat
```
**Solution 2:** Manual build
```powershell
npm install
npm run build
node scripts/jsx-to-html-converter.js
```
**Solution 3:** Check for errors
- Missing dependencies → Run `npm install`
- Syntax errors in code → Check error messages
- Port already in use → Run STOP-SERVER.bat first
---
### Issue: START-SERVER.bat shows "dist/server.js not found"
**Solution:**
```
1. Run BUILD-PROJECT.bat first
2. Check if dist folder exists
3. Verify dist/server.js is present
```
---
### Issue: Server starts but shows blank page
**Solution:**
```
1. Check browser console (F12)
2. Verify URL is http://localhost:3000/home/ (with /home/)
3. Clear browser cache (Ctrl + Shift + Delete)
4. Rebuild: BUILD-PROJECT.bat
```
---
### Issue: Port 3000 already in use
**Solution:**
```
1. Run STOP-SERVER.bat
2. Or manually kill process:
Get-Process -Name node | Stop-Process -Force
3. Try starting again
```
---
### Issue: SEO tags not showing
**Solution:**
```
1. Verify you're viewing page source (Ctrl + U)
2. Check if scripts/generate-seo.js ran successfully
3. Rebuild with BUILD-PROJECT.bat
4. Check dist/home/pricing-pozoapp/index.html manually
```
---
## 📝 Quick Command Reference
### To Build:
- **Full build:** `BUILD-PROJECT.bat`
- **Simple build:** `SIMPLE-BUILD.bat`
### To Start:
- **Normal start:** `START-SERVER.bat`
- **Quick start:** `QUICK-START.bat`
### To Stop:
- **Clean stop:** `STOP-SERVER.bat`
- **Force stop:** Press `Ctrl+C` in server window
### To Test:
1. Start server (any method above)
2. Open: http://localhost:3000/home/
3. View source: Press `Ctrl + U`
4. Check `<title>` and `<meta>` tags
---
## ✅ Success Checklist
After running BUILD-PROJECT.bat, verify:
- [ ] No error messages
- [ ] dist/server.js exists
- [ ] dist/server/seo-middleware.js exists
- [ ] dist/web.config exists
- [ ] dist/home/pricing-pozoapp/index.html exists
- [ ] dist/home/blog/index.html exists
After running START-SERVER.bat, verify:
- [ ] "Server running on port 3000" message shows
- [ ] "Dynamic SEO enabled!" message shows
- [ ] http://localhost:3000/home/ opens in browser
- [ ] Page shows correct content
- [ ] View Source shows SEO tags
---
## 💡 Pro Tips
1. **Always stop server before building:**
- Run STOP-SERVER.bat before BUILD-PROJECT.bat
2. **Check for success messages:**
- Green text = success
- Red text = error
- Yellow text = warning (usually okay)
3. **Save time:**
- Use QUICK-START.bat if no code changes
- Use SIMPLE-BUILD.bat for faster builds
4. **Verify SEO:**
- Always check with Ctrl+U (View Source)
- Don't rely on browser inspector (F12)
5. **Keep terminal open:**
- Don't close the server window
- It shows useful logs and errors
---
## 🆘 Still Having Issues?
### Check logs:
1. Look at terminal output carefully
2. Red error messages show the problem
3. Note the step where it fails
### Common fixes:
```powershell
# Reinstall dependencies
npm install
# Clear node_modules and reinstall
Remove-Item node_modules -Recurse -Force
npm install
# Clear dist and rebuild
Remove-Item dist -Recurse -Force
BUILD-PROJECT.bat
# Kill all node processes
Get-Process -Name node | Stop-Process -Force
```
---
**Created:** 2025-11-04
**Version:** 1.0
**Project:** POZO - Retail ERP & POS
---
**படி படியா follow பண்ணா எல்லாம் work ஆகும்! 💪🚀**