@bostonuniversity/buwp-local 0.6.2 β 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.buwp-local.json +22 -0
- package/docs/CHANGELOG.md +4 -1
- package/docs/GETTING_STARTED.md +3 -0
- package/docs/MULTI_PROJECT.md +3 -0
- package/docs/ROADMAP.md +43 -14
- package/docs/VOLUME_MAPPINGS.md +466 -0
- package/docs/XDEBUG.md +429 -0
- package/package.json +1 -1
- package/readme.md +3 -0
package/.buwp-local.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"projectName": "buwp-local",
|
|
3
|
+
"image": "bu-wordpress:latest",
|
|
4
|
+
"hostname": "jaydub.local",
|
|
5
|
+
"multisite": true,
|
|
6
|
+
"services": {
|
|
7
|
+
"redis": true,
|
|
8
|
+
"s3proxy": true,
|
|
9
|
+
"shibboleth": true
|
|
10
|
+
},
|
|
11
|
+
"ports": {
|
|
12
|
+
"http": 80,
|
|
13
|
+
"https": 443,
|
|
14
|
+
"db": 3306,
|
|
15
|
+
"redis": 6379
|
|
16
|
+
},
|
|
17
|
+
"mappings": [],
|
|
18
|
+
"env": {
|
|
19
|
+
"WP_DEBUG": true,
|
|
20
|
+
"XDEBUG": false
|
|
21
|
+
}
|
|
22
|
+
}
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,10 @@ All notable changes to buwp-local will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [
|
|
8
|
+
## [0.6.3]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Documentation for volume mapping and xdebug
|
|
9
12
|
|
|
10
13
|
## [0.6.2]
|
|
11
14
|
|
package/docs/GETTING_STARTED.md
CHANGED
|
@@ -183,8 +183,11 @@ npx buwp-local destroy
|
|
|
183
183
|
## Next Steps
|
|
184
184
|
|
|
185
185
|
- **[Commands Reference](COMMANDS.md)** - Full list of available commands
|
|
186
|
+
- **[Volume Mapping Patterns](VOLUME_MAPPINGS.md)** - Advanced multi-repo workflows
|
|
187
|
+
- **[Xdebug Setup](XDEBUG.md)** - Configure step debugging for your pattern
|
|
186
188
|
- **[Credential Management](CREDENTIALS.md)** - Detailed guide to managing secrets
|
|
187
189
|
- **[Multi-Project Setup](MULTI_PROJECT.md)** - Run multiple projects simultaneously
|
|
190
|
+
- **[Migration from VM Sandboxes](MIGRATION_FROM_VM.md)** - Transitioning from traditional VMs
|
|
188
191
|
- **[Architecture](ARCHITECTURE.md)** - Understand how buwp-local works
|
|
189
192
|
|
|
190
193
|
## Troubleshooting
|
package/docs/MULTI_PROJECT.md
CHANGED
|
@@ -137,6 +137,9 @@ npx buwp-local logs -f
|
|
|
137
137
|
|
|
138
138
|
## Shared Environments
|
|
139
139
|
|
|
140
|
+
> **π‘ Looking for volume mapping patterns?**
|
|
141
|
+
> This section covers the legacy "shared environment" approach. For modern multi-repo development, see [Volume Mapping Patterns](VOLUME_MAPPINGS.md), especially [Pattern B: Sandbox Coordination](VOLUME_MAPPINGS.md#pattern-b-sandbox-coordination) which provides a cleaner architecture.
|
|
142
|
+
|
|
140
143
|
### When to Use Shared Environments
|
|
141
144
|
|
|
142
145
|
Use a shared environment when you need to:
|
package/docs/ROADMAP.md
CHANGED
|
@@ -10,7 +10,7 @@ Strategic direction and development priorities for buwp-local.
|
|
|
10
10
|
|
|
11
11
|
**Key Features:**
|
|
12
12
|
- macOS Keychain integration for secure credential storage
|
|
13
|
-
- Automatic hex decoding for
|
|
13
|
+
- Automatic hex decoding for large multiline credentials like Shibboleth keys and certs
|
|
14
14
|
- Credential validation on startup with interactive setup
|
|
15
15
|
- Multi-project support with isolated Docker volumes
|
|
16
16
|
- Smart initialization for plugins, themes, and mu-plugins
|
|
@@ -110,11 +110,12 @@ hostile.remove('127.0.0.1', config.hostname);
|
|
|
110
110
|
- Guide users on setting up access to private registries (ghcr.io)
|
|
111
111
|
- Automatic check for registry login or existing image on `start`
|
|
112
112
|
|
|
113
|
-
###
|
|
113
|
+
### Shipped in v0.6.2
|
|
114
114
|
|
|
115
|
-
-
|
|
115
|
+
- **Fix issues with spaces in paths**
|
|
116
116
|
- Fix issues with spaces in host paths causing Docker errors
|
|
117
|
-
|
|
117
|
+
|
|
118
|
+
### Planned for v0.6.3
|
|
118
119
|
|
|
119
120
|
- **Basic docs on existing Xdebug features**
|
|
120
121
|
- Quickstart guide for enabling and using Xdebug in containers
|
|
@@ -122,6 +123,35 @@ hostile.remove('127.0.0.1', config.hostname);
|
|
|
122
123
|
- **Volume Mapping pattern guide**
|
|
123
124
|
- Documentation on different volume mapping strategies for various development workflows
|
|
124
125
|
|
|
126
|
+
### Shipped in v0.6.3
|
|
127
|
+
|
|
128
|
+
**Focus:** Documentation refinement based on real user patterns
|
|
129
|
+
|
|
130
|
+
**Key Deliverables:**
|
|
131
|
+
|
|
132
|
+
1. **Volume Mapping Patterns Guide** β
|
|
133
|
+
- Comprehensive [VOLUME_MAPPINGS.md](VOLUME_MAPPINGS.md) documenting 3 patterns:
|
|
134
|
+
- **Pattern A:** In-Repo Development (self-contained, wp-env style)
|
|
135
|
+
- **Pattern B:** Sandbox Coordination (base camp maps multiple repos)
|
|
136
|
+
- **Pattern C:** Monolithic Sandbox (full WordPress for IDE context)
|
|
137
|
+
- Based on real user workflows discovered during initial rollout
|
|
138
|
+
- Decision trees, comparison tables, and migration guides
|
|
139
|
+
- Advanced topics: switching patterns, hybrid setups, performance considerations
|
|
140
|
+
|
|
141
|
+
2. **Xdebug Configuration Guide** β
|
|
142
|
+
- Comprehensive [XDEBUG.md](XDEBUG.md) with pattern-specific pathMappings
|
|
143
|
+
- VSCode, PHPStorm, and Zed examples for each pattern
|
|
144
|
+
- Multi-root workspace setup for Pattern B
|
|
145
|
+
- Troubleshooting breakpoints, performance, and common issues
|
|
146
|
+
|
|
147
|
+
3. **Cross-Reference Documentation** β
|
|
148
|
+
- Updated readme.md with links to new guides
|
|
149
|
+
- Added callouts in MULTI_PROJECT.md pointing to Pattern B
|
|
150
|
+
- Enhanced GETTING_STARTED.md next steps section
|
|
151
|
+
- Improved discoverability across documentation
|
|
152
|
+
|
|
153
|
+
**Result:** Documentation now accurately reflects real-world development workflows, making it easier for new users to adopt appropriate patterns.
|
|
154
|
+
|
|
125
155
|
## Next Phase: v0.7.0 - Developer Experience
|
|
126
156
|
|
|
127
157
|
**Status:** Planned
|
|
@@ -130,7 +160,7 @@ hostile.remove('127.0.0.1', config.hostname);
|
|
|
130
160
|
|
|
131
161
|
### Potential Features
|
|
132
162
|
|
|
133
|
-
- **Security
|
|
163
|
+
- **Database Security**
|
|
134
164
|
- Check database access on db port (e.g. `localhost:3306`)
|
|
135
165
|
- Consider more stringent default database passwords
|
|
136
166
|
- The database can have restricted content in it, so we need to ensure that users are aware of this and take appropriate measures.
|
|
@@ -140,7 +170,7 @@ hostile.remove('127.0.0.1', config.hostname);
|
|
|
140
170
|
- Documentation on usage patterns
|
|
141
171
|
|
|
142
172
|
- **Improved Windows and Linux support**
|
|
143
|
-
- Multiplatform /etc/hosts hostname
|
|
173
|
+
- Multiplatform /etc/hosts hostname guide
|
|
144
174
|
- Evaluate credential storage solutions for non-macOS platforms (https://www.npmjs.com/package/keytar)
|
|
145
175
|
|
|
146
176
|
- **Project Status & Listing**
|
|
@@ -148,10 +178,11 @@ hostile.remove('127.0.0.1', config.hostname);
|
|
|
148
178
|
- View all running projects: `buwp-local list`
|
|
149
179
|
- Quick status checks: `buwp-local status`
|
|
150
180
|
|
|
151
|
-
- **Health Checks**
|
|
181
|
+
- **Health Checks and Network Ports**
|
|
152
182
|
- Verify services are running properly
|
|
153
183
|
- Database connectivity validation
|
|
154
184
|
- Clear diagnostics on failures
|
|
185
|
+
- Advice and assistance on port conflicts
|
|
155
186
|
|
|
156
187
|
- **Improved Error Messages**
|
|
157
188
|
- Docker startup failures β actionable solutions
|
|
@@ -165,7 +196,7 @@ hostile.remove('127.0.0.1', config.hostname);
|
|
|
165
196
|
- listing and cleanup of unused volumes
|
|
166
197
|
|
|
167
198
|
### Prioritization
|
|
168
|
-
Will be informed by feedback from initial
|
|
199
|
+
Will be informed by feedback from initial small group of users and actual pain points observed during rollout.
|
|
169
200
|
|
|
170
201
|
---
|
|
171
202
|
|
|
@@ -174,13 +205,11 @@ Will be informed by feedback from initial 2-3 users and actual pain points obser
|
|
|
174
205
|
**Status:** Conceptual
|
|
175
206
|
**Timeline:** TBD based on team feedback
|
|
176
207
|
|
|
177
|
-
### Potential Features
|
|
208
|
+
### Potential Features
|
|
178
209
|
|
|
179
|
-
- **SSL Certificate Generation** - Local HTTPS with mkcert
|
|
180
|
-
- **Database Backup/Restore** - Simplified snapshots and recovery
|
|
181
|
-
- **Performance Monitoring** - Real-time resource usage tracking
|
|
182
|
-
- **Team Configuration Sync** - Share project configurations across team
|
|
183
210
|
- **Cross-Platform Support** - Windows WSL2 and Linux credential storage
|
|
211
|
+
- **SSL Certificate Generation** - Local HTTPS with mkcert
|
|
212
|
+
- **Performance Monitoring** -
|
|
184
213
|
|
|
185
214
|
**Note:** Automatic `/etc/hosts` management deferred pending user feedback. See "Lessons Learned" section above for details on the `hostile` library approach.
|
|
186
215
|
|
|
@@ -195,7 +224,7 @@ Will be informed by feedback from initial 2-3 users and actual pain points obser
|
|
|
195
224
|
**Focus:** Robustness, clear setup, good documentation
|
|
196
225
|
|
|
197
226
|
### Stage 2: Team Rollout
|
|
198
|
-
**Users:** 10
|
|
227
|
+
**Users:** 5-10 developers
|
|
199
228
|
**Goal:** Find and fix real-world issues
|
|
200
229
|
**Release:** v0.7.0+
|
|
201
230
|
**Focus:** Developer experience, error handling
|
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
# Volume Mapping Patterns
|
|
2
|
+
|
|
3
|
+
Guide to configuring volume mappings for different development workflows in buwp-local.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Volume mappings connect your local filesystem to the WordPress container, enabling live code sync and IDE integration. There are two main approaches based on **where buwp-local lives**:
|
|
8
|
+
|
|
9
|
+
- **Inside your plugin/theme repo** (Pattern A) - Self-contained, like wp-env
|
|
10
|
+
- **In a separate "base camp" directory** (Patterns B & C) - Coordinates multiple repos
|
|
11
|
+
|
|
12
|
+
This guide documents three patterns based on real user workflows.
|
|
13
|
+
|
|
14
|
+
**Quick Navigation:**
|
|
15
|
+
- [Pattern A: In-Repo Development](#pattern-a-in-repo-development) - Single plugin/theme, wp-env style
|
|
16
|
+
- [Pattern B: Sandbox Coordination](#pattern-b-sandbox-coordination) - Multiple repos from base camp
|
|
17
|
+
- [Pattern C: Monolithic Sandbox](#pattern-c-monolithic-sandbox) - Full WordPress build in base camp
|
|
18
|
+
- [Choosing a Pattern](#choosing-a-pattern) - Decision guide
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Pattern A: In-Repo Development
|
|
23
|
+
|
|
24
|
+
**Use Case:** Single plugin or theme development, wp-env style
|
|
25
|
+
|
|
26
|
+
### Description
|
|
27
|
+
|
|
28
|
+
buwp-local is installed directly in your plugin or theme repository. It can be configured by `npx buwp-local init`, which will try to detect if is being run within a plugin or theme directory and automatically set up the volume mapping. The repository is self-contained and maps itself into WordPress.
|
|
29
|
+
|
|
30
|
+
**Good for:**
|
|
31
|
+
- Transitioning from wp-env
|
|
32
|
+
- Open source plugins (distributable setup)
|
|
33
|
+
- Single-focus development
|
|
34
|
+
- Projects where repo includes dev environment setup
|
|
35
|
+
|
|
36
|
+
### Pros & Cons
|
|
37
|
+
|
|
38
|
+
**Pros:**
|
|
39
|
+
- β
Simplest setup (`init` can auto-configure)
|
|
40
|
+
- β
Self-contained to one repo (each repo can have its own setup)
|
|
41
|
+
- β
Fast volume performance (minimal mapping)
|
|
42
|
+
- β
Clean isolation (your code vs WordPress core)
|
|
43
|
+
- β
Familiar to wp-env users
|
|
44
|
+
|
|
45
|
+
**Cons:**
|
|
46
|
+
- β Can't easily develop multiple plugins together
|
|
47
|
+
- β Local sites don't share content or database
|
|
48
|
+
- β No IDE context for WordPress core
|
|
49
|
+
|
|
50
|
+
### Example Configuration
|
|
51
|
+
|
|
52
|
+
**Directory Structure:**
|
|
53
|
+
```
|
|
54
|
+
~/projects/bu-custom-analytics/ β Your plugin repo
|
|
55
|
+
βββ .buwp-local.json β buwp-local config
|
|
56
|
+
βββ package.json β Has buwp-local as devDependency
|
|
57
|
+
βββ node_modules/
|
|
58
|
+
β βββ @bostonuniversity/buwp-local/
|
|
59
|
+
βββ bu-custom-analytics.php
|
|
60
|
+
βββ includes/
|
|
61
|
+
βββ assets/
|
|
62
|
+
|
|
63
|
+
Container:
|
|
64
|
+
/var/www/html/ (Docker volume)
|
|
65
|
+
βββ wp-content/
|
|
66
|
+
βββ plugins/
|
|
67
|
+
βββ bu-custom-analytics/ (β mapped to your repo root)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Configuration File (`.buwp-local.json`):**
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"projectName": "bu-custom-analytics",
|
|
74
|
+
"hostname": "bu-custom-analytics.local",
|
|
75
|
+
"mappings": [
|
|
76
|
+
{
|
|
77
|
+
"local": "./",
|
|
78
|
+
"container": "/var/www/html/wp-content/plugins/bu-custom-analytics"
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Setup Workflow
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# 1. Navigate to your plugin/theme repo
|
|
88
|
+
cd ~/projects/bu-custom-analytics
|
|
89
|
+
|
|
90
|
+
# 2. Install buwp-local
|
|
91
|
+
npm install --save-dev @bostonuniversity/buwp-local
|
|
92
|
+
|
|
93
|
+
# 3. Initialize (auto-generates config with mapping)
|
|
94
|
+
npx buwp-local init --plugin
|
|
95
|
+
|
|
96
|
+
# 4. Start environment
|
|
97
|
+
npx buwp-local start
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### When to Use
|
|
101
|
+
|
|
102
|
+
- β
Single plugin or theme development
|
|
103
|
+
- β
Coming from wp-env background
|
|
104
|
+
- β
Want repo to be fully self-contained
|
|
105
|
+
- β
Don't need to test multiple plugins together
|
|
106
|
+
|
|
107
|
+
### Xdebug Configuration
|
|
108
|
+
|
|
109
|
+
See [Pattern A in XDEBUG.md](XDEBUG.md#pattern-a-in-repo-development) for IDE-specific pathMappings.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Pattern B: Sandbox Coordination
|
|
114
|
+
|
|
115
|
+
**Use Case:** Multiple repos coordinated from a "base camp" directory
|
|
116
|
+
|
|
117
|
+
### Description
|
|
118
|
+
|
|
119
|
+
buwp-local is installed in a **separate "base camp" directory** that doesn't contain any WordPress code. This directory coordinates multiple plugin/theme repos by mapping them into a shared WordPress instance. The repos themselves remain pure and unaware of buwp-local.
|
|
120
|
+
|
|
121
|
+
**Key concept:** Like the traditional VM sandbox development environment, but using Docker and volume mappings instead of SFTP.
|
|
122
|
+
|
|
123
|
+
**Good for:**
|
|
124
|
+
- Working on multiple repos that interact
|
|
125
|
+
- Keeping repos free of development tool dependencies
|
|
126
|
+
|
|
127
|
+
### Pros & Cons
|
|
128
|
+
|
|
129
|
+
**Pros:**
|
|
130
|
+
- β
Repos stay pure (no buwp-local installation needed)
|
|
131
|
+
- β
Work on multiple plugins/themes simultaneously
|
|
132
|
+
- β
Test plugin interactions in realistic environment
|
|
133
|
+
- β
Team can share base camp configuration
|
|
134
|
+
- β
Site content and database available across repos in single project
|
|
135
|
+
|
|
136
|
+
**Cons:**
|
|
137
|
+
- β Requires hand-editing config file for mappings
|
|
138
|
+
- β No WordPress core context in IDE (unless using Pattern C)
|
|
139
|
+
- β Slightly more complex initial setup
|
|
140
|
+
|
|
141
|
+
### Example Configuration
|
|
142
|
+
|
|
143
|
+
**Directory Structure:**
|
|
144
|
+
```
|
|
145
|
+
~/projects/
|
|
146
|
+
βββ bu-sandbox/ β "Base camp" (owns buwp-local)
|
|
147
|
+
β βββ .buwp-local.json β Hand-edited mappings
|
|
148
|
+
β βββ .env.local β Credentials (optional)
|
|
149
|
+
β βββ package.json β npm install buwp-local here
|
|
150
|
+
β βββ node_modules/
|
|
151
|
+
β βββ @bostonuniversity/buwp-local/
|
|
152
|
+
β
|
|
153
|
+
βββ bu-navigation/ β Pure repo (no buwp-local)
|
|
154
|
+
β βββ bu-navigation.php
|
|
155
|
+
β βββ includes/
|
|
156
|
+
β
|
|
157
|
+
βββ bu-slideshow/ β Pure repo (no buwp-local)
|
|
158
|
+
β βββ bu-slideshow.php
|
|
159
|
+
β βββ assets/
|
|
160
|
+
β
|
|
161
|
+
βββ responsive-framework/ β Pure repo (no buwp-local)
|
|
162
|
+
βββ style.css
|
|
163
|
+
βββ functions.php
|
|
164
|
+
|
|
165
|
+
Container (all repos mapped into one WordPress):
|
|
166
|
+
/var/www/html/ (Docker volume)
|
|
167
|
+
βββ wp-content/
|
|
168
|
+
βββ plugins/
|
|
169
|
+
β βββ bu-navigation/ (β ~/projects/bu-navigation)
|
|
170
|
+
β βββ bu-slideshow/ (β ~/projects/bu-slideshow)
|
|
171
|
+
βββ themes/
|
|
172
|
+
βββ responsive-framework/ (β ~/projects/responsive-framework)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Configuration File (`~/projects/bu-sandbox/.buwp-local.json`):**
|
|
176
|
+
|
|
177
|
+
Using **absolute paths** (most common, explicit):
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"projectName": "bu-sandbox",
|
|
181
|
+
"hostname": "bu-sandbox.local",
|
|
182
|
+
"multisite": true,
|
|
183
|
+
"services": {
|
|
184
|
+
"redis": true,
|
|
185
|
+
"s3proxy": true,
|
|
186
|
+
"shibboleth": true
|
|
187
|
+
},
|
|
188
|
+
"ports": {
|
|
189
|
+
"http": 80,
|
|
190
|
+
"https": 443,
|
|
191
|
+
"db": 3306,
|
|
192
|
+
"redis": 6379
|
|
193
|
+
},
|
|
194
|
+
"mappings": [
|
|
195
|
+
{
|
|
196
|
+
"local": "/Users/username/projects/bu-navigation",
|
|
197
|
+
"container": "/var/www/html/wp-content/plugins/bu-navigation"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"local": "/Users/username/projects/bu-slideshow",
|
|
201
|
+
"container": "/var/www/html/wp-content/plugins/bu-slideshow"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"local": "/Users/username/projects/responsive-framework",
|
|
205
|
+
"container": "/var/www/html/wp-content/themes/responsive-framework"
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
"env": {
|
|
209
|
+
"WP_DEBUG": true,
|
|
210
|
+
"XDEBUG": false
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Using **relative paths** (if repos are siblings to base camp):
|
|
216
|
+
```json
|
|
217
|
+
{
|
|
218
|
+
"projectName": "bu-sandbox",
|
|
219
|
+
"hostname": "bu-sandbox.local",
|
|
220
|
+
"mappings": [
|
|
221
|
+
{
|
|
222
|
+
"local": "../bu-navigation",
|
|
223
|
+
"container": "/var/www/html/wp-content/plugins/bu-navigation"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"local": "../bu-slideshow",
|
|
227
|
+
"container": "/var/www/html/wp-content/plugins/bu-slideshow"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"local": "../responsive-framework",
|
|
231
|
+
"container": "/var/www/html/wp-content/themes/responsive-framework"
|
|
232
|
+
}
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Setup Workflow
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
# 1. Create base camp directory
|
|
241
|
+
mkdir ~/projects/bu-sandbox
|
|
242
|
+
cd ~/projects/bu-sandbox
|
|
243
|
+
|
|
244
|
+
# 2. Initialize npm project and install buwp-local
|
|
245
|
+
npm init -y
|
|
246
|
+
npm install --save-dev @bostonuniversity/buwp-local
|
|
247
|
+
|
|
248
|
+
# 3. Initialize in sandbox mode
|
|
249
|
+
npx buwp-local init --sandbox
|
|
250
|
+
|
|
251
|
+
# 4. Hand-edit .buwp-local.json to add repo mappings
|
|
252
|
+
# (See example configurations above)
|
|
253
|
+
|
|
254
|
+
# 5. Start environment
|
|
255
|
+
npx buwp-local start
|
|
256
|
+
|
|
257
|
+
# 6. Develop in your repos (bu-navigation, bu-slideshow, etc.)
|
|
258
|
+
# Changes sync automatically via volume mappings
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### When to Use
|
|
262
|
+
|
|
263
|
+
- β
Developing multiple BU plugins/themes together
|
|
264
|
+
- β
Testing plugin interactions (navigation + slideshow + theme)
|
|
265
|
+
- β
Want repos to stay clean (no dev tool dependencies)
|
|
266
|
+
- β
Transitioning from VM sandbox workflow
|
|
267
|
+
|
|
268
|
+
### Xdebug Configuration
|
|
269
|
+
|
|
270
|
+
See [Pattern B in XDEBUG.md](XDEBUG.md#pattern-b-sandbox-coordination) for multi-workspace pathMappings.
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## Pattern C: Monolithic Sandbox
|
|
275
|
+
|
|
276
|
+
**Use Case:** Full WordPress codebase for complete IDE intelligence
|
|
277
|
+
|
|
278
|
+
### Description
|
|
279
|
+
|
|
280
|
+
A variant of Pattern B where the base camp maps the **entire WordPress installation** instead of selective plugins/themes. This provides complete IDE context (autocomplete for WordPress core, go-to-definition across all code) at the cost of more complex setup and slower filesystem performance.
|
|
281
|
+
|
|
282
|
+
**Good for:**
|
|
283
|
+
- Advanced IDE users (PHPStorm, Zed)
|
|
284
|
+
- Complex debugging across multiple codebases
|
|
285
|
+
- Need to edit WordPress core or dependencies
|
|
286
|
+
- Want full codebase navigation
|
|
287
|
+
|
|
288
|
+
### Pros & Cons
|
|
289
|
+
|
|
290
|
+
**Pros:**
|
|
291
|
+
- β
Full WordPress core autocomplete in IDE
|
|
292
|
+
- β
Go-to-definition works across all code
|
|
293
|
+
- β
Can edit any file (core, plugins, themes)
|
|
294
|
+
- β
Step debug the entire codebase
|
|
295
|
+
- β
Complete codebase context
|
|
296
|
+
|
|
297
|
+
**Cons:**
|
|
298
|
+
- β Complex initial setup
|
|
299
|
+
- β Must manage all code updates locally
|
|
300
|
+
- β Risk of accidentally editing core files
|
|
301
|
+
- β Potentially Slower volume performance (large mapping)
|
|
302
|
+
|
|
303
|
+
### Example Configuration
|
|
304
|
+
|
|
305
|
+
**Directory Structure:**
|
|
306
|
+
```
|
|
307
|
+
~/projects/
|
|
308
|
+
βββ bu-sandbox-full/ β Base camp
|
|
309
|
+
β βββ .buwp-local.json β Points to wordpress-build
|
|
310
|
+
β βββ package.json β Has buwp-local
|
|
311
|
+
β βββ node_modules/
|
|
312
|
+
β βββ wordpress-build/ β Full WordPress β Mapped to container
|
|
313
|
+
β βββ wp-admin/
|
|
314
|
+
β βββ wp-content/
|
|
315
|
+
β β βββ plugins/
|
|
316
|
+
β β β βββ bu-navigation/
|
|
317
|
+
β β β βββ bu-slideshow/
|
|
318
|
+
β β β βββ ... (all plugins)
|
|
319
|
+
β β βββ themes/
|
|
320
|
+
β β β βββ ... (all themes)
|
|
321
|
+
β β βββ mu-plugins/
|
|
322
|
+
β βββ wp-includes/
|
|
323
|
+
β βββ wp-config.php
|
|
324
|
+
|
|
325
|
+
Container:
|
|
326
|
+
/var/www/html/ (β entire wordpress-build directory)
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
**Configuration File (`~/projects/bu-sandbox-full/.buwp-local.json`):**
|
|
330
|
+
|
|
331
|
+
Using **relative path** to wordpress-build:
|
|
332
|
+
```json
|
|
333
|
+
{
|
|
334
|
+
"projectName": "bu-sandbox-full",
|
|
335
|
+
"hostname": "bu-sandbox-full.local",
|
|
336
|
+
"multisite": true,
|
|
337
|
+
"services": {
|
|
338
|
+
"redis": true,
|
|
339
|
+
"s3proxy": true,
|
|
340
|
+
"shibboleth": true
|
|
341
|
+
},
|
|
342
|
+
"ports": {
|
|
343
|
+
"http": 80,
|
|
344
|
+
"https": 443,
|
|
345
|
+
"db": 3306,
|
|
346
|
+
"redis": 6379
|
|
347
|
+
},
|
|
348
|
+
"mappings": [
|
|
349
|
+
{
|
|
350
|
+
"local": "./wordpress-build",
|
|
351
|
+
"container": "/var/www/html"
|
|
352
|
+
}
|
|
353
|
+
],
|
|
354
|
+
"env": {
|
|
355
|
+
"WP_DEBUG": true,
|
|
356
|
+
"XDEBUG": true
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
Using **absolute path**:
|
|
362
|
+
```json
|
|
363
|
+
{
|
|
364
|
+
"projectName": "bu-sandbox-full",
|
|
365
|
+
"hostname": "bu-sandbox-full.local",
|
|
366
|
+
"mappings": [
|
|
367
|
+
{
|
|
368
|
+
"local": "/Users/username/projects/bu-sandbox-full/wordpress-build",
|
|
369
|
+
"container": "/var/www/html"
|
|
370
|
+
}
|
|
371
|
+
]
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### Setup Workflow
|
|
376
|
+
|
|
377
|
+
```bash
|
|
378
|
+
# 1. Create base camp directory
|
|
379
|
+
mkdir ~/projects/bu-sandbox-full
|
|
380
|
+
cd ~/projects/bu-sandbox-full
|
|
381
|
+
|
|
382
|
+
# 2. Build or clone full WordPress
|
|
383
|
+
# Method depends on your organization:
|
|
384
|
+
# - Clone WordPress core
|
|
385
|
+
# - Clone all BU plugins/themes into wp-content/
|
|
386
|
+
# - Run any build scripts (composer, npm)
|
|
387
|
+
# - Or: Copy from existing dev environment
|
|
388
|
+
|
|
389
|
+
# Example structure:
|
|
390
|
+
mkdir wordpress-build
|
|
391
|
+
cd wordpress-build
|
|
392
|
+
# ... set up WordPress core + all plugins/themes ...
|
|
393
|
+
|
|
394
|
+
# 3. Back to base camp, initialize npm and install buwp-local
|
|
395
|
+
cd ~/projects/bu-sandbox-full
|
|
396
|
+
npm init -y
|
|
397
|
+
npm install --save-dev @bostonuniversity/buwp-local
|
|
398
|
+
|
|
399
|
+
# 4. Initialize in sandbox mode
|
|
400
|
+
npx buwp-local init --sandbox
|
|
401
|
+
|
|
402
|
+
# 5. Edit .buwp-local.json to map wordpress-build
|
|
403
|
+
# (See example configuration above)
|
|
404
|
+
|
|
405
|
+
# 6. Start environment
|
|
406
|
+
npx buwp-local start
|
|
407
|
+
|
|
408
|
+
# 7. Open IDE with wordpress-build as project root
|
|
409
|
+
# Full WordPress codebase is now available for autocomplete
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### When to Use
|
|
413
|
+
|
|
414
|
+
- β
Using advanced IDE (Zed, PHPStorm with deep inspection)
|
|
415
|
+
- β
Need autocomplete for WordPress core functions
|
|
416
|
+
- β
Debugging complex issues across plugins + core
|
|
417
|
+
- β
Want complete codebase navigation
|
|
418
|
+
- β
Willing to manage full WordPress build locally
|
|
419
|
+
- β
Have fast disk I/O (SSD recommended)
|
|
420
|
+
|
|
421
|
+
### Important Considerations
|
|
422
|
+
|
|
423
|
+
**WordPress Management:**
|
|
424
|
+
- You're responsible for build updates and maintenance
|
|
425
|
+
|
|
426
|
+
**Performance:**
|
|
427
|
+
- Largest mapping = slowest volume I/O on macOS
|
|
428
|
+
- Initial sync may take time (large file count)
|
|
429
|
+
- File watchers may struggle with large codebases
|
|
430
|
+
- Linux performs better than macOS for large mappings
|
|
431
|
+
|
|
432
|
+
### Xdebug Configuration
|
|
433
|
+
|
|
434
|
+
See [Pattern C in XDEBUG.md](XDEBUG.md#pattern-c-monolithic-sandbox) for complete IDE context pathMappings.
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## Choosing a Pattern
|
|
439
|
+
|
|
440
|
+
### Quick Comparison Table
|
|
441
|
+
|
|
442
|
+
| Pattern | buwp-local Location | IDE Context | Setup | Volume Perf | Best For |
|
|
443
|
+
|---------|---------------------|-------------|-------|-------------|----------|
|
|
444
|
+
| **A: In-Repo** | Inside plugin/theme repo | Your code only | β Easy | βββ Fast | wp-env users, single repo |
|
|
445
|
+
| **B: Sandbox** | Separate base camp | Your repos only | ββ Medium | ββ Good | Multiple repos, teams |
|
|
446
|
+
| **C: Monolithic** | Separate base camp | Everything | ββββ Advanced | β Slower | Full IDE context |
|
|
447
|
+
|
|
448
|
+
### Recommendation by Scenario
|
|
449
|
+
|
|
450
|
+
**Coming from wp-env?** β Pattern A (familiar workflow)
|
|
451
|
+
**Coming from VM sandbox?** β Pattern B (similar concept, better maintainability)
|
|
452
|
+
**Multiple BU plugins to test?** β Pattern B (coordination from base camp)
|
|
453
|
+
**Team development?** β Pattern B (shared base camp config)
|
|
454
|
+
**Need WordPress core autocomplete?** β Pattern C (monolithic sandbox)
|
|
455
|
+
**Single open-source plugin?** β Pattern A (self-contained repo)
|
|
456
|
+
|
|
457
|
+
You can mix patterns - some repos use Pattern A while others coordinate through Pattern B base camp.
|
|
458
|
+
|
|
459
|
+
---
|
|
460
|
+
|
|
461
|
+
## Related Documentation
|
|
462
|
+
|
|
463
|
+
- **[XDEBUG.md](XDEBUG.md)** - Pattern-specific Xdebug configuration
|
|
464
|
+
- **[MULTI_PROJECT.md](MULTI_PROJECT.md)** - Isolated vs shared environment strategies
|
|
465
|
+
- **[GETTING_STARTED.md](GETTING_STARTED.md)** - Initial setup guide
|
|
466
|
+
- **[COMMANDS.md](COMMANDS.md)** - CLI reference
|
package/docs/XDEBUG.md
ADDED
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
# Xdebug Setup Guide
|
|
2
|
+
|
|
3
|
+
Xdebug configuration depends on your [volume mapping pattern](VOLUME_MAPPINGS.md). The key principle: **pathMappings must match your volume mappings exactly**.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
1. **Enable Xdebug** in `.buwp-local.json`:
|
|
8
|
+
```json
|
|
9
|
+
"env": {
|
|
10
|
+
"XDEBUG": true
|
|
11
|
+
}
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
2. **Restart environment** to apply changes:
|
|
15
|
+
```bash
|
|
16
|
+
npx buwp-local stop
|
|
17
|
+
npx buwp-local start
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
3. **Configure pathMappings** using the pattern-specific examples below.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Pattern A: In-Repo Development
|
|
25
|
+
|
|
26
|
+
**Scenario:** buwp-local lives inside your plugin/theme repo (like wp-env).
|
|
27
|
+
|
|
28
|
+
**Volume mapping:**
|
|
29
|
+
```json
|
|
30
|
+
"mappings": [
|
|
31
|
+
{
|
|
32
|
+
"local": ".",
|
|
33
|
+
"container": "/var/www/html/wp-content/plugins/bu-navigation"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### VSCode Configuration
|
|
39
|
+
|
|
40
|
+
Create `.vscode/launch.json` in your plugin/theme repo:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"version": "0.2.0",
|
|
45
|
+
"configurations": [
|
|
46
|
+
{
|
|
47
|
+
"name": "Listen for Xdebug (Pattern A)",
|
|
48
|
+
"type": "php",
|
|
49
|
+
"request": "launch",
|
|
50
|
+
"port": 9003,
|
|
51
|
+
"pathMappings": {
|
|
52
|
+
"/var/www/html/wp-content/plugins/bu-navigation": "${workspaceRoot}"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### PHPStorm Configuration
|
|
60
|
+
|
|
61
|
+
1. Go to **Run β Edit Configurations**
|
|
62
|
+
2. Add **PHP Remote Debug** configuration
|
|
63
|
+
3. Set **Server** configuration:
|
|
64
|
+
- Host: `localhost`
|
|
65
|
+
- Port: `9003`
|
|
66
|
+
- Debugger: `Xdebug`
|
|
67
|
+
4. Add **Path mapping**:
|
|
68
|
+
- Local: `/path/to/bu-navigation` (your repo root)
|
|
69
|
+
- Remote: `/var/www/html/wp-content/plugins/bu-navigation`
|
|
70
|
+
|
|
71
|
+
### Zed Configuration
|
|
72
|
+
|
|
73
|
+
Create `.zed/tasks.json`:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"xdebug": {
|
|
78
|
+
"type": "php",
|
|
79
|
+
"pathMappings": {
|
|
80
|
+
"/var/www/html/wp-content/plugins/bu-navigation": "."
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Pattern B: Sandbox Coordination
|
|
89
|
+
|
|
90
|
+
**Scenario:** Base camp directory maps multiple plugin/theme repos.
|
|
91
|
+
|
|
92
|
+
**Volume mapping:**
|
|
93
|
+
```json
|
|
94
|
+
"mappings": [
|
|
95
|
+
{
|
|
96
|
+
"local": "/Users/jaydub/projects/bu-navigation",
|
|
97
|
+
"container": "/var/www/html/wp-content/plugins/bu-navigation"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"local": "/Users/jaydub/projects/bu-slideshow",
|
|
101
|
+
"container": "/var/www/html/wp-content/plugins/bu-slideshow"
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### VSCode Multi-Root Workspace
|
|
107
|
+
|
|
108
|
+
Create a **workspace file** (e.g., `bu-plugins.code-workspace`) to include all repos:
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"folders": [
|
|
113
|
+
{ "path": "../bu-navigation" },
|
|
114
|
+
{ "path": "../bu-slideshow" }
|
|
115
|
+
],
|
|
116
|
+
"settings": {},
|
|
117
|
+
"launch": {
|
|
118
|
+
"version": "0.2.0",
|
|
119
|
+
"configurations": [
|
|
120
|
+
{
|
|
121
|
+
"name": "Listen for Xdebug (Pattern B)",
|
|
122
|
+
"type": "php",
|
|
123
|
+
"request": "launch",
|
|
124
|
+
"port": 9003,
|
|
125
|
+
"pathMappings": {
|
|
126
|
+
"/var/www/html/wp-content/plugins/bu-navigation": "${workspaceFolder:bu-navigation}",
|
|
127
|
+
"/var/www/html/wp-content/plugins/bu-slideshow": "${workspaceFolder:bu-slideshow}"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Usage:**
|
|
136
|
+
1. Open the `.code-workspace` file in VSCode
|
|
137
|
+
2. All mapped repos will be available in the sidebar
|
|
138
|
+
3. Set breakpoints in any repo
|
|
139
|
+
4. Start debugging with F5
|
|
140
|
+
|
|
141
|
+
### PHPStorm Multi-Module Setup
|
|
142
|
+
|
|
143
|
+
1. Open PHPStorm, go to **File β Project Structure**
|
|
144
|
+
2. Add each repo as a **Module**
|
|
145
|
+
3. Configure **Run β Edit Configurations β PHP Remote Debug**
|
|
146
|
+
4. Add path mappings for each repo:
|
|
147
|
+
- `/Users/jaydub/projects/bu-navigation` β `/var/www/html/wp-content/plugins/bu-navigation`
|
|
148
|
+
- `/Users/jaydub/projects/bu-slideshow` β `/var/www/html/wp-content/plugins/bu-slideshow`
|
|
149
|
+
|
|
150
|
+
### Zed Workspace
|
|
151
|
+
|
|
152
|
+
Zed doesn't have multi-root workspace concept. Open each repo separately and configure individually (Pattern A style for each).
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Pattern C: Monolithic Sandbox
|
|
157
|
+
|
|
158
|
+
**Scenario:** Base camp maps entire WordPress installation for complete IDE context.
|
|
159
|
+
|
|
160
|
+
**Volume mapping:**
|
|
161
|
+
```json
|
|
162
|
+
"mappings": [
|
|
163
|
+
{
|
|
164
|
+
"local": "/Users/jaydub/wordpress-builds/bu-prod",
|
|
165
|
+
"container": "/var/www/html"
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### VSCode Configuration
|
|
171
|
+
|
|
172
|
+
Create `.vscode/launch.json` in your WordPress build directory:
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"version": "0.2.0",
|
|
177
|
+
"configurations": [
|
|
178
|
+
{
|
|
179
|
+
"name": "Listen for Xdebug (Pattern C)",
|
|
180
|
+
"type": "php",
|
|
181
|
+
"request": "launch",
|
|
182
|
+
"port": 9003,
|
|
183
|
+
"pathMappings": {
|
|
184
|
+
"/var/www/html": "${workspaceRoot}"
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Advantages:**
|
|
192
|
+
- Single path mapping (simpler)
|
|
193
|
+
- Full WordPress context in IDE
|
|
194
|
+
- Go-to-definition works across all code
|
|
195
|
+
- Autocomplete for WordPress core
|
|
196
|
+
|
|
197
|
+
**Trade-offs:**
|
|
198
|
+
- Slower volume performance on macOS
|
|
199
|
+
- Larger IDE project (may be slower)
|
|
200
|
+
- Must manage entire WordPress build
|
|
201
|
+
|
|
202
|
+
### PHPStorm Configuration
|
|
203
|
+
|
|
204
|
+
1. Open the WordPress build directory as your project root
|
|
205
|
+
2. Configure **PHP Remote Debug**
|
|
206
|
+
3. Add single path mapping:
|
|
207
|
+
- Local: `/Users/jaydub/wordpress-builds/bu-prod`
|
|
208
|
+
- Remote: `/var/www/html`
|
|
209
|
+
|
|
210
|
+
### Zed Configuration
|
|
211
|
+
|
|
212
|
+
Create `.zed/tasks.json` in WordPress root:
|
|
213
|
+
|
|
214
|
+
```json
|
|
215
|
+
{
|
|
216
|
+
"xdebug": {
|
|
217
|
+
"type": "php",
|
|
218
|
+
"pathMappings": {
|
|
219
|
+
"/var/www/html": "."
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Common Setup Steps (All Patterns)
|
|
228
|
+
|
|
229
|
+
### Install PHP Debug Extension (VSCode)
|
|
230
|
+
|
|
231
|
+
1. Open VSCode Extensions (Cmd+Shift+X)
|
|
232
|
+
2. Search for "PHP Debug"
|
|
233
|
+
3. Install: https://marketplace.visualstudio.com/items?itemName=xdebug.php-debug
|
|
234
|
+
|
|
235
|
+
### Start Debugging
|
|
236
|
+
|
|
237
|
+
1. **Set breakpoint** in your PHP file (click left gutter)
|
|
238
|
+
2. **Start debug listener** (F5 or Run β Start Debugging)
|
|
239
|
+
3. **Trigger code** in browser (reload page, submit form, etc.)
|
|
240
|
+
4. **Debugger pauses** at breakpoint
|
|
241
|
+
|
|
242
|
+
### Verify Xdebug is Running
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
# Check Xdebug is loaded
|
|
246
|
+
npx buwp-local wp eval 'phpinfo();' | grep -i xdebug
|
|
247
|
+
|
|
248
|
+
# Or via shell
|
|
249
|
+
npx buwp-local shell
|
|
250
|
+
php -v # Should show "with Xdebug"
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Alternative: VSCode Remote Container Debugging
|
|
256
|
+
|
|
257
|
+
An alternative to volume mapping is to use VSCode's **Dev Containers** extension to open the entire WordPress container directly in VSCode. PhpStorm also has a similar feature (Zed does not currently support this).
|
|
258
|
+
|
|
259
|
+
### How It Works
|
|
260
|
+
|
|
261
|
+
Instead of syncing code via volume mappings, you open VSCode **inside the container** and edit/debug directly there:
|
|
262
|
+
|
|
263
|
+
1. Start buwp-local (any pattern, even without volume mappings)
|
|
264
|
+
2. Right-click the running container in VSCode Docker explorer
|
|
265
|
+
3. Select "Attach Visual Studio Code"
|
|
266
|
+
4. VSCode opens inside the container with full filesystem access
|
|
267
|
+
5. Set breakpoints and debug the entire build
|
|
268
|
+
|
|
269
|
+
### When to Use This
|
|
270
|
+
|
|
271
|
+
- β
Experimental edits (don't need to persist locally)
|
|
272
|
+
- β
Full WordPress core context needed (like Pattern C)
|
|
273
|
+
- β
Stepping through entire codebase quickly
|
|
274
|
+
- β
Learning/exploring the build
|
|
275
|
+
|
|
276
|
+
### Setup
|
|
277
|
+
|
|
278
|
+
1. **Install Remote Containers Extension** (if not already installed)
|
|
279
|
+
- Open VSCode Extensions (Cmd+Shift+X)
|
|
280
|
+
- Search for "Remote - Containers"
|
|
281
|
+
- Install: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
|
|
282
|
+
|
|
283
|
+
2. **Start your environment**
|
|
284
|
+
```bash
|
|
285
|
+
npx buwp-local start
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
3. **Open container in VSCode**
|
|
289
|
+
- Click **Containers** (sidebar)
|
|
290
|
+
- Open the buwp-local project in the Containers list
|
|
291
|
+
- Right-click on the WordPress container β **Attach Visual Studio Code**
|
|
292
|
+
|
|
293
|
+
4. **Install Extensions and Configure Debugging in container**
|
|
294
|
+
- Install PHP Debug extension inside the container VSCode
|
|
295
|
+
- Create `.vscode/launch.json` with pathMappings as needed (usually just `/var/www/html` to `.`)
|
|
296
|
+
|
|
297
|
+
### Advantages vs Volume Mapping
|
|
298
|
+
|
|
299
|
+
| Aspect | Volume Mapping | Remote Container |
|
|
300
|
+
|--------|---|---|
|
|
301
|
+
| **IDE Context** | Pattern-dependent | Full codebase always |
|
|
302
|
+
| **Persistence** | Changes stay local | Temporary only |
|
|
303
|
+
| **Performance** | Fast (local) | Slower (Docker I/O) |
|
|
304
|
+
| **Best For** | Production code changes | Experimental debugging |
|
|
305
|
+
|
|
306
|
+
### When NOT to Use This
|
|
307
|
+
|
|
308
|
+
- β Changes you need to keep locally (use volume mapping instead)
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Troubleshooting
|
|
313
|
+
|
|
314
|
+
### Breakpoints Not Hit
|
|
315
|
+
|
|
316
|
+
**Check pathMappings match your volume mappings:**
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
# View your volume mappings
|
|
320
|
+
npx buwp-local config --show
|
|
321
|
+
|
|
322
|
+
# Ensure pathMappings in launch.json match exactly
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
**Common mistakes:**
|
|
326
|
+
- Pattern A: Using `/var/www/html` instead of full plugin path
|
|
327
|
+
- Pattern B: Missing mappings for some repos
|
|
328
|
+
- Pattern C: Wrong workspace root
|
|
329
|
+
|
|
330
|
+
### "Cannot Find File" Errors
|
|
331
|
+
|
|
332
|
+
**VSCode shows:** "Could not find file /var/www/html/..."
|
|
333
|
+
|
|
334
|
+
**Solution:** Your local file path doesn't match the pathMapping. Check:
|
|
335
|
+
1. Is VSCode workspace root correct?
|
|
336
|
+
2. Does `${workspaceRoot}` resolve to the right path?
|
|
337
|
+
3. For Pattern B, are you using multi-root workspace?
|
|
338
|
+
|
|
339
|
+
### Performance Issues
|
|
340
|
+
|
|
341
|
+
**Xdebug can slow page loads significantly.**
|
|
342
|
+
|
|
343
|
+
**Solutions:**
|
|
344
|
+
- Disable Xdebug when not actively debugging
|
|
345
|
+
- Use conditional breakpoints sparingly
|
|
346
|
+
- Pattern C is slower than A/B due to larger volume mapping
|
|
347
|
+
|
|
348
|
+
### Port Already in Use
|
|
349
|
+
|
|
350
|
+
**Error:** "Port 9003 already in use"
|
|
351
|
+
|
|
352
|
+
**Solution:**
|
|
353
|
+
```bash
|
|
354
|
+
# Find process using port 9003
|
|
355
|
+
lsof -i :9003
|
|
356
|
+
|
|
357
|
+
# Kill if needed
|
|
358
|
+
kill -9 <PID>
|
|
359
|
+
|
|
360
|
+
# Or change Xdebug port in launch.json and container config
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Advanced Configuration
|
|
366
|
+
|
|
367
|
+
### Conditional Breakpoints
|
|
368
|
+
|
|
369
|
+
Right-click breakpoint in VSCode β Edit Breakpoint β Add expression:
|
|
370
|
+
|
|
371
|
+
```php
|
|
372
|
+
$post_id === 123
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### Step Debugging WP-CLI Commands
|
|
376
|
+
|
|
377
|
+
```bash
|
|
378
|
+
# Enable Xdebug for CLI
|
|
379
|
+
npx buwp-local wp --allow-root eval 'xdebug_break();'
|
|
380
|
+
|
|
381
|
+
# Or set environment variable
|
|
382
|
+
npx buwp-local shell
|
|
383
|
+
export XDEBUG_SESSION=1
|
|
384
|
+
wp plugin list
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### Remote Debugging from Browser
|
|
388
|
+
|
|
389
|
+
Install Xdebug browser extension:
|
|
390
|
+
- Chrome: [Xdebug Helper](https://chrome.google.com/webstore/detail/xdebug-helper)
|
|
391
|
+
- Firefox: [Xdebug Helper](https://addons.mozilla.org/en-US/firefox/addon/xdebug-helper-for-firefox/)
|
|
392
|
+
|
|
393
|
+
Click extension icon β Enable debugging β Reload page.
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
## Pattern-Specific Tips
|
|
398
|
+
|
|
399
|
+
### Pattern A (In-Repo)
|
|
400
|
+
- β
Simplest pathMapping setup
|
|
401
|
+
- β No WordPress core debugging
|
|
402
|
+
- π‘ Use [php-stubs/wordpress-stubs](https://github.com/php-stubs/wordpress-stubs) for autocomplete
|
|
403
|
+
|
|
404
|
+
### Pattern B (Sandbox)
|
|
405
|
+
- β
Debug multiple repos simultaneously
|
|
406
|
+
- β οΈ Requires multi-root workspace in VSCode
|
|
407
|
+
- π‘ Create `.code-workspace` file for team to share
|
|
408
|
+
|
|
409
|
+
### Pattern C (Monolithic)
|
|
410
|
+
- β
Debug WordPress core, plugins, themes all together
|
|
411
|
+
- β
Full IDE context (go-to-definition everywhere)
|
|
412
|
+
- β οΈ Larger project, slower performance on macOS
|
|
413
|
+
- π‘ Use sparse checkout to reduce repo size
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
## Related Documentation
|
|
418
|
+
|
|
419
|
+
- **[VOLUME_MAPPINGS.md](VOLUME_MAPPINGS.md)** - Complete guide to volume mapping patterns
|
|
420
|
+
- **[GETTING_STARTED.md](GETTING_STARTED.md)** - Initial setup guide
|
|
421
|
+
- **[COMMANDS.md](COMMANDS.md)** - CLI reference
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
## References
|
|
426
|
+
|
|
427
|
+
- [Xdebug Documentation](https://xdebug.org/docs/)
|
|
428
|
+
- [VSCode PHP Debugging](https://code.visualstudio.com/docs/languages/php)
|
|
429
|
+
- [PHPStorm Xdebug Guide](https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html)
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -99,7 +99,10 @@ Your local WordPress site should now be accessible at the hostname you configure
|
|
|
99
99
|
|
|
100
100
|
- π [Getting Started Guide](docs/GETTING_STARTED.md)
|
|
101
101
|
- π [Command Reference](docs/COMMANDS.md)
|
|
102
|
+
- πΊοΈ [Volume Mapping Patterns](docs/VOLUME_MAPPINGS.md) - Flexible development workflows
|
|
103
|
+
- π [Xdebug Setup](docs/XDEBUG.md) - Step debugging configuration
|
|
102
104
|
- π [Credential Management](docs/CREDENTIALS.md)
|
|
105
|
+
- π [Migration from VM Sandboxes](docs/MIGRATION_FROM_VM.md)
|
|
103
106
|
- ποΈ [Architecture](docs/ARCHITECTURE.md) (for contributors)
|
|
104
107
|
|
|
105
108
|
## Features
|