Skip to content

Latest commit

 

History

History
80 lines (50 loc) · 4.44 KB

available-commands.md

File metadata and controls

80 lines (50 loc) · 4.44 KB

Available Commands

To install all dependencies from npm and composer for all wp-modules in your plugin run this command:

sh pluginade.sh install

To remove node_modules and vendor directories for all wp-modules in your plugin and re-install all dependencies from npm and composer run this command:

sh pluginade.sh install:clean

To lint your plugin's PHP code using WordPress Coding Standards, run this command:

sh pluginade.sh lint:php

If you want to override any WordPress Coding Standards for your project, add your own custom phpcs.xml file to the root of your plugin, and Pluginade will use that.

To automatically fix any PHP issues that can be autofixed to conform with WordPress Coding Standards, run this command:

sh pluginade.sh lint:php:fix

To lint your plugin's CSS code using WordPress's standards, run this command:

sh pluginade.sh lint:css

To automatically fix any CSS issues that can be autofixed to conform with WordPress's standards, run this command:

sh pluginade.sh lint:css:fix

To lint your plugin's Javascript code using WordPress's standards, run this command:

sh pluginade.sh lint:js

If you want to override any javascript standards in your own plugin, ass your own .eslintrc file to the root of your plugin, and Pluginade will use that.

To automatically fix any Javascript issues that can be autofixed to conform with WordPress's standards, run this command:

sh pluginade.sh lint:js:fix

To run PHPUnit on your plugin's code, run this command:

sh pluginade.sh test:phpunit

That will find any files which end with Test.php, and run the tests within them.

Running PHPUnit for a specific test file only

To run the tests inside a specific test file in your plugin, provide a --path argument, starting at your plugin's root. For example, if you have a test inside your plugin located at wp-modules/sample-module//tests/MyPhpUnitTest.php, you can run only the tests in that file like this:

sh p.sh test:phpunit --path=wp-modules/api-generate-module/tests/SampleTest.php

Note that you need to pass the --path argument first if you wish to pass additional values to PHPUnit.

Running all PHPUnit tests for a specific directory file only

You can easily run all tests in a specific directory by providing the path to that directory like this: sh p.sh test:phpunit --path=wp-modules/api-generate-module

That will find and run all PHPUnit tests no matter where they exist within that directory, or its subdirectories.

Passing other PHPUnit arguments

PHP unit includes many other options, and you can pass those alongside your call. For example, if you want to use the --filter option to only run tests from the SampleTest class, do this:

sh p.sh test:phpunit --filter=SampleTest

Note that not all of the available options for PHPUnit make sense to use here. For example, Pluginade Scripts already provides a --bootstrap and -c|--configuration to make it work with the underlying WordPress docker container, so passing those isn't advised.

To run Jest tests on your plugin's Javascript code, run this command:

sh pluginade.sh test:js

Note: If you want to provide your own custom Jest coniguration, add a jest.config.js file to your plugin's root directory, and Pluginade will use that.

To run end-to-end Playwright tests on your plugin:

sh pluginade.sh test:playwright

Note: If you want to provide your own custom Jest coniguration, add a playwright.config.ts file to your plugin's root directory, and Pluginade will use that.

To run a security scan on the plugin's PHP code using only security sniffs enabled from WordPress Coding Standards, run this command.

sh pluginade.sh security:php

Note: At this time there isn't a way to run only tests in a single file, it just runs all of the tests in the plugin. This functionality is on the road map for pluginade in the future.

To build your plugin with webpack, run this command:

sh pluginade.sh build

To put your plugin into webpack development mode, run this command:

sh pluginade.sh dev

To create a zip of your plugin, run this command

sh pluginade.sh zip

Note that you can add a .zipignore file to the root of your plugin to control what files are not included in the zip. Pluginade includes a default zipignore which removes things usually not desired (like node_modules directories), but this can be overridden.