|
4 | 4 | [](https://github.com/codebtech/wp-feature-flags/actions/workflows/js.yml) |
5 | 5 | [](https://github.com/codebtech/wp-feature-flags/actions/workflows/e2e.yml) |
6 | 6 |
|
7 | | -Contributors: Mohan Raj Pachaiyappan |
8 | | -Tags: feature-flags, feature-flag, wp-feature-flags |
9 | | -Requires at least: 6.2 |
10 | | -Tested up to: 6.4 |
11 | | -Stable tag: 1.0.0 |
12 | | -Requires PHP: 7.4 |
13 | | -Contributor link: https://github.com/m0hanraj |
| 7 | +Feature flags allows developers to configure features in plugins/themes behind the feature flags on both Server(PHP) and Client(JS/TS) side.Feature flags allow developers to configure features in plugins/themes behind the feature flags on both the server (PHP) and client (JS/TS) side. |
14 | 8 |
|
15 | | -## Description |
| 9 | +## Hooks |
16 | 10 |
|
17 | | -Feature flags allows developers to configure features behind the feature flags on both Server(PHP) and Client(JS/TS) side. |
| 11 | +### JS Filters |
18 | 12 |
|
19 | | -## Frequently Asked Questions |
| 13 | +##### mrFeatureFlags.newFlag.defaultStatus |
20 | 14 |
|
21 | | -### Does this plugin work with PHP 8? |
| 15 | +The filter controls whether the new flag is enabled by default or not. Default `true` |
22 | 16 |
|
23 | | -Yes, it's actively tested and working up to PHP 8.3 |
| 17 | +Example usage: |
24 | 18 |
|
25 | | -### Does this plugin work with latest WordPress? |
| 19 | +```js |
| 20 | +addFilter('mrFeatureFlags.newFlag.defaultStatus', 'mr-feature-flags', () => { |
| 21 | + return false; |
| 22 | +}); |
| 23 | +``` |
26 | 24 |
|
27 | | -Yes, it's actively tested and working up to WordPress 6.4.3 |
| 25 | +## Development setup |
| 26 | + |
| 27 | +To build the plugin |
| 28 | + |
| 29 | +PHP setup |
| 30 | + |
| 31 | +- `composer install` |
| 32 | + |
| 33 | +JS setup |
| 34 | + |
| 35 | +- `yarn install` |
| 36 | +- `yarn build` to create the build |
| 37 | +- `yarn start` to start the development watch mode |
| 38 | + |
| 39 | +## Linting and formatting |
| 40 | + |
| 41 | +PHP |
| 42 | + |
| 43 | +- `composer lint` |
| 44 | +- To auto fix the linting errors `composer lint:fix` |
| 45 | + |
| 46 | +💡 [VSCode extension](https://marketplace.visualstudio.com/items?itemName=shevaua.phpcs) to auto format PHP files based on `phpcs.xml.dist` configuration |
| 47 | + |
| 48 | +JS |
| 49 | + |
| 50 | +- `yarn lint:js` |
| 51 | + |
| 52 | +💡 [VSCode extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) to auto format JS / TS files based on `.prettierrc` configuration |
| 53 | + |
| 54 | +CSS |
| 55 | + |
| 56 | +- `yarn lint:css` |
| 57 | +- To auto fix the css linting errors `yarn lint:css:fix` |
| 58 | + |
| 59 | +## Testing |
| 60 | + |
| 61 | +### PHP |
| 62 | + |
| 63 | +- Run `./local` from your preferred CLI. Ensure you have Docker installed and running. |
| 64 | +- The setup will automatically ssh into the container. |
| 65 | +- To run unit tests `composer run test:unit` |
| 66 | +- To run integrations tests `composer run test:integration` |
| 67 | +- To run integrations tests as multisite `composer run test:multisite` |
| 68 | + |
| 69 | +### JS |
| 70 | + |
| 71 | +- Run `yarn test:js` which will run all jest and React Testing Library tests |
| 72 | + |
| 73 | +### E2E |
| 74 | + |
| 75 | +The E2E tests depends on `wp-env` setup. Ensure you run `wp-env start` before running the tests. |
| 76 | + |
| 77 | +- Run `yarn test:e2e` which will run all Playwright e2e tests. |
0 commit comments