WordPress Feature flags plugin allow developers to configure features in plugins/themes behind the feature flags on both the server (PHP) and client (JS/TS) side.
The filter controls whether the new flag is enabled by default or not. Default true
Example usage:
addFilter('mrFeatureFlags.newFlag.defaultStatus', 'mr-feature-flags', () => {
return false;
});
To build the plugin
PHP setup
composer install
JS setup
yarn install
yarn build
to create the buildyarn start
to start the development watch mode
PHP
composer lint
- To auto fix the linting errors
composer lint:fix
💡 VSCode extension to auto format PHP files based on phpcs.xml.dist
configuration
JS
yarn lint:js
💡 VSCode extension to auto format JS / TS files based on .prettierrc
configuration
CSS
yarn lint:css
- To auto fix the css linting errors
yarn lint:css:fix
- Run
./local
from your preferred CLI. Ensure you have Docker installed and running. - The setup will automatically ssh into the container.
- To run unit tests
composer run test:unit
- To run integrations tests
composer run test:integration
- To run integrations tests as multisite
composer run test:multisite
- Run
yarn test:js
which will run all jest and React Testing Library tests
The E2E tests depends on wp-env
setup. Ensure you run wp-env start
before running the tests.
- Run
yarn test:e2e
which will run all Playwright e2e tests.