From 6cf60f9942fd343fa8826a9780e8809aa5ffd5b8 Mon Sep 17 00:00:00 2001 From: Jamie Bradley Date: Thu, 4 Jun 2026 13:19:56 +0200 Subject: [PATCH 1/5] Browse Happy Environment I have created a folder with wp-env environment configuration for the Browse Happy website (https://browsehappy.com). As part of this change I have also included an after start script to preset the theme and change the title/description in the environment. --- environments/README.md | 12 +++++++ environments/browsehappy/.wp-env.json | 12 +++++++ environments/browsehappy/bin/after-start.sh | 16 ++++++++++ environments/package.json | 35 +++++++++++---------- 4 files changed, 58 insertions(+), 17 deletions(-) create mode 100644 environments/browsehappy/.wp-env.json create mode 100644 environments/browsehappy/bin/after-start.sh diff --git a/environments/README.md b/environments/README.md index 9c4ad6279c..3a322423db 100644 --- a/environments/README.md +++ b/environments/README.md @@ -71,6 +71,18 @@ npm run jobs:env start npm run jobs:env -- run cli -- wp ``` +### Browse Happy + +A local instance of [browsehappy.com](browsehappy.com) with the theme. + +**Start:** + +```bash +npm run browsehappy:env start +``` + +**Access:** `http://localhost:8888` + ### Handbook (in-plugin) The Handbook plugin has its own `.wp-env.json` in `wordpress.org/public_html/wp-content/plugins/handbook/`. diff --git a/environments/browsehappy/.wp-env.json b/environments/browsehappy/.wp-env.json new file mode 100644 index 0000000000..431d17a27d --- /dev/null +++ b/environments/browsehappy/.wp-env.json @@ -0,0 +1,12 @@ +{ + "core": "WordPress/WordPress#master", + "phpVersion": "8.4", + "testsEnvironment": false, + "themes": ["../browsehappy.com/public_html"], + "lifecycleScripts": { + "afterStart": "bash browsehappy/bin/after-start.sh" + }, + "config": { + "WP_DEBUG": true + } +} diff --git a/environments/browsehappy/bin/after-start.sh b/environments/browsehappy/bin/after-start.sh new file mode 100644 index 0000000000..0fca290936 --- /dev/null +++ b/environments/browsehappy/bin/after-start.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# +# Runs after wp-env start. Sets up permalinks, creates pages, job categories, and sample jobs. +# + +CONFIG="--config browsehappy/.wp-env.json" +WP="npx wp-env $CONFIG run cli --" + +# Set site title and description to match the public site. +$WP wp option update blogname 'Browse Happy' +$WP wp option update blogdescription 'Online. Worry free. Upgrade your browser today!' + +# Activate the browsehappy theme. +$WP wp theme activate public_html + +echo "Browse Happy environment ready!" \ No newline at end of file diff --git a/environments/package.json b/environments/package.json index de8d95639c..5ba45baf0c 100644 --- a/environments/package.json +++ b/environments/package.json @@ -1,19 +1,20 @@ { - "name": "wporg-environments", - "private": true, - "description": "Local development environments for WordPress.org", - "engines": { - "node": ">=20" - }, - "scripts": { - "plugins:env": "wp-env --config plugin-directory/.wp-env.json", - "plugins:import": "npm run plugins:env -- run cli -- php wp-content/plugins/plugin-directory/bin/import-plugin.php --create --plugin", - "plugins:refresh": "npm run plugins:env -- run cli -- wp option delete wporg_env_imported && npm run plugins:env -- run cli wp eval-file wp-content/env-bin/import-plugins.php", - "plugins:test:env": "wp-env --config plugin-directory/.wp-env.test.json", - "plugins:test": "npm run plugins:test:env -- start && npm run plugins:test:env -- run tests-cli --env-cwd=wp-content/plugins/plugin-directory phpunit", - "jobs:env": "wp-env --config jobs/.wp-env.json" - }, - "devDependencies": { - "@wordpress/env": "^11" - } + "name": "wporg-environments", + "private": true, + "description": "Local development environments for WordPress.org", + "engines": { + "node": ">=20" + }, + "scripts": { + "plugins:env": "wp-env --config plugin-directory/.wp-env.json", + "plugins:import": "npm run plugins:env -- run cli -- php wp-content/plugins/plugin-directory/bin/import-plugin.php --create --plugin", + "plugins:refresh": "npm run plugins:env -- run cli -- wp option delete wporg_env_imported && npm run plugins:env -- run cli wp eval-file wp-content/env-bin/import-plugins.php", + "plugins:test:env": "wp-env --config plugin-directory/.wp-env.test.json", + "plugins:test": "npm run plugins:test:env -- start && npm run plugins:test:env -- run tests-cli --env-cwd=wp-content/plugins/plugin-directory phpunit", + "jobs:env": "wp-env --config jobs/.wp-env.json", + "browsehappy:env": "wp-env --config browsehappy/.wp-env.json" + }, + "devDependencies": { + "@wordpress/env": "^11" + } } From 80b39b69c972d7bbb329c5f7a6ebddb3415a45fa Mon Sep 17 00:00:00 2001 From: Jamie Bradley Date: Thu, 4 Jun 2026 13:27:34 +0200 Subject: [PATCH 2/5] fix: update url in readme to https://browsehappy.com --- environments/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environments/README.md b/environments/README.md index 3a322423db..efaed0c041 100644 --- a/environments/README.md +++ b/environments/README.md @@ -73,7 +73,7 @@ npm run jobs:env -- run cli -- wp ### Browse Happy -A local instance of [browsehappy.com](browsehappy.com) with the theme. +A local instance of [browsehappy.com](https://browsehappy.com) with the theme. **Start:** From 78d751ec435b0086fbfe87088bab9534517a3f57 Mon Sep 17 00:00:00 2001 From: Jamie Bradley Date: Thu, 4 Jun 2026 14:20:07 +0200 Subject: [PATCH 3/5] fix: change after-start command to use theme name instead of public_html --- environments/browsehappy/bin/after-start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environments/browsehappy/bin/after-start.sh b/environments/browsehappy/bin/after-start.sh index 0fca290936..fa5ac1a8d8 100644 --- a/environments/browsehappy/bin/after-start.sh +++ b/environments/browsehappy/bin/after-start.sh @@ -11,6 +11,6 @@ $WP wp option update blogname 'Browse Happy' $WP wp option update blogdescription 'Online. Worry free. Upgrade your browser today!' # Activate the browsehappy theme. -$WP wp theme activate public_html +$WP wp theme activate "Browse Happy" echo "Browse Happy environment ready!" \ No newline at end of file From 21b5395a6d0d4962ccaa3bfc160f462891b4e041 Mon Sep 17 00:00:00 2001 From: Jamie Bradley Date: Thu, 4 Jun 2026 14:27:43 +0200 Subject: [PATCH 4/5] fix: pr feedback for script and package.json Removed the irrelevant comments from the after-start.sh script and reverted the tabs -> spaces change in package.json --- environments/browsehappy/bin/after-start.sh | 4 +-- environments/package.json | 36 ++++++++++----------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/environments/browsehappy/bin/after-start.sh b/environments/browsehappy/bin/after-start.sh index fa5ac1a8d8..5a97d91fc3 100644 --- a/environments/browsehappy/bin/after-start.sh +++ b/environments/browsehappy/bin/after-start.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# Runs after wp-env start. Sets up permalinks, creates pages, job categories, and sample jobs. -# +# Runs after wp-env start. Sets site name, description and activates the +# Browse Happy theme. CONFIG="--config browsehappy/.wp-env.json" WP="npx wp-env $CONFIG run cli --" diff --git a/environments/package.json b/environments/package.json index 5ba45baf0c..5f4c15da12 100644 --- a/environments/package.json +++ b/environments/package.json @@ -1,20 +1,20 @@ { - "name": "wporg-environments", - "private": true, - "description": "Local development environments for WordPress.org", - "engines": { - "node": ">=20" - }, - "scripts": { - "plugins:env": "wp-env --config plugin-directory/.wp-env.json", - "plugins:import": "npm run plugins:env -- run cli -- php wp-content/plugins/plugin-directory/bin/import-plugin.php --create --plugin", - "plugins:refresh": "npm run plugins:env -- run cli -- wp option delete wporg_env_imported && npm run plugins:env -- run cli wp eval-file wp-content/env-bin/import-plugins.php", - "plugins:test:env": "wp-env --config plugin-directory/.wp-env.test.json", - "plugins:test": "npm run plugins:test:env -- start && npm run plugins:test:env -- run tests-cli --env-cwd=wp-content/plugins/plugin-directory phpunit", - "jobs:env": "wp-env --config jobs/.wp-env.json", - "browsehappy:env": "wp-env --config browsehappy/.wp-env.json" - }, - "devDependencies": { - "@wordpress/env": "^11" - } + "name": "wporg-environments", + "private": true, + "description": "Local development environments for WordPress.org", + "engines": { + "node": ">=20" + }, + "scripts": { + "plugins:env": "wp-env --config plugin-directory/.wp-env.json", + "plugins:import": "npm run plugins:env -- run cli -- php wp-content/plugins/plugin-directory/bin/import-plugin.php --create --plugin", + "plugins:refresh": "npm run plugins:env -- run cli -- wp option delete wporg_env_imported && npm run plugins:env -- run cli wp eval-file wp-content/env-bin/import-plugins.php", + "plugins:test:env": "wp-env --config plugin-directory/.wp-env.test.json", + "plugins:test": "npm run plugins:test:env -- start && npm run plugins:test:env -- run tests-cli --env-cwd=wp-content/plugins/plugin-directory phpunit", + "jobs:env": "wp-env --config jobs/.wp-env.json", + "browsehappy:env": "wp-env --config browsehappy/.wp-env.json" + }, + "devDependencies": { + "@wordpress/env": "^11" + } } From d78d6c280a5e18c37a9ee134e5911d22774928f2 Mon Sep 17 00:00:00 2001 From: Jamie Bradley Date: Thu, 4 Jun 2026 14:34:52 +0200 Subject: [PATCH 5/5] fix: update comment in after-start Added extra detail to the comments for activating the browse happy theme to avoid confusion in the future. --- environments/browsehappy/bin/after-start.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/environments/browsehappy/bin/after-start.sh b/environments/browsehappy/bin/after-start.sh index 5a97d91fc3..d120f7623c 100644 --- a/environments/browsehappy/bin/after-start.sh +++ b/environments/browsehappy/bin/after-start.sh @@ -11,6 +11,9 @@ $WP wp option update blogname 'Browse Happy' $WP wp option update blogdescription 'Online. Worry free. Upgrade your browser today!' # Activate the browsehappy theme. -$WP wp theme activate "Browse Happy" +# wp-env uses the last path segment as the theme slug, so the slug is 'public_html' +# rather than 'browsehappy' (from "themes": ["../browsehappy.com/public_html"]). +# This theme is not pushed to the svn repo in wp-content/themes as per other sites. +$WP wp theme activate public_html echo "Browse Happy environment ready!" \ No newline at end of file