Skip to content
Closed
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
12 changes: 12 additions & 0 deletions environments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ npm run jobs:env start
npm run jobs:env -- run cli -- wp <command>
```

### Browse Happy

A local instance of [browsehappy.com](https://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/`.
Expand Down
12 changes: 12 additions & 0 deletions environments/browsehappy/.wp-env.json
Original file line number Diff line number Diff line change
@@ -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
}
}
Comment on lines +1 to +12
19 changes: 19 additions & 0 deletions environments/browsehappy/bin/after-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
#
# 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 --"

# 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-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!"
3 changes: 2 additions & 1 deletion environments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"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"
"jobs:env": "wp-env --config jobs/.wp-env.json",
"browsehappy:env": "wp-env --config browsehappy/.wp-env.json"
},
"devDependencies": {
"@wordpress/env": "^11"
Expand Down
Loading