# Production Build Process

This document explains how to create a production-ready zip file of the Ambiscale Activity Manager WordPress plugin.

## Quick Start

To build a production version of the plugin, run:

```bash
npm run build:production
```

This will create a file named `ambiscale-activity-manager-production.zip` in the root directory.

## Build Options

### Full Production Build (Recommended for Development)
```bash
npm run build:production
```
Creates the production zip and automatically restores development dependencies afterward.

### Production Zip Only (Recommended for CI/CD)
```bash
npm run build:zip-only
```
Creates the production zip but **does not** restore development dependencies. Use this when:
- Running in CI/CD environments
- Preparing releases without immediate development work
- You want to manually control when to restore dependencies

After using `build:zip-only`, restore development dependencies when needed:
```bash
npm run build:restore
```
or simply:
```bash
composer install
```

## What the Build Process Does

The build process consists of several steps:

1. **Clean**: Removes any existing build directory
2. **Build Assets**: Runs webpack in production mode to create optimized CSS/JS files
3. **Copy Files**: Copies all necessary files while excluding development files
4. **Install Production Dependencies**: Installs only production composer packages with optimized autoloader
5. **Create Zip**: Creates the final production zip file
6. **Restore** (only in `build:production`): Restores development dependencies for continued development

## Files Excluded from Production Build

- `node_modules/` - npm development dependencies
- `src/` - source files (built files are in `dist/`)
- `.git/` - version control files
- Development configuration files (webpack.config.js, package.json, etc.)
- Hidden files (.DS_Store, .idea/, .vscode/, etc.)
- Development composer packages (phpcs, etc.)
- Documentation files (README.md)

## Files Included in Production Build

- Main plugin file (`ambiscale-activity-manager.php`)
- Plugin classes (`inc/` directory)
- Views and templates (`views/` directory)
- Built assets (`dist/` directory)
- Language files (`languages/` directory)
- Production composer autoloader (vendor/autoload.php and composer/)
- WordPress readme (`readme.txt`)
- Uninstall script (`uninstall.php`)
- Screenshots and assets

## Individual Build Steps

You can also run individual steps of the build process:

```bash
# Full production build with auto-restore
npm run build:production

# Production zip only (no auto-restore)
npm run build:zip-only

# Individual steps:
# Clean build directory
npm run build:clean

# Build production assets only
npm run build:assets

# Copy files (excluding development files)
npm run build:copy

# Install production composer packages
npm run build:composer-prod

# Create zip file
npm run build:zip

# Restore development dependencies
npm run build:restore
```

## Notes

- The vendor directory in production will only contain the composer autoloader and core composer files
- Since this plugin has no external PHP dependencies, the vendor directory will be minimal
- All source files are compiled into the `dist/` directory during the build process
- The zip file is optimized for WordPress plugin distribution 