Skip to content

Latest commit

 

History

History
85 lines (54 loc) · 2.83 KB

getting-started.md

File metadata and controls

85 lines (54 loc) · 2.83 KB

Getting Started

Requirements

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 install

Note: Using nvm is recommended, as it makes it easier to stay up-to-date with any Node.js version requirement changes in the project.

Development

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 make

or

sudo apt-get install build-essential

To install all the required composer packages, run:

composer install

To install all the required npm packages, run:

npm install

Whether 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 dev

This 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 serve

This 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:js

Local Environment

You will need a WordPress environment to run the plugin. Check out the Local Environment document for details on how to set one up.