Skip to content
Open
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
25 changes: 10 additions & 15 deletions lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,43 +13,38 @@ pre-push:
parallel: true
jobs:
- name: phpcs
files: git diff --name-only HEAD @{push}
run: ./vendor/bin/phpcs
run: ./vendor/bin/phpcs {push_files}
glob:
- ".phpstorm.meta.php"
- "local-config-sample.php"
- "wp-config.php"
- "wp-config-environment.php"
- "wp-content/themes/core/*.php"
- "wp-content/plugins/core/*.php"
- "wp-content/themes/core/**/*.php"
- "wp-content/plugins/core/**/*.php"
- name: phpstan
run: ./vendor/bin/phpstan analyse --memory-limit=-1
glob:
- ".phpstorm.meta.php"
- "local-config-sample.php"
- "wp-config.php"
- "wp-config-environment.php"
- "wp-content/themes/core/*.php"
- "wp-content/plugins/core/*.php"
- "wp-content/themes/core/**/*.php"
- "wp-content/plugins/core/**/*.php"
- name: lintcss
files: git diff --name-only HEAD @{push}
run: ./node_modules/.bin/wp-scripts lint-style
run: ./node_modules/.bin/wp-scripts lint-style {push_files}
glob:
- "wp-content/themes/core/*.pcss"
- "wp-content/themes/core/**/*.pcss"
- name: lintjs
files: git diff --name-only HEAD @{push}
run: ./node_modules/.bin/wp-scripts lint-js
run: ./node_modules/.bin/wp-scripts lint-js {push_files}
glob:
- "wp-content/themes/core/*.js"
- "wp-content/themes/core/**/*.js"
- name: lintconfigs
files: git diff --name-only HEAD @{push}
run: ./node_modules/.bin/wp-scripts lint-js
run: ./node_modules/.bin/wp-scripts lint-js {push_files}
glob:
- "browsersync.config.js"
- "postcss.config.js"
- "webpack.config.js"
- name: lintpkgjson
files: git diff --name-only HEAD @{push}
run: ./node_modules/.bin/wp-scripts lint-pkg-json
glob:
- "package.json"
Expand Down
34 changes: 34 additions & 0 deletions wp-content/plugins/pattern-sync/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Pattern Sync

Sync registered block patterns between WordPress installations via REST API and Application Passwords.

## Requirements

- PHP 8.2+
- WordPress 5.6+ (Application Passwords)
- Composer (for installation)

## Installation

1. Install dependencies: `composer install` in the plugin directory.
2. Activate the plugin in WordPress.
3. Go to **Tools → Pattern Sync** to add a connection and sync patterns.

## Usage

1. **Add a connection**: Enter a connection name, the remote site URL, WordPress username, and an Application Password (created under Users → Profile → Application Passwords on the remote site).
2. **Test connection**: Use the "Test connection" button to verify the remote site has Pattern Sync and accepts your credentials.
3. **Sync patterns**: Click "Sync with this site" on a connection. Select patterns from the remote or local list and use "Pull selected to this site" or "Push selected to remote".
4. **Sync Log**: View recent sync runs under "Sync Log".

## REST API

The plugin registers `pattern-sync/v1` REST routes (authenticated via Application Passwords):

- `GET /wp-json/pattern-sync/v1/patterns` – List registered block patterns
- `GET /wp-json/pattern-sync/v1/pattern-categories` – List pattern categories
- `POST /wp-json/pattern-sync/v1/patterns` – Store a pattern (used when another site pushes to this one)

## License

GPL-2.0-or-later
18 changes: 18 additions & 0 deletions wp-content/plugins/pattern-sync/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "pattern-sync/pattern-sync",
"description": "Sync registered block patterns between WordPress installations.",
"type": "wordpress-plugin",
"license": "GPL-2.0-or-later",
"require": {
"php": ">=8.2",
"php-di/php-di": "^7.1"
},
"autoload": {
"psr-4": {
"PatternSync\\": "src/"
}
},
"config": {
"sort-packages": true
}
}
263 changes: 263 additions & 0 deletions wp-content/plugins/pattern-sync/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading