VOOZH about

URL: https://deepwiki.com/Automattic/BuddyPress-VIP-Go/6.4-build-and-distribution-process

⇱ Build and Distribution Process | Automattic/BuddyPress-VIP-Go | DeepWiki


Loading...
Menu

Build and Distribution Process

Purpose and Scope

This document describes the mechanisms and workflows used to create distribution packages of the BuddyPress VIP Go plugin for production deployment. It covers the file filtering systems that exclude development artifacts, the relationship between .distignore and .gitattributes, and the build process for generating deployable packages.

For information about CI/CD automation that validates packages before distribution, see CI/CD Pipeline. For local development environment setup, see Local Development Setup.


Distribution File Filtering Architecture

The plugin uses a dual-layer filtering mechanism to ensure lean production packages by excluding development-only files through two complementary systems:

.distignore Filter System

The .distignore file defines exclusion patterns for WordPress.org and deployment tools that support the .distignore specification. This file is the primary distribution filter.

Excluded Directories:

  • /.claude/ - AI assistant configuration
  • /.git/ - Version control metadata
  • /.github/ - GitHub-specific workflows and templates
  • /bin/ - Build scripts and utilities
  • /node_modules/ - JavaScript dependencies
  • /tests/ - PHPUnit test suites
  • /vendor/ - Composer development dependencies

Excluded Configuration Files:

  • .distignore, .editorconfig, .gitattributes, .gitignore - Repository configuration
  • .phpcs.xml.dist - Code standards configuration
  • .wp-env.json, .wp-env.override.json - Local development environment
  • CHANGELOG.md - Version history (not needed in production)
  • composer.json, composer.lock - Dependency management
  • package.json, package-lock.json - JavaScript package management
  • phpunit.xml.dist - Test runner configuration

Sources: .distignore1-24

.gitattributes Export System

The .gitattributes file uses Git's export-ignore directive to exclude files from Git archive operations and Composer --prefer-dist installations. This provides a complementary filtering layer for Git-based distribution.

Export-Ignored Items:

/.claude/ export-ignore
/.github/ export-ignore
/tests/ export-ignore
/.distignore export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.phpcs.xml.dist export-ignore
/phpunit.xml.dist export-ignore
/CHANGELOG.md export-ignore

Note on Composer: Developers using Composer with --prefer-dist will receive archives with these files excluded. Development workflows should use --prefer-source to access test infrastructure and tooling.

Sources: .gitattributes1-27


Distribution Filter Comparison

The following diagram illustrates how the two filtering systems work in parallel:


Sources: .distignore1-24 .gitattributes6-15


Package Composition Matrix

The following table summarizes what gets included in different distribution scenarios:

