Project standards and “valid” packages
A valid monorepo package in this repository is a workspace member that Nx can execute targets for and that meets the expectations below. Shipping WordPress plugins and themes live under plugins/<slug>/ or themes/<slug>/.
Required for application packages (plugins and themes)
project.json(Nx) at the package root- Includes a unique
namematching the Nx project name used in tags (see Versioning). - Declares
root,projectType: "application", and atargetsobject listing the targets this package supports (empty objects inherit defaults fromnx.json).
- Includes a unique
package.json- Required for
@wordpress/scriptsand workspace tooling. - Must declare its own runtime and dev dependencies; do not rely on accidental hoisting (see Package management).
- Required for
composer.json(when PHP / Composer is used)- Defines the Composer package name, autoloading, and scripts such as
testfor integration tests. - Path repositories to monorepo packages (for example
packages/phpunit-config) must be explicit where needed.
- Defines the Composer package name, autoloading, and scripts such as
Targets and scripts
Implement the targets your project needs, aligned withnx.jsondefaults:Target Typical use composer-installcomposer installin the project rootbuildwp-scripts build→dist/startwp-scripts start(watch)wp-env-start/wp-env-cleanLocal WordPress via @wordpress/envtest-e2ePlaywright via wp-scripts test-playwrighttest-integrationPHPUnit inside wp-envtest-screenshotPlaywright regression config (where used) Root shortcuts such as
pnpm buildrunnx run-manyacross all projects that define the target.Local environment
.wp-env.jsonat the project root when usingwp-env, consistent with generator output.
Documentation
- For sidebar inclusion in the published docs site, add
docs/index.mdunder the package. Optional pages are additional Markdown files in the samedocs/folder. See Contributing docs.
- For sidebar inclusion in the published docs site, add
Shared libraries (packages/)
Libraries (for example packages/phpunit-config) use a minimal project.json and supply Composer or npm metadata as needed. They are referenced by path from application composer.json files when appropriate.
Generators
Scaffold new work with the internal Nx plugin:
- Theme:
npx nx generate monorepo-plugin:themethenpnpm install - Plugin:
npx nx generate monorepo-plugin:pluginthenpnpm install - Block in existing plugin:
npx nx generate monorepo-plugin:block <plugin> <block-name>
See the monorepo-plugin README for details.
Labeler configuration
When adding a new top-level plugin or theme folder, update .github/labeler.yml so pull requests receive accurate area labels.