You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update copilot-instructions.md to reflect the monorepo structure and clarify build instructions for WordPress block development examples. Enhanced details on environment requirements, dependency management, and project architecture.
2. Check PHP: `composer run lint` or `./vendor/bin/phpcs`
260
+
3. Build: `pnpm run build`
261
+
262
+
## WordPress Environment
263
+
264
+
**Start local WordPress environment:**
265
+
```bash
266
+
pnpm run env:start
267
+
```
268
+
- Runs WordPress locally using Docker via wp-env
269
+
- Access at http://localhost:8888
270
+
- Admin at http://localhost:8888/wp-admin (admin/password)
271
+
- All plugins in `plugins/` are automatically mounted
272
+
273
+
**Creating new block examples:**
274
+
```bash
275
+
pnpm run create-example
276
+
```
277
+
- Uses the template in `templates/block-examples/`
278
+
- Prompts for block details
279
+
- Automatically sets up the new plugin structure
230
280
231
281
## Common Issues and Solutions
232
282
233
-
**Issue:**`npm run build` fails with "Cannot find module"
234
-
-**Solution:** Run `npm install` first - dependencies not installed
283
+
**Issue:**`pnpm run build` fails with "Cannot find module"
284
+
-**Solution:** Run `pnpm install` first - dependencies not installed
235
285
236
286
**Issue:** Lint errors about Prettier formatting
237
287
-**Solution:** Run `npm run format` first, then lint again
@@ -242,26 +292,46 @@ function my_function() {
242
292
**Issue:** Composer hangs asking for GitHub token
243
293
-**Solution:** Use `composer install --no-interaction` or let it clone from cache (slower but works)
244
294
245
-
**Issue:** Build directory is empty after `npm run build`
246
-
-**Solution:** Check for errors in console; ensure `src/[your-block-name]/` files exist
295
+
**Issue:** Build directories are empty after `pnpm run build`
296
+
-**Solution:** Check for errors in console; ensure plugin `src/` directories exist
247
297
248
298
**Issue:** Plugin not working in WordPress after changes
249
-
-**Solution:** ALWAYS run `npm run build` after changing any file in `src/`
299
+
-**Solution:** ALWAYS run `pnpm run build` after changing any file in `src/`
300
+
301
+
**Issue:** "only-allow pnpm" error when using npm
302
+
-**Solution:** Use `pnpm` instead of `npm` - this is a pnpm-only workspace
250
303
251
304
## Important Notes
252
305
253
-
- The `build/` directory is git-ignored but REQUIRED for the plugin to function
306
+
- This is a **monorepo** containing multiple WordPress block examples
307
+
- Each plugin in `plugins/` is a standalone WordPress plugin demonstrating specific block concepts
308
+
- The `build/` directories are git-ignored but REQUIRED for plugins to function
254
309
- Never edit files in `build/` directly - they are auto-generated
255
-
-The plugin uses WordPress 6.8+ block registration API with blocks-manifest.php for improved performance
256
-
-All source files are in `src/[your-block-name]/`, all build outputs go to `build/[your-block-name]/`
310
+
-All plugins use WordPress 6.8+ block registration API
311
+
-Source files are in `plugins/*/src/`, build outputs go to `plugins/*/build/`
257
312
- This project follows WordPress coding standards, which use TABS for indentation
258
-
- Do not generate additional files beyond what is required for the assigned task (e.g., summary or documentation files) unless explicitly requested
313
+
- Use `pnpm` exclusively - do not use `npm` or `yarn`
314
+
- The repository includes a documentation site in `_app/` and utilities in `_bin/`
315
+
- Examples are meant to be educational and demonstrate best practices
316
+
317
+
## Additional Resources
318
+
319
+
-**GitHub Wiki:**https://github.com/WordPress/block-development-examples/wiki - Extended documentation and guides
320
+
-**Documentation Site:** Built from `_app/` and deployed via GitHub Pages
321
+
-**Example Categories:** Each plugin demonstrates different aspects of block development:
322
+
- Basic blocks (static/dynamic rendering)
323
+
- Block supports and attributes
324
+
- Interactivity API examples
325
+
- Data layer interactions
326
+
- Custom controls and toolbars
327
+
- Internationalization examples
328
+
- And more...
259
329
260
330
## Trust These Instructions
261
331
262
-
These instructions have been thoroughly tested and validated. Only perform additional searches or exploration if:
332
+
These instructions have been tailored for the WordPress Block Development Examples monorepo. The repository serves as a comprehensive learning resource for WordPress block development. Only perform additional searches or exploration if:
263
333
- The information here is incomplete for your specific task
264
334
- You encounter an error not documented in "Common Issues"
265
335
- You are adding new functionality not covered by existing patterns
266
336
267
-
For routine code changes, trust this documentation and avoid unnecessary exploration.
337
+
For routine code changes and example additions, trust this documentation and the existing patterns in the repository.
0 commit comments