Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
cache: "npm"

- name: Install dependencies
run: npm ci
run: npm install

- name: Setup PHP with Cached Composer
uses: ./.github/actions/setup-php-composer
Expand Down
3 changes: 1 addition & 2 deletions plugins/hwp-previews/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@

-----

[![Version](https://img.shields.io/badge/version-0.0.1-beta)]()
[![Version](https://img.shields.io/github/v/release/wpengine/hwptoolkit?include_prereleases&label=previews&filter=%40wpengine%2Fhwp-previews-wordpress-plugin-*)](https://github.com/wpengine/hwptoolkit/releases)
[![License](https://img.shields.io/badge/license-GPLv2%2B-green)]()
![GitHub forks](https://img.shields.io/github/forks/wpengine/hwptoolkit?style=social)
![GitHub stars](https://img.shields.io/github/stars/wpengine/hwptoolkit?style=social)
[![Testing Integration](https://img.shields.io/github/check-runs/wpengine/hwptoolkit/main?checkName=hwp-previews%20codeception%20tests&label=Automated%20Tests)](https://github.com/wpengine/hwptoolkit/actions)
[![Code Coverage](https://img.shields.io/badge/coverage-%3E95%25-brightgreen?label=Code%20Coverage)](https://github.com/wpengine/hwptoolkit/actions)
[![Code Quality](https://img.shields.io/github/check-runs/wpengine/hwptoolkit/main?checkName=hwp-previews%20php%20code%20quality%20checks&label=Code%20Quality%20Checks)](https://github.com/wpengine/hwptoolkit/actions)
[![End-to-End Tests](https://img.shields.io/github/check-runs/wpengine/hwptoolkit/main?checkName=hwp-previews%20Playwright%20E2E%20Tests&label=End-to-End%20Tests)](https://github.com/wpengine/hwptoolkit/actions)

-----


Expand Down
59 changes: 59 additions & 0 deletions plugins/hwp-previews/bin/sync-package-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

# Exit on any error
set -e

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

# Get the version from package.json
VERSION=$(node -p "require('./package.json').version")

if [ -z "$VERSION" ]; then
echo -e "${RED}Error: Could not read version from package.json${NC}"
exit 1
fi

echo -e "${YELLOW}Syncing version ${VERSION} across all files...${NC}"

# Update composer.json
if [ -f "composer.json" ]; then
echo "Updating composer.json..."
# Use sed to preserve original formatting (tabs/spaces)
sed -i.bak -E "s/(\"version\":[[:space:]]*\")[^\"]*(\",?)/\1$VERSION\2/" composer.json && rm composer.json.bak
echo -e "${GREEN}✓ Updated composer.json${NC}"
else
echo -e "${YELLOW}⚠ composer.json not found${NC}"
fi

# Update readme.txt (WordPress style)
if [ -f "readme.txt" ]; then
echo "Updating readme.txt..."
sed -i.bak -E "s/(Stable tag:|Version:)[[:space:]]*[0-9]+\.[0-9]+\.[0-9]+/\1 $VERSION/g" readme.txt && rm readme.txt.bak
echo -e "${GREEN}✓ Updated readme.txt${NC}"
else
echo -e "${YELLOW}⚠ readme.txt not found${NC}"
fi

# Update hwp-previews.php
PLUGIN_FILE="hwp-previews.php"

if [ -f "$PLUGIN_FILE" ]; then
echo "Updating main plugin file: $PLUGIN_FILE..."

# Update WordPress plugin header version (handles beta versions)
sed -i.bak -E "s/(\* Version:[[:space:]]*)[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?/\1$VERSION/g" "$PLUGIN_FILE" && rm "${PLUGIN_FILE}.bak"

# Update HWP_PREVIEWS_VERSION define statement
sed -i.bak -E "s/(define\([[:space:]]*['\"]HWP_PREVIEWS_VERSION['\"][[:space:]]*,[[:space:]]*['\"])[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?(['\"][[:space:]]*\))/\1$VERSION\3/g" "$PLUGIN_FILE" && rm "${PLUGIN_FILE}.bak"

echo -e "${GREEN}✓ Updated $PLUGIN_FILE${NC}"
else
echo -e "${YELLOW}⚠ $PLUGIN_FILE not found${NC}"
fi

echo -e "${GREEN}✅ Version sync complete! All files updated to version ${VERSION}${NC}"
echo -e "${YELLOW}Files will be staged by the workflow's 'git add .' command${NC}"``
57 changes: 28 additions & 29 deletions plugins/hwp-previews/composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "hwp/previews",
"name": "wpengine/previews",
"type": "wordpress-plugin",
"description": "A WordPress plugin for headless previews.",
"license": "GPL-2.0",
"version": "0.0.1-beta",
"version": "0.0.4",
"authors": [
{
"name": "WP Engine Headless OSS Development Team",
Expand Down Expand Up @@ -72,36 +72,35 @@
"archive": {
"name": "hwp-previews",
"exclude": [
"/.*",
"bin",
"docker",
"docs",
"phpstan",
"phpcs",
"plugin-build",
"tests",
"!vendor",
"!vendor-prefixed",
"/docker-compose.yml",
"/phpstan.neon.dist",
"/psalm.xml",
"/phpcs.xml",
"/.DS_Store",
"/.docker/",
"/.env.dist",
"/ACTIONS_AND_FILTERS.md",
"/phpcs-cache.json",
"/TESTING.md",
"/Thumbs.db",
"/artifacts",
"/auth.json",
"/.DS_Store",
".docker/",
".env.dist",
"c3.php",
"codeception.dist.yml",
"tests",
"artifacts",
"package.json",
"package-lock.json",
"node_modules/",
"/TESTING.md",
"/screenshots"
"/bin",
"/c3.php",
"/codeception.dist.yml",
"/docker",
"/docker-compose.yml",
"/docs",
"/examples",
"/node_modules",
"/package-lock.json",
"/package.json",
"/phpcs",
"/phpcs-cache.json",
"/phpcs.xml",
"/phpstan",
"/phpstan.neon.dist",
"/plugin-build",
"/psalm.xml",
"/screenshots",
"/tests",
"!vendor",
"!vendor-prefixed"
]
},
"autoload": {
Expand Down
4 changes: 2 additions & 2 deletions plugins/hwp-previews/hwp-previews.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Author: WPEngine Headless OSS Team
* Author URI: https://github.com/wpengine
* Update URI: https://github.com/wpengine/hwptoolkit
* Version: 0.0.1-beta
* Version: 0.0.4
* Text Domain: hwp-previews
* Domain Path: /languages
* Requires at least: 6.0
Expand Down Expand Up @@ -67,7 +67,7 @@ function hwp_previews_init(): void {
*/
function hwp_previews_constants(): void {
if ( ! defined( 'HWP_PREVIEWS_VERSION' ) ) {
define( 'HWP_PREVIEWS_VERSION', '0.0.1-beta' );
define( 'HWP_PREVIEWS_VERSION', '0.0.4' );
}

if ( ! defined( 'HWP_PREVIEWS_PLUGIN_DIR' ) ) {
Expand Down
3 changes: 2 additions & 1 deletion plugins/hwp-previews/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"test": "echo \"Error: no test specified\" && exit 1",
"test:e2e": "wp-scripts test-playwright --config tests/e2e/playwright.config.js",
"test:e2e:debug": "npm run test:e2e -- --debug",
"wp-env": "wp-env"
"wp-env": "wp-env",
"version": "./scripts/sync-versions.sh"
},
"keywords": [],
"author": "wpengine",
Expand Down
2 changes: 1 addition & 1 deletion plugins/hwp-previews/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: GraphQL, Headless, Previews, WPGraphQL, React, Rest
Requires at least: 6.0
Tested up to: 6.8.1
Requires PHP: 7.4
Stable tag: 0.0.1-beta
Stable tag: 0.0.4
License: GPL-2.0
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down
59 changes: 59 additions & 0 deletions plugins/wp-graphql-webhooks/bin/sync-package-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

# Exit on any error
set -e

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

# Get the version from package.json
VERSION=$(node -p "require('./package.json').version")

if [ -z "$VERSION" ]; then
echo -e "${RED}Error: Could not read version from package.json${NC}"
exit 1
fi

echo -e "${YELLOW}Syncing version ${VERSION} across all files...${NC}"

# Update composer.json
if [ -f "composer.json" ]; then
echo "Updating composer.json..."
# Use sed to preserve original formatting (tabs/spaces)
sed -i.bak -E "s/(\"version\":[[:space:]]*\")[^\"]*(\",?)/\1$VERSION\2/" composer.json && rm composer.json.bak
echo -e "${GREEN}✓ Updated composer.json${NC}"
else
echo -e "${YELLOW}⚠ composer.json not found${NC}"
fi

# Update readme.txt (WordPress style)
if [ -f "readme.txt" ]; then
echo "Updating readme.txt..."
sed -i.bak -E "s/(Stable tag:|Version:)[[:space:]]*[0-9]+\.[0-9]+\.[0-9]+/\1 $VERSION/g" readme.txt && rm readme.txt.bak
echo -e "${GREEN}✓ Updated readme.txt${NC}"
else
echo -e "${YELLOW}⚠ readme.txt not found${NC}"
fi

# Update wp-graphql-webhooks.php
PLUGIN_FILE="wp-graphql-webhooks.php"

if [ -f "$PLUGIN_FILE" ]; then
echo "Updating main plugin file: $PLUGIN_FILE..."

# Update WordPress plugin header version (handles beta versions)
sed -i.bak -E "s/(\* Version:[[:space:]]*)[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?/\1$VERSION/g" "$PLUGIN_FILE" && rm "${PLUGIN_FILE}.bak"

# Update WPGRAPHQL_WEBHOOKS_VERSION define statement
sed -i.bak -E "s/(define\([[:space:]]*['\"]WPGRAPHQL_WEBHOOKS_VERSION['\"][[:space:]]*,[[:space:]]*['\"])[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?(['\"][[:space:]]*\))/\1$VERSION\3/g" "$PLUGIN_FILE" && rm "${PLUGIN_FILE}.bak"

echo -e "${GREEN}✓ Updated $PLUGIN_FILE${NC}"
else
echo -e "${YELLOW}⚠ $PLUGIN_FILE not found${NC}"
fi

echo -e "${GREEN}✅ Version sync complete! All files updated to version ${VERSION}${NC}"
echo -e "${YELLOW}Files will be staged by the workflow's 'git add .' command${NC}"``
4 changes: 3 additions & 1 deletion plugins/wp-graphql-webhooks/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "wpengine/wp-graphql-webhooks",
"description": "Headless webhooks for WPGraphQL",
"type": "library",
"license": "GPL-3.0-or-later",
"license": "GPL-2.0",
"version": "0.0.2",
"authors": [
{
"name": "WP Engine Headless OSS Development Team",
Expand Down Expand Up @@ -101,6 +102,7 @@
"/bin",
"/wp-graphql-webhooks",
"/composer.lock",
"/examples",
"/phpstan.neon.dist",
"/README.md"
]
Expand Down
5 changes: 3 additions & 2 deletions plugins/wp-graphql-webhooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"private": true,
"description": "Webhooks solution for WordPress",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"version": "./scripts/sync-versions.sh"
},
"keywords": [],
"author": "wpengine",
Expand All @@ -16,4 +17,4 @@
"@wordpress/jest-console": "^8.26.0",
"@wordpress/scripts": "^30.19.0"
}
}
}
2 changes: 1 addition & 1 deletion plugins/wp-graphql-webhooks/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Requires at least: 6.0
Tested up to: 6.8.1
Requires PHP: 7.4
Requires WPGraphQL: 1.8.0
Stable tag: 0.0.1
Stable tag: 0.0.2
License: GPL-3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down
4 changes: 2 additions & 2 deletions plugins/wp-graphql-webhooks/wp-graphql-webhooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Author: WPEngine OSS Team
* Author URI: https://github.com/wpengine
* Update URI: https://github.com/wpengine/hwptoolkit
* Version: 0.0.1
* Version: 0.0.2
* Text Domain: wp-graphql-webhooks
* Domain Path: /languages
* Requires at least: 6.0
Expand Down Expand Up @@ -60,7 +60,7 @@
function graphql_webhooks_constants(): void {
// Plugin version.
if ( ! defined( 'WPGRAPHQL_WEBHOOKS_VERSION' ) ) {
define( 'WPGRAPHQL_WEBHOOKS_VERSION', '0.0.1' );
define( 'WPGRAPHQL_WEBHOOKS_VERSION', '0.0.2' );
}

// Plugin Folder Path.
Expand Down
Loading