Skip to content

Latest commit

 

History

History
348 lines (264 loc) · 9.1 KB

File metadata and controls

348 lines (264 loc) · 9.1 KB

SPARXSTAR Starter Template - Setup Complete ✓

This document summarizes all the configurations and tooling that have been set up in this template repository.

✅ Completed Setup Tasks

1. Brand Updates

  • ✓ Replaced all "AiWA" and "Ai West Africa" references with "Starisian Technologies"
  • ✓ Updated all documentation to reflect correct branding

2. PHP Tooling Configuration

  • PHPCS (PHP_CodeSniffer) - WordPress VIP coding standards
    • Configured to scan only root PHP files and src/ directory
    • Excludes: vendor, node_modules, tests, assets, generated files
    • Configuration: phpcs.xml.dist
  • PHPStan - Static analysis at level 5
    • Scans only src/ directory
    • Configuration: phpstan.neon.dist
    • Baseline: phpstan-baseline.neon
  • PHPUnit - Unit testing framework
    • Configuration: phpunit.xml.dist
    • Test directory: tests/phpunit/
  • Rector - Automated refactoring
    • PHP 8.2+ modernization
    • Configuration: rector.php
    • Added to composer.json scripts

3. JavaScript & CSS Tooling

  • ESLint - JavaScript linting
    • Scans only src/js/ directory
    • Ignores generated/third-party files
    • Configuration: eslint.config.js
  • Stylelint - CSS linting
    • Scans only src/css/ directory
    • Configuration: .stylelintrc.json
    • Ignore list: .stylelintignore

4. Build System

  • Terser - JavaScript minification
    • Source: src/js/**/*.js
    • Output: assets/js/**/*.min.js
    • Generates source maps
    • Script: scripts/build-js.js
  • clean-css - CSS minification
    • Source: src/css/**/*.css
    • Output: assets/css/**/*.min.css
    • Script: scripts/build-css.js
  • Build Commands
    • npm run build - Build all assets
    • npm run build:js - Build JS only
    • npm run build:css - Build CSS only

5. Testing Infrastructure

  • Jest - JavaScript unit testing
    • Configuration: jest.config.js
    • Example test: src/js/__tests__/example.test.js
  • Playwright - E2E browser testing
    • Configuration: playwright.config.js
    • Test directory: tests/e2e/
    • Example test: tests/e2e/example.spec.js
    • Supports Chromium, Firefox, WebKit
  • Puppeteer - Browser automation
    • Added as dependency for custom automation needs

6. Internationalization (i18n)

  • WP-CLI integration for makepot
    • Command: npm run makepot
    • Generates: languages/plugin-textdomain.pot
    • Integrated into release workflow

7. GitHub Actions Workflows

CI/CD Pipeline (.github/workflows/ci.yml)

Runs on every push and PR:

  • ✓ PHP linting and analysis (PHPCS, PHPStan, Rector)
  • ✓ JavaScript/CSS linting (ESLint, Stylelint)
  • ✓ PHP unit tests on multiple versions (8.2, 8.3, 8.4)
  • ✓ JavaScript unit tests (Jest)
  • ✓ Asset build verification

Release Workflow (.github/workflows/release.yml)

Triggered by version tags (v*):

  • ✓ Automated version bumping in all files
  • ✓ PHP dependency installation (production only)
  • ✓ Node dependency installation
  • ✓ Asset building and minification
  • ✓ POT file generation
  • ✓ Distribution ZIP creation (respects .distignore)
  • ✓ Checksum generation (MD5, SHA256)
  • ✓ GitHub release creation with artifacts

Security Workflow (.github/workflows/security.yml)

Weekly and on-demand:

  • ✓ Composer dependency audit
  • ✓ npm dependency audit
  • ✓ CodeQL security analysis
  • ✓ Secret scanning (Gitleaks)
  • ✓ Security best practices checks
  • ✓ File permissions validation

Accessibility Workflow (.github/workflows/accessibility.yml)

On PR and on-demand:

  • ✓ Accessibility testing with axe-core integration
  • ✓ HTML validation
  • ✓ WCAG 2.1 compliance checks
  • ✓ Report generation and artifact upload

Code Quality Workflow (.github/workflows/code-quality.yml)

On PR and push:

  • ✓ HTML validation for templates
  • ✓ CSS validation and browser compatibility checks
  • ✓ JavaScript validation and complexity analysis
  • ✓ Code quality metrics and reporting

8. Documentation

  • BUILD.md - Comprehensive build and development guide
  • TOOLING.md - Detailed tooling configuration guide
  • README.md - Updated main documentation
  • docs/README.md - Documentation index
  • CHANGELOG.md - Changelog with semantic versioning

