Skip to content

Latest commit

 

History

History
104 lines (72 loc) · 2.71 KB

CONTRIBUTING.md

File metadata and controls

104 lines (72 loc) · 2.71 KB

Contribute

This repo provides a development environment that facilitates:

  • Developing the browser extension, using the web-ext tool.
  • Developing the WordPress plugin that is used under WordPress Playground, using wp-env.

Development environment - Browser extension

First install required dependencies:

npm install

Then build the extension:

npm run build:firefox
# or
npm run build:chrome

You can then use the start script to start a browser instance separate from your main instance that has the extension automatically installed:

npm run start:firefox
# or
npm run start:chrome

The extension will also automatically reload whenever you modify source files.

Please note that at the moment not all web-ext features work on chrome, so firefox is the recommended browser for developing this project, since it provides the best developer experience. One example of a web-ext feature that doesn't currently work on chrome is to have the developer tools and extension console automatically open when the extension loads.

Development environment - WordPress plugin

First install required dependencies:

composer install

The development environment requires wp-env, you can install it with:

npm install -g @wordpress/env

Start the development environment:

composer run dev:start

You will need docker engine running for this command to work, since wp-env uses container that runs on docker engine. This command starts the WordPress environment and sets up the permalink structure.

To stop the development environment:

composer run dev:stop

Additionally, there is also support for xdebug, phpcs and phpcbf:

For debugging with Xdebug:

composer run dev:debug

To run linting on the codebase:

composer run lint

To automatically fix linting issues:

composer run lint:fix

Building for production

You can build both the firefox and chrome versions of the extension with the following command. The resulting files will be under the build/firefox and build/chrome directories, respectively.

npm run build

We would soon have the build & release pipeline for publishing the plugin to WP.org repo.

Running tests

You can run tests with:

For browser extension:

npm run test

For WordPress plugin:

composer run dev:test

This command runs the tests in the WordPress environment using PHPUnit.