Update WordPress Playground integration to use npx

This commit is contained in:
2025-04-21 22:38:10 +01:00
parent d6b2349af8
commit 4d74fe35dc

11
bin/setup-test-env.sh Normal file → Executable file
View File

@@ -26,9 +26,10 @@ install_wp_env() {
# Function to install wp-playground if needed # Function to install wp-playground if needed
install_wp_playground() { install_wp_playground() {
if ! command_exists wp-playground; then # Check if we have a local installation
echo "wp-playground is not installed. Installing..." if [ ! -d "node_modules/@wp-playground" ]; then
npm install -g @wordpress/playground-tools echo "WordPress Playground is not installed locally. Installing..."
npm install --save-dev @wp-playground/client @wp-playground/blueprints
fi fi
} }
@@ -149,7 +150,7 @@ EOF
# Start WordPress Playground # Start WordPress Playground
echo "Starting WordPress Playground..." echo "Starting WordPress Playground..."
wp-playground start --blueprint playground/blueprint.json --port 8888 & npx @wp-playground/client start --blueprint playground/blueprint.json --port 8888 &
# Wait for WordPress Playground to be ready # Wait for WordPress Playground to be ready
echo "Waiting for WordPress Playground to be ready..." echo "Waiting for WordPress Playground to be ready..."
@@ -242,7 +243,7 @@ EOF
# Start WordPress Playground # Start WordPress Playground
echo "Starting WordPress Playground..." echo "Starting WordPress Playground..."
wp-playground start --blueprint playground/multisite-blueprint.json --port 8888 & npx @wp-playground/client start --blueprint playground/multisite-blueprint.json --port 8888 &
# Wait for WordPress Playground to be ready # Wait for WordPress Playground to be ready
echo "Waiting for WordPress Playground to be ready..." echo "Waiting for WordPress Playground to be ready..."