# Packaging & Release

## Build for Release

Before packaging, ensure all assets are built:

```bash
# Build admin panel
npm run admin
# (wait for build to complete, then Ctrl+C)

# Build frontend
npm run frontend
# (wait for build to complete, then Ctrl+C)

# Build deactivation script
npm run deactivate
```

Verify the compiled files exist:
- `public/js/admin.min.js`
- `public/js/ajaxpress.min.js`
- `public/js/deactivate.min.js`
- `public/css/admin.min.css`
- `public/css/ajaxpress.min.css`

## Packaging with Pak

The project uses `pak.yml` for creating distributable zip files.

### Configuration (`pak.yml`)

```yaml
excludes:
    - .git/**
    - .gitignore
    - .gitattributes
    - node_modules/**
    - package.json
    - package-lock.json
    - vite.config.*
    - src/**
    - .github/**
    - .wordpress-org/**
    - doc/**
    - .md
    - .json
    - public/js/admin.min.js.map
    - public/js/ajaxpress.min.js.map
compression: 9
max_file_size: 10MB
```

### What Gets Excluded

| Excluded | Reason |
|----------|--------|
| `.git/` | Version control history |
| `node_modules/` | Build dependencies |
| `src/` | Source code (only compiled output needed) |
| `doc/` | Documentation (development reference only) |
| `.github/` | CI/CD configuration |
| `*.map` | Source maps (debugging only) |
| `*.md` | Markdown files |
| `*.json` | Config files (package.json, etc.) |

### What Gets Included

- `ajaxpress.php` -- Main plugin file
- `includes/` -- All PHP classes
- `public/` -- Compiled JS, CSS, and images (minus source maps)
- `templates/` -- PHP template files
- `readme.txt` -- WordPress.org readme
- `changelog.txt` -- Version history

## Version Bumping

Update the version number in these locations:

1. **`ajaxpress.php`** -- Plugin header comment (`Version: X.Y.Z`)
2. **`ajaxpress.php`** -- `AJAXPRESS_VERSION` constant
3. **`readme.txt`** -- Stable tag
4. **`changelog.txt`** -- New version entry

## Release Checklist

1. Update version numbers (see above)
2. Update `changelog.txt` with release notes
3. Build all assets (`npm run admin`, `npm run frontend`, `npm run deactivate`)
4. Run PHP linting (`npm run report`) and fix any issues
5. Test the plugin on a clean WordPress installation
6. Package with Pak (or manually zip excluding the items in `pak.yml`)
7. Test the zip file by installing on a fresh WordPress site
8. Tag the release in Git
