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
59 changes: 0 additions & 59 deletions plugins/hwp-documents/bin/sync-package-version.sh

This file was deleted.

2 changes: 1 addition & 1 deletion plugins/hwp-documents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"test:e2e": "wp-scripts test-playwright --config tests/e2e/playwright.config.js",
"test:e2e:debug": "npm run test:e2e -- --debug",
"wp-env": "wp-env",
"version": "./bin/sync-package-version.sh"
"version": "../../scripts/sync-plugin-version.sh"
},
"keywords": [
"wordpress",
Expand Down
59 changes: 0 additions & 59 deletions plugins/hwp-previews/bin/sync-package-version.sh

This file was deleted.

2 changes: 1 addition & 1 deletion plugins/hwp-previews/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"test:e2e": "wp-scripts test-playwright --config tests/e2e/playwright.config.js",
"test:e2e:debug": "npm run test:e2e -- --debug",
"wp-env": "wp-env",
"version": "./bin/sync-package-version.sh"
"version": "../../scripts/sync-plugin-version.sh"
},
"keywords": [
"wordpress",
Expand Down
2 changes: 1 addition & 1 deletion plugins/wpgraphql-debug-extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Debug Extensions for WordPress",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"version": "./bin/sync-package-version.sh"
"version": "../../scripts/sync-plugin-version.sh"
},
"keywords": [],
"author": "wpengine",
Expand Down
59 changes: 0 additions & 59 deletions plugins/wpgraphql-logging/bin/sync-package-version.sh

This file was deleted.

2 changes: 1 addition & 1 deletion plugins/wpgraphql-logging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"test:e2e": "wp-scripts test-playwright --config tests/e2e/playwright.config.js",
"test:e2e:debug": "npm run test:e2e -- --debug",
"wp-env": "wp-env",
"version": "./bin/sync-package-version.sh"
"version": "../../scripts/sync-plugin-version.sh"
},
"keywords": [],
"author": "wpengine",
Expand Down
59 changes: 0 additions & 59 deletions plugins/wpgraphql-webhooks/bin/sync-package-version.sh

This file was deleted.

2 changes: 1 addition & 1 deletion plugins/wpgraphql-webhooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Webhooks solution for WordPress",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"version": "./bin/sync-package-version.sh"
"version": "../../scripts/sync-plugin-version.sh"
},
"keywords": [],
"author": "wpengine",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/bash

# Syncs a plugin's package.json version into composer.json, readme.txt, the plugin header,
# and the <SLUG>_VERSION constant.
#
# Run it from the plugin folder (it's each plugin's `npm run version` script), or pass the
# plugin folder as the first argument.

# Exit on any error
set -e

Expand All @@ -9,6 +15,13 @@ GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

cd "${1:-.}"

SLUG=$(basename "$PWD")
PLUGIN_FILE="$SLUG.php"
# e.g. hwp-previews -> HWP_PREVIEWS_VERSION
VERSION_CONSTANT="$(echo "$SLUG" | tr '[:lower:]-' '[:upper:]_')_VERSION"

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

Expand All @@ -17,7 +30,7 @@ if [ -z "$VERSION" ]; then
exit 1
fi

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

# Update composer.json
if [ -f "composer.json" ]; then
Expand All @@ -38,22 +51,19 @@ else
echo -e "${YELLOW}⚠ readme.txt not found${NC}"
fi

# Update wpgraphql-debug-extensions.php
PLUGIN_FILE="wpgraphql-debug-extensions.php"

# Update the main plugin file
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_DEBUG_EXTENSIONS_VERSION define statement
sed -i.bak -E "s/(define\([[:space:]]*['\"]WPGRAPHQL_DEBUG_EXTENSIONS_VERSION['\"][[:space:]]*,[[:space:]]*['\"])[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?(['\"][[:space:]]*\))/\1$VERSION\3/g" "$PLUGIN_FILE" && rm "${PLUGIN_FILE}.bak"
# Update the version constant's define statement
sed -i.bak -E "s/(define\([[:space:]]*['\"]${VERSION_CONSTANT}['\"][[: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}"``
Loading