To contribute to this plugin, you need the following tools installed on your computer:
- PHP - version 7.2 or higher, preferably installed via Homebrew.
- Composer (PHP package manager) - version 2.3 or higher, to install PHP dependencies.
- Node.js (current LTS) - to install JavaScript dependencies.
- WordPress - to run the actual plugin.
- Docker Desktop and Docker Compose - for using the local environment
You should be running a Node version matching the current active LTS release or newer for this plugin to work correctly.
You can check your Node.js version by typing node -v in the Terminal prompt.
If you have an incompatible version of Node in your development environment, you can use nvm to change node versions on the command line:
nvm installNote: Using nvm is recommended, as it makes it easier to stay up-to-date with any Node.js version requirement changes in the project.
First, you need to make sure that all PHP and JavaScript dependencies are installed:
Install Composer by following installation instructions.
Make sure to add composer to your $PATH if it is not already there. The local environment won't run unless composer is in your $PATH.
WSL users may also need to install make. On WSL Ubuntu you should be able to use:
sudo apt-get install makeor
sudo apt-get install build-essentialTo install all the required composer packages, run:
composer installTo install all the required npm packages, run:
npm installWhether you use the pre-existing local environment or a custom one, any PHP code changes will be directly visible during development.
However, for JavaScript this involves a build process. To watch for any JavaScript file changes and re-build it when needed, you can run the following command:
npm run devThis way you will get a development build of the JavaScript, which makes debugging easier.
For watching for any JavaScript file changes and automatically refreshing the app in the browser (React Fast Refresh), use:
npm run serveThis makes for a much better developer experience as you don't have to manually refresh your browser tab every time you make changes.
To get a production build, run:
npm run build:jsYou will need a WordPress environment to run the plugin. Check out the Local Environment document for details on how to set one up.