Shared tooling and configuration
What is centralized at the repository root
These files intentionally live once at the monorepo root and apply to all (or most) packages:
| Area | Examples |
|---|---|
| JavaScript / Node | Root package.json scripts, pnpm-workspace.yaml, shared typescript / @wordpress/scripts versions |
| Linting | .eslintrc (or equivalent), .stylelintrc, .prettierrc.js, markdown lint config, phpcs.xml via Composer at root |
| Testing | Shared Playwright setup under packages/e2e/, PHPUnit XML in packages/phpunit-config/ |
| Git | Root .gitignore; release export rules often use .gitattributes per package |
Run monorepo-wide checks from the root, for example:
bash
pnpm lint # JS, CSS, PHP, MD, package.json (see root package.json)
pnpm build # all projects with a build targetWhat stays package-specific
Keep configuration in the package when it encodes product behavior:
block.json, themetheme.json, WordPress templates, and PHP bootstrap files.wp-env.json— port mappings, plugin/theme mappings, and env-specific optionscomposer.json— package name, autoload namespaces,require/require-devfor that productproject.json— which Nx targets the package implements andimplicitDependencies- E2E specs under
tests/e2e/and screenshots undertests/screenshot/(generator conventions)
Examples
Linting
- JavaScript:
pnpm lint-js→wp-scripts lint-jsusing root ESLint config; fix withpnpm fix-js. - CSS/SCSS:
pnpm lint-css→wp-scripts lint-style; fix withpnpm fix-css. - PHP:
pnpm lint-php→ root Composerlint-php(PHPCS); fix withpnpm fix-php. - Markdown:
pnpm lint-mdfor docs;pnpm fix-mdfor autofix.
Testing
- E2E:
npx nx run <project>:test-e2e(depends onwp-env-startand upstreambuildpernx.json). - PHP integration:
npx nx run <project>:test-integrationruns PHPUnit insidewp-envusing shared config frompackages/phpunit-config.
Build
- Production assets:
npx nx run <project>:build→wp-scripts build, output typicallydist/.
Migration expectation: remove redundant configuration
When importing a standalone repository:
- Delete duplicate lint configs, per-repo GitHub Actions, and redundant Prettier/Stylelint files unless the monorepo root cannot express a needed exception.
- If a one-off rule is required, prefer the smallest local override documented in a comment or package readme rather than forking entire configs.
Documentation site tooling
The docs portal uses VitePress and a sync script (tools/sync-docs.mjs). Package docs remain in plugins/<slug>/docs/ and themes/<slug>/docs/. See Documentation site.