9. Configuration Files

  • .distignore - Files to exclude from releases
  • example.env - Environment variables template
  • .gitignore - Updated with build artifacts
  • rector.php - Rector configuration
  • playwright.config.js - Playwright configuration

10. Example Files

  • src/js/admin.js - Example JavaScript file
  • src/css/admin.css - Example CSS file
  • src/js/__tests__/example.test.js - Example Jest test
  • tests/e2e/example.spec.js - Example Playwright test

📦 Package Management

Composer Dependencies (PHP)

{
    "require": {
        "php": "^8.2",
        "composer/installers": "^2.3"
    },
    "require-dev": {
        "phpstan/phpstan": "^1",
        "phpunit/phpunit": "^10",
        "rector/rector": "^1.2",
        "squizlabs/php_codesniffer": "^3",
        "wp-coding-standards/wpcs": "^3"
    }
}

npm Dependencies (JavaScript)

{
    "devDependencies": {
        "@playwright/test": "^1.49.1",
        "@wordpress/i18n": "^5.15.0",
        "clean-css-cli": "^5.6.3",
        "eslint": "^9.39.2",
        "jest": "^30.2.0",
        "puppeteer": "^24.2.0",
        "stylelint": "^16.26.1",
        "terser": "^5.39.2"
    }
}

🎯 Linting Scope

IMPORTANT: All linting tools are configured to only scan:

  • Root-level PHP files (e.g., sparxstar-plugin-entry.php)
  • src/ directory

Excluded from linting:

  • vendor/ - Third-party PHP code
  • node_modules/ - Third-party JavaScript
  • assets/ - Generated/minified files
  • tests/ - Test files (separate standards)
  • data/, examples/, schemas/ - Non-code directories
  • All .min.js and .min.css files

🚀 Quick Start Commands

Initial Setup

composer install
npm install
npx playwright install  # Install browsers for E2E testing

Development

# Lint all code
npm run lint
composer run lint:php

# Auto-fix issues
npm run format
composer run fix:php

# Run tests
npm test
composer run test:php
npm run test:e2e

# Build assets
npm run build

Release

# Create and push version tag
git tag -a v1.2.3 -m "Release 1.2.3"
git push origin v1.2.3

📋 Standards Compliance

PHP Standards

  • ✓ PSR-4 autoloading
  • ✓ PSR-12 coding style (where not conflicting with WordPress)
  • ✓ WordPress VIP standards (primary)
  • ✓ WordPress Coding Standards
  • ✓ PHP 8.2+ type declarations

JavaScript Standards

  • ✓ ES2021 (ES12) features
  • ✓ ESLint recommended rules
  • ✓ Prettier formatting
  • ✓ JSDoc documentation

CSS Standards

  • ✓ Stylelint standard config
  • ✓ Modern CSS features
  • ✓ Mobile-first responsive design

🔒 Security Features

  • ✓ Automated dependency audits
  • ✓ CodeQL security scanning
  • ✓ Secret scanning with Gitleaks
  • ✓ WordPress security best practices
  • ✓ File permissions validation
  • ✓ Weekly security checks

♿ Accessibility Features

  • ✓ Automated accessibility testing
  • ✓ axe-core integration
  • ✓ HTML validation
  • ✓ WCAG 2.1 compliance checks

📊 Code Quality

  • ✓ Multiple linting layers (PHPCS, PHPStan, ESLint, Stylelint)
  • ✓ Static analysis with PHPStan (level 5)
  • ✓ Automated refactoring with Rector
  • ✓ Code quality metrics
  • ✓ Pre-commit hooks with Husky

🧪 Testing Coverage

  • ✓ PHP unit tests (PHPUnit)
  • ✓ JavaScript unit tests (Jest)
  • ✓ E2E browser tests (Playwright)
  • ✓ Multiple PHP versions (8.2, 8.3, 8.4)
  • ✓ Multiple browsers (Chromium, Firefox, WebKit)

📝 Next Steps

  1. Customize the plugin:

    • Update plugin header in sparxstar-plugin-entry.php
    • Update namespace throughout codebase
    • Update text domain in phpcs.xml.dist
    • Update package.json and composer.json metadata
  2. Install dependencies:

    composer install
    npm install
  3. Start developing:

    • Add your code to src/ directories
    • Build assets with npm run build
    • Run tests with npm test and composer run test:php
  4. Before first commit:

    • Run all linters: npm run lint && composer run lint:php
    • Run all tests: npm test && composer run test:php
    • Build assets: npm run build
  5. Create first release:

    • Update CHANGELOG.md
    • Create version tag: git tag -a v1.0.0 -m "Initial release"
    • Push tag: git push origin v1.0.0

📚 Additional Resources

🆘 Support


Template Version: 1.0.0
Last Updated: January 22, 2026
Maintained by: Starisian Technologies