# Plugin Zip Guide ## Overview This guide explains how to properly zip the WooNooW plugin for distribution. --- ## What to Include ### ✅ Include - All PHP files (`includes/`, `*.php`) - Admin SPA build (`admin-spa/dist/`) - Assets (`assets/`) - Languages (`languages/`) - README.md - LICENSE (if exists) - woonoow.php (main plugin file) ### ❌ Exclude - `node_modules/` - `admin-spa/src/` (source files, only include dist) - `.git/` - `.gitignore` - All `.md` documentation files (except README.md) - `composer.json`, `composer.lock` - `package.json`, `package-lock.json` - `.DS_Store`, `Thumbs.db` - Development/testing files --- ## Step-by-Step Process ### 1. Build Admin SPA ```bash cd admin-spa npm run build ``` This creates optimized production files in `admin-spa/dist/`. ### 2. Create Zip (Automated) ```bash # From plugin root directory zip -r woonoow.zip . \ -x "*.git*" \ -x "*node_modules*" \ -x "admin-spa/src/*" \ -x "*.md" \ -x "!README.md" \ -x "composer.json" \ -x "composer.lock" \ -x "package.json" \ -x "package-lock.json" \ -x "*.DS_Store" \ -x "Thumbs.db" ``` ### 3. Verify Zip Contents ```bash unzip -l woonoow.zip | head -50 ``` --- ## Required Structure ``` woonoow/ ├── admin-spa/ │ └── dist/ # ✅ Built files only ├── assets/ │ ├── css/ │ ├── js/ │ └── images/ ├── includes/ │ ├── Admin/ │ ├── Api/ │ ├── Core/ │ └── ... ├── languages/ ├── README.md # ✅ Only this MD file ├── woonoow.php # ✅ Main plugin file └── LICENSE (optional) ``` --- ## Size Optimization ### Before Zipping 1. ✅ Build admin SPA (`npm run build`) 2. ✅ Remove source maps if not needed 3. ✅ Ensure no dev dependencies ### Expected Size - **Uncompressed:** ~5-10 MB - **Compressed (zip):** ~2-4 MB --- ## Testing the Zip ### 1. Extract to Test Environment ```bash unzip woonoow.zip -d /path/to/test/wp-content/plugins/ ``` ### 2. Verify - [ ] Plugin activates without errors - [ ] Admin SPA loads correctly - [ ] All features work - [ ] No console errors - [ ] No missing files ### 3. Check File Permissions ```bash find woonoow -type f -exec chmod 644 {} \; find woonoow -type d -exec chmod 755 {} \; ``` --- ## Distribution Checklist - [ ] Admin SPA built (`admin-spa/dist/` exists) - [ ] No `node_modules/` in zip - [ ] No `.git/` in zip - [ ] No source files (`admin-spa/src/`) in zip - [ ] No documentation (except README.md) in zip - [ ] Plugin version updated in `woonoow.php` - [ ] README.md updated with latest info - [ ] Tested in clean WordPress install - [ ] All features working - [ ] No errors in console/logs --- ## Version Management ### Before Creating Zip 1. Update version in `woonoow.php`: ```php * Version: 1.0.0 ``` 2. Update version in `admin-spa/package.json`: ```json "version": "1.0.0" ``` 3. Tag in Git: ```bash git tag -a v1.0.0 -m "Release v1.0.0" git push origin v1.0.0 ``` --- ## Automated Zip Script Save as `create-zip.sh`: ```bash #!/bin/bash # Build admin SPA echo "Building admin SPA..." cd admin-spa npm run build cd .. # Create zip echo "Creating zip..." zip -r woonoow.zip . \ -x "*.git*" \ -x "*node_modules*" \ -x "admin-spa/src/*" \ -x "*.md" \ -x "!README.md" \ -x "composer.json" \ -x "composer.lock" \ -x "package.json" \ -x "package-lock.json" \ -x "*.DS_Store" \ -x "Thumbs.db" \ -x "create-zip.sh" echo "✅ Zip created: woonoow.zip" echo "📦 Size: $(du -h woonoow.zip | cut -f1)" ``` Make executable: ```bash chmod +x create-zip.sh ./create-zip.sh ``` --- ## Troubleshooting ### Issue: Zip too large **Solution:** Ensure `node_modules/` is excluded ### Issue: Admin SPA not loading **Solution:** Verify `admin-spa/dist/` is included and built ### Issue: Missing files error **Solution:** Check all required files are included (use `unzip -l`) ### Issue: Permission errors **Solution:** Set correct permissions (644 for files, 755 for dirs) --- ## Final Notes - Always test the zip in a clean WordPress environment - Keep source code in Git, distribute only production-ready zip - Document any special installation requirements in README.md - Include changelog in README.md for version tracking