Setup

Tools

  • Node.js 22 (20–24 work; newer majors make one of wp-env's dependencies compile from source) and npm
  • Docker, running, for the local WordPress sites
  • Composer, for PHP linting and the PHP tests

First run

git clone https://github.com/jmwerk/glidepress-slider.git
cd glidepress-slider
npm install
composer install
npm run build          # the blocks don't register until build/ exists
npm run env -- start   # WordPress at http://localhost:8888, admin / password

Starting the site also seeds a Slider Kitchen Sink page with one slider per configuration the tests cover. The repository is mounted as the plugin, so after npm run build (or while npm run start watches) a reload shows your change.

Everyday commands

Command Does
npm run start Rebuild on every change
npm run build Production build into build/
npm test Unit and block-validity tests (Jest)
npm run test:e2e End-to-end tests against the local site
npm run test:php PHP integration tests (needs npm run env:test -- start)
npm run lint:js, npm run lint:css, composer lint Linters
npm run size Check compiled assets against their size budgets
npm run patterns Regenerate patterns/*.php after a change to saved markup
npm run seed:kitchen-sink Rebuild the kitchen-sink page (replaces edits made to it)
npm run env -- run cli -- wp <command> WP-CLI against the local site
npm run makepot Regenerate the translation template

Don't run npm run format: it reflows many files unrelated to your change. The linters are the formatting check.

Two local sites

Site Port Used by
Development (.wp-env.json) 8888 You, and the end-to-end tests
PHP tests (.wp-env.test.json) 8889 npm run test:php only

They have separate databases, so running the PHP tests never disturbs the site you are looking at.

On Windows

Everything runs from Git Bash or PowerShell. The working copy checks out with Windows line endings, which PHPCS reports locally as an error on line 1 of each file; CI checks out Unix line endings and doesn't.