Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Directories
/.git
/.github
/.vscode
/.idea
/bin
/node_modules
/tests
/build

# Root Files
.distignore
.editorconfig
.eslintignore
.eslintrc*
.gitignore
.stylelintrc*
phpunit.xml
tsconfig.json
webpack.config.js
*.log
jest.config.js

# Development Files
*.map
*.ts
!*.d.ts
.travis.yml
.phpcs.xml.dist
composer.json
composer.lock
package.json
package-lock.json
phpcs.xml
README.md
CONTRIBUTING.md
*.zip
*.tar.gz

# System Files
.DS_Store
Thumbs.db
34 changes: 34 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
settings: {
react: {
version: 'detect',
},
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {
// Customize rules as needed
'no-console': ['warn', { allow: ['warn', 'error'] }],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
// Add WordPress-specific rules here if needed
},
env: {
browser: true,
node: true,
es6: true,
jest: true,
},
};
127 changes: 127 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Release WordPress Plugin

on:
push:
tags:
- 'v*.*.*'

jobs:
build:
name: Build and Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: mbstring, intl, curl
tools: composer, wp-cli

- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Install PHP dependencies
run: composer install --no-dev --optimize-autoloader

- name: Install Node dependencies
run: npm ci

- name: Verify version matches
run: |
WP_VERSION=$(grep -m 1 "Version: " wp-multisite-waas.php | awk -F' ' '{print $2}')
README_VERSION=$(grep -m 1 "Stable tag: " readme.txt | awk -F' ' '{print $3}')
PKG_VERSION=$(node -p "require('./package.json').version")

if [ "$WP_VERSION" != "${{ env.VERSION }}" ] || [ "$README_VERSION" != "${{ env.VERSION }}" ] || [ "$PKG_VERSION" != "${{ env.VERSION }}" ]; then
echo "Error: Version mismatch detected!"
echo "Tag version: ${{ env.VERSION }}"
echo "Plugin version: $WP_VERSION"
echo "readme.txt version: $README_VERSION"
echo "package.json version: $PKG_VERSION"
exit 1
fi

echo "All version numbers match: ${{ env.VERSION }}"

- name: Choose build method
id: build_method
run: |
# Check if we have TypeScript files
if ls assets/js/*.ts &> /dev/null; then
echo "USE_MODERN_BUILD=true" >> $GITHUB_ENV
echo "Using modern build process with TypeScript"
else
echo "USE_MODERN_BUILD=false" >> $GITHUB_ENV
echo "Using compatibility build process"
fi

- name: Modern Build - Generate translation files
if: env.USE_MODERN_BUILD == 'true'
run: npm run translations

- name: Modern Build - Process CSS and JS
if: env.USE_MODERN_BUILD == 'true'
run: |
npm run css
npm run js

- name: Modern Build - Create ZIP file
if: env.USE_MODERN_BUILD == 'true'
run: npm run zip

- name: Compatibility Build - Run build process
if: env.USE_MODERN_BUILD == 'false'
run: npm run build:compat

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: |
build/wp-multisite-waas-${{ env.VERSION }}.zip
wp-multisite-waas.zip
name: WP Multisite WaaS ${{ env.VERSION }}
draft: false
prerelease: false
body: |
# WP Multisite WaaS ${{ env.VERSION }}

## What's Changed

For a complete list of changes, please refer to the [changelog](https://github.com/wpallstars/wp-multisite-waas/blob/main/readme.txt).

## Installation

1. Download the ZIP file from this release
2. Upload and activate the plugin in your WordPress Network installation
3. Follow the setup wizard to configure the plugin

## Notes

- Compatible with WordPress 5.3+
- Requires PHP 7.4.30+
- Always backup your site before upgrading

- name: Send notification on success
if: success()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: releases
SLACK_COLOR: good
SLACK_MESSAGE: "🚀 WP Multisite WaaS ${{ env.VERSION }} has been released! https://github.com/wpallstars/wp-multisite-waas/releases"
SLACK_TITLE: New Release
SLACK_USERNAME: GitHub
SLACK_ICON_EMOJI: ":github:"
45 changes: 45 additions & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
module.exports = {
extends: [
'stylelint-config-standard-scss',
],
rules: {
// WordPress-specific CSS rules
'selector-class-pattern': null, // Allow WordPress class naming convention
'no-descending-specificity': null,
'at-rule-no-unknown': [
true,
{
ignoreAtRules: [
'extend',
'at-root',
'debug',
'warn',
'error',
'if',
'else',
'for',
'each',
'while',
'mixin',
'include',
'content',
'return',
'function',
'tailwind',
'apply',
'responsive',
'variants',
'screen',
],
},
],
// Other customizations
'string-quotes': 'single',
'declaration-block-trailing-semicolon': 'always',
},
ignoreFiles: [
'dist/**/*.css',
'node_modules/**/*',
'vendor/**/*',
],
};
53 changes: 53 additions & 0 deletions BUILD-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Build Process Documentation

This document outlines the different build approaches available in the WP Multisite WaaS plugin and how to use them.

## Modern Build Process

The modern build process uses TypeScript, SASS, and modern JavaScript tooling to compile and optimize assets.

### Commands

- `npm run build` - Main build command that runs clean, translations, CSS, and JS processing
- `npm run css` - Compiles SASS to CSS and minifies it
- `npm run js` - Compiles TypeScript to JavaScript and minifies it
- `npm run translations` - Generates translation files
- `npm run lint` - Runs linting for PHP, JS, and CSS
- `npm run test` - Runs Jest tests
- `npm run prepare-release` - Runs build, lint, and test for release preparation
- `npm run zip` - Creates a ZIP file for distribution

### When to use

Use this build process during active development when working with TypeScript files and modern tooling.

## Compatibility Build Process

The compatibility build process is simpler and uses more basic tools like uglify-js and cleancss for direct minification without compilation steps.

### Commands

- `npm run build:compat` - Main compatibility build command
- `npm run build:dev:compat` - Development version of the compatibility build
- `npm run uglify` - Minifies JavaScript files
- `npm run cleancss:compat` - Minifies CSS files
- `npm run makepot` - Generates translation files
- `npm run archive` - Creates a ZIP file using composer

### When to use

Use this build process when working with the plugin-check branch or when you need a simpler build process without TypeScript compilation.

## GitHub Actions Workflow

The GitHub Actions workflow is designed to automatically detect which build process to use based on the presence of TypeScript files. If TypeScript files are detected, it uses the modern build process; otherwise, it falls back to the compatibility build process.

## Merging branches

When merging branches that use different build approaches:

1. Keep both sets of build scripts in package.json
2. The GitHub Actions workflow will automatically detect and use the appropriate build process
3. For local development, choose the build process that matches your current work

This dual approach ensures compatibility with both the modern toolchain and the simpler plugin-check approach.
Loading