This document explains how to build, develop, and maintain this WordPress plugin.
- Prerequisites
- Installation
- Development Workflow
- Building Assets
- Testing
- Code Quality
- Release Process
- PHP 8.2 or higher
- Node.js 20 or higher
- Composer 2.x
- npm or yarn
- Clone the repository:
git clone https://github.com/Starisian-Technologies/sparxstar-gluon.git
cd sparxstar-gluon- Install PHP dependencies:
composer install- Install Node dependencies:
npm install- Install Playwright browsers (for E2E testing):
npx playwright installsrc/
├── js/ # Source JavaScript files
├── css/ # Source CSS files
├── core/ # Core PHP classes
├── helpers/ # Helper PHP classes
├── includes/ # Autoloader and includes
├── integrations/# Third-party integrations
└── templates/ # Template files
assets/
├── js/ # Minified JavaScript (generated)
└── css/ # Minified CSS (generated)
# Lint all code
npm run lint
composer run lint:php
# Fix auto-fixable issues
npm run format
composer run fix:php
# Run tests
npm test
composer run test:php
# Build assets for production
npm run build
# Build JS only
npm run build:js
# Build CSS only
npm run build:css
# Generate translation files
npm run makepot
# Run Rector refactoring (dry-run)
composer run refactor:php
# Apply Rector refactoring
composer run refactor:php:fixJavaScript files are minified using Terser:
npm run build:jsThis will:
- Read all
.jsfiles fromsrc/js/ - Minify them using Terser
- Output to
assets/js/as.min.jsfiles - Generate source maps
CSS files are minified using clean-css:
npm run build:cssThis will:
- Read all
.cssfiles fromsrc/css/ - Minify them using clean-css
- Output to
assets/css/as.min.cssfiles
Run both JS and CSS builds:
npm run build# Run all PHPUnit tests
composer run test:php
# Run specific test file
./vendor/bin/phpunit tests/phpunit/ExampleTest.php# Run all Jest tests
npm test
# Run in watch mode
npm test -- --watch
# Generate coverage report
npm test -- --coverage# Run all E2E tests
npm run test:e2e
# Run specific browser
npx playwright test --project=chromium
# Run in headed mode (see browser)
npx playwright test --headed
# Debug mode
npx playwright test --debugPuppeteer is available for custom browser automation. See tests/e2e/ for examples.
Checks code against WordPress coding standards:
composer run lint:phpFix auto-fixable issues:
composer run fix:phpConfiguration: phpcs.xml.dist
Analyzes code for type errors and bugs:
composer run analyze:phpConfiguration: phpstan.neon.dist
Modernizes PHP code and applies best practices:
# Dry run (preview changes)
composer run refactor:php
# Apply changes
composer run refactor:php:fixConfiguration: rector.php
Lints JavaScript code:
npm run lint:jsConfiguration: eslint.config.js
Lints CSS code:
npm run lint:cssConfiguration: .stylelintrc.json
Generate POT file for translations:
npm run makepotThis creates/updates languages/plugin-textdomain.pot with all translatable strings.
- Update CHANGELOG.md with changes for the new version
- Commit all changes
- Create and push a version tag:
git tag -a v1.2.3 -m "Release version 1.2.3"
git push origin v1.2.3The GitHub Actions workflow will automatically:
- Update version numbers in all files
- Install dependencies
- Build and minify assets
- Generate translation files
- Create distribution zip
- Generate checksums (MD5, SHA256)
- Create GitHub release with artifacts
-
Update version in:
sparxstar-plugin-entry.php(plugin header, @version, GLUON_PLUGIN_VERSION)package.jsoncomposer.json(if version field exists)
-
Build assets:
npm run build- Generate POT file:
npm run makepot- Create distribution:
# Install production dependencies only
composer install --no-dev --optimize-autoloader
# Create zip excluding dev files
# Use .distignore to exclude filesRuns on every push and pull request:
- Lint PHP: PHPCS, PHPStan, Rector checks
- Lint Frontend: ESLint, Stylelint
- Test PHP: PHPUnit on PHP 8.2, 8.3, 8.4
- Test JavaScript: Jest unit tests
- Build Assets: Verify JS/CSS build process
- HTML Validation: Validates HTML templates
- CSS Validation: Checks CSS quality and browser compatibility
- JS Validation: Analyzes JavaScript complexity
Weekly security scans:
- Dependency audits (Composer & npm)
- CodeQL analysis
- Secret scanning
- Security best practices checks
- Automated accessibility testing with axe-core
- HTML validation
- WCAG 2.1 compliance checks
If builds fail, try:
# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm install
# Clear composer cache
composer clear-cache
composer install# Reinstall Playwright browsers
npx playwright install --force
# Clear Jest cache
npm test -- --clearCache# Auto-fix what's possible
npm run format
composer run fix:php
# Check what can't be auto-fixed
npm run lint
composer run lint:phpFor issues and questions:
- Open an issue on GitHub
- Review existing documentation in
docs/ - Contact: support@starisian.com