File/DirectoryDevelopment.distignore PackageGit ArchiveComposer --prefer-dist
buddypress-vip-go.php
files.php
languages/*.pot
README.md
LICENSE
tests/
vendor/
.github/
composer.json
CHANGELOG.md
.phpcs.xml.dist
phpunit.xml.dist

Key Observations:

  • Core plugin files are always included in all scenarios
  • Development dependencies (vendor/) are excluded only by .distignore
  • Test infrastructure is excluded by both systems
  • CI/CD workflows (.github/) are excluded by both systems
  • Composer metadata is included in Git archives but excluded from .distignore packages

Sources: .distignore1-24 .gitattributes6-15


Build Process and Composer Scripts

The plugin defines several Composer scripts for build-related operations. While most scripts focus on testing and code quality (documented in Testing Infrastructure and Code Quality and Standards), one script is specifically relevant to distribution:

Internationalization (i18n) Build

The i18n script generates a POT (Portable Object Template) file for translation:


This executes:

wp i18n make-pot . ./languages/buddypress-vip-go.pot

Purpose: Scans all PHP files to extract translatable strings and generates a template file at languages/buddypress-vip-go.pot for localization workflows.

Note: The generated POT file is included in distribution packages as it's located in languages/ which is not excluded by either .distignore or .gitattributes.

Sources: composer.json49 composer.json61


Distribution Package Creation Workflow

The following diagram illustrates the complete workflow from repository to production deployment:


Sources: composer.json44-66 .distignore1-24 .gitattributes1-27


Deployment Process Details

WordPress VIP Go Deployment

The plugin is deployed to WordPress VIP Go environments through VIP's deployment infrastructure:

  1. Package Preparation: The distribution package (with .distignore filters applied) contains only production-ready files
  2. Upload Location: Plugin files are placed in the VIP Go site's plugin directory
  3. Activation Order: Must be activated after BuddyPress is already active (see Installation and Configuration)
  4. Environment Detection: On activation, buddypress-vip-go.php detects the VIP environment and loads files.php integration layer

Critical Files in Production:

  • buddypress-vip-go.php - Entry point and environment detector
  • files.php - Core integration logic (105.65 importance)
  • languages/buddypress-vip-go.pot - Translation template
  • README.md - Documentation
  • LICENSE - GPL-2.0-or-later license

Excluded from Production:

  • All files matching .distignore patterns
  • Test infrastructure (tests/ directory)
  • Development dependencies (vendor/ directory with dev packages)
  • CI/CD workflows (.github/ directory)
  • Build and tooling configuration files

Sources: .distignore1-24 composer.json2-5

Alternative Distribution Channels

WordPress.org Plugin Directory: If distributed via WordPress.org, the .distignore file would be respected by the plugin deployment tools. The submission process would:

  1. Clone the repository
  2. Apply .distignore filters
  3. Create a clean plugin ZIP
  4. Deploy to WordPress.org's CDN

Composer/Packagist: Developers installing via Composer with --prefer-dist receive Git archives with export-ignore directives applied. This results in a package without development files but still includes composer.json for dependency resolution.

Sources: .gitattributes2-4 composer.json16-19


Package Size Optimization

The filtering systems significantly reduce package size by excluding development artifacts:

Typical Development Installation:

  • Core plugin files: ~50KB
  • Development dependencies (vendor/): ~2-5MB
  • Test infrastructure (tests/): ~100KB
  • CI/CD workflows (.github/): ~20KB
  • Configuration files: ~10KB
  • Total: ~2-5MB

Production Distribution Package:

  • Core plugin files: ~50KB
  • Translation template: ~10KB
  • Documentation: ~10KB
  • License: <5KB
  • Total: ~70-75KB

Size Reduction: ~97% smaller than development installation

This optimization is critical for VIP Go environments where:

  • Multiple sites may share the same codebase
  • Network latency affects deployment speed
  • Storage efficiency is important at scale

Sources: .distignore1-24


Version Control Exclusions

The .gitignore file complements the distribution filters by excluding runtime-generated files from version control:

Excluded from Git:

  • /node_modules/ - JavaScript dependencies
  • /vendor/ - Composer dependencies (regenerated via composer install)
  • /composer.lock - Lock file (may vary per environment)
  • /.phpunit.cache/ - PHPUnit cache
  • Local configuration overrides (.phpcs.xml, phpunit.xml, .wp-env.override.json)

Rationale: These files are environment-specific or regenerated during development setup and should not be committed to the repository. Production deployments use composer.json to resolve dependencies rather than committing vendor/.

Sources: .gitignore1-16


Manual Distribution Package Creation

For manual package creation outside of automated CI/CD:

Using .distignore


Using Git Archive


Verifying Package Contents


Sources: .distignore1-24 .gitattributes6-15


Distribution Checklist

Before creating a production distribution package:

  • All tests pass (composer test:integration)
  • Code standards validated (composer cs)
  • PHP syntax validated (composer lint)
  • Translation template updated (composer i18n)
  • Version number updated in buddypress-vip-go.php header
  • CHANGELOG.md updated with release notes
  • .distignore excludes all development files
  • .gitattributes export-ignore directives match .distignore
  • No sensitive or environment-specific data in core files
  • README.md reflects current functionality
  • License information is current

Sources: composer.json44-66 .distignore1-24 .gitattributes6-15


Summary

The BuddyPress VIP Go plugin uses a two-layer filtering system to create optimized distribution packages:

  1. .distignore filters files for WordPress.org and deployment tools
  2. .gitattributes export-ignore filters files for Git archives and Composer

This dual approach ensures that production deployments receive only the ~70KB of core functionality without the ~2-5MB of development infrastructure. The build process relies on Composer scripts for quality validation, with the i18n script being the only build-specific operation that generates distributable assets (translation templates).

For automated distribution workflows, see CI/CD Pipeline. For deployment procedures, see Installation and Configuration.