Skip to content

Latest commit

 

History

History
58 lines (38 loc) · 2.83 KB

File metadata and controls

58 lines (38 loc) · 2.83 KB

Contributing

Contributions are greatly appreciated. You can help in several ways:

Requirements & Recommendations

When contributing code specifically, please keep the following in mind:

This project provides workflows for:

  • running integration tests (using PHPUnit)
  • checking coding and documentation standards (using PHPCodeSniffer).
  • static analysis (using PHPStan).

It is also integrated with GitHub Actions to ensure those always pass.

PHPUnit and PHPCS Workflows

It is recommended to run integration tests and PHPCodeSniffer locally before committing, to check in advance that your changes do not cause unexpected issues. Here is how you can do that:

  • composer install: Set up all plugin dependencies
  • vendor/bin/phpunit: Run the integration tests.
  • vendor/bin/phpcs: Check against the WordPress Coding Standards.

JavaScript and CSS Build Pipeline

This plugin uses @wordpress/scripts for building, linting, and minifying JavaScript and CSS assets. Both source and minified versions are located in wp-multi-network/assets/.

To work with JavaScript and CSS:

  • npm install: Install Node.js dependencies (Node.js 20+ required)
  • npm run build: Build minified production-ready assets from source files
  • npm run start: Start development mode with file watching and hot reload
  • npm run lint:js: Lint JavaScript files
  • npm run lint:css: Lint CSS files
  • npm run format: Auto-format JavaScript and CSS files

The asset structure:

  • Source files (edit these): wp-multi-network.js, wp-multi-network.css, wp-multi-network-rtl.css (unminified, for debugging)
  • Minified files (auto-generated): wp-multi-network.min.js, wp-multi-network.min.css, wp-multi-network-rtl.min.css (production)

The plugin automatically loads source files when WP_SCRIPT_DEBUG is enabled, otherwise it loads minified versions.

Important: Edit the non-minified source files in wp-multi-network/assets/. The minified .min.js and .min.css files are automatically generated by the build process and should not be edited directly.

Writing Integration Tests

  • Integration tests go into the tests/integration/tests directory.
  • File names must be prefixed with test-.
  • Each test class must extend the WPMN_UnitTestCase class.