This file contains information about the project and serves as a guide for those interested in contributing.
To test your changes, set up a local WordPress installation, clone this repository, and create a symlink to the plugin directory:
ln -s /your-local-path-to-repo/prosopo-procaptcha ./wp-content/plugins/prosopo-procaptcha.
This will add the plugin to the list of installed plugins. Before activating it, make sure to build the assets:
cd assets; corepack use yarn@latest; yarn build:all
The project follows the WordPress Coding Standards.
Configure your IDE to use the PHP_CodeSniffer and use the
php-tools/code-quality/wp-ruleset.xml config, or run the following command to automatically fix style issues:
cd php-tools/code-quality; composer install; composer phpcbf
The project uses Prettier as a formatter. Configure your IDE to use the assets/.prettierrc, or
run the following command to automatically fix style issues:
cd assets; corepack use yarn@latest; yarn prettier:fix
The project uses PHPStan for static analysis. Configure your IDE with the
php-tools/code-quality/phpstan.neon config or run the analysis using the following command:
cd code-quality-tools; composer install; composer phpstan
The project uses EELint for static analysis. Configure your IDE with the
assets/eslint.config.mjs config or run the analysis using the following command:
cd assets; corepack use yarn@latest; yarn lint:fix
Please open your Pull Requests against the main branch.
The plugin assets setup uses Vite and supports its Hot Module Replacement feature. To use HMR:
- Start Vite dev server:
cd assets; yarn [settings/integrations]:dev - Update your local
wp-config.phpto add the dev mode constant:define("PROSOPO_PROCAPTCHA_DEV_MODE", true);
The dev mode constant tells the plugin to use the Vite dev server (http://localhost:5173) as the assets source,
instead of the default /dist folder.
Additionally, the plugin will automatically enqueue the Vite reloader script (http://localhost:5173/@vite/client) on
pages with any assets in use, so the Vite HMR will function as usually.
To debug any scripts that come from the plugin (like widget, admin settings page, etc) add _wp_procaptcha_debug_mode
item with any value to the localStorage. It'll enable the debug mode.
Common:
bash tools/check-code-quality.sh- runs all the code-quality checks, for both PHP and JavaScript
JavaScript-related:
cd assets and:
yarn [settings/integrations]:build- runs Vite buildingyarn [settings/integrations]:dev- starts Vite dev serveryarn lint:[check/fix]- runs ESLint static code analysesyarn prettier:[check/fix]- runs Prettier formatter
PHP-related:
cd tools and:
bash check-code-quality.sh codesniffer- checks for WordPress Coding Standards violationsbash check-code-quality.sh phpstan- runs PHPStan static code analysesbash check-code-quality.sh pest- runs Pest tests
If you're a package maintainer, read the for-maintainers.md file to get additional information about the project.