There are many ways to contribute to this project.
- Discuss open issues to help define the future of the project.
- Submit bugs and help us verify fixes as they are checked in.
- Review and discuss the source code changes.
- Contribute bug fixes
/docs
- Documentation/packages
- NPM packages/plugins
- WordPress Plugins
When working on the npm packages in this repository, use our Lerna setup from the project root:
- Ensure that
.env.local
exists and is correctly configured inexamples/getting-started
andexamples/preview
. npm run bootstrap
npm run dev
When switching git branch, run npm run clean
from the root and then re-run npm run bootstrap
.
As this is a monorepo, you will not be able to check out this repository into wp-content/themes
or wp-content/plugins
.
Instead, you can create symlinks to the themes/plugins in this repository. Best of all, this will also sync your work across multiple local sites!
Setup To begin working with the WPE Headless WordPress plugin, you will need to symlink the plugin from the monorepo to your WordPress plugin development directory.
ln -s /path/to/headless-framework/plugins/wpe-headless /path/to/wordpress/wp-content/plugins/wpe-headless
PHP Code Sniffer PHP Code Sniffer is configured for the WordPress code standards.
Install the composer packages from within wpe-headless
directory if you haven't already.
composer install
Run the syntax check.
composer phpcs
Use phpcs
to fix some syntax errors:
composer phpcs:fix
WordPress Unit Tests To run WordPress unit tests, set up the test framework:
/bin/bash /path/to/headless-framework/plugins/wpe-headless/tests/install-wp-tests.sh wpe_headless_tests db_name db_password
If you connect to MySQL via a sock connection, you can run the following.
/bin/bash /path/to/headless-framework/plugins/wpe-headless/tests/install-wp-tests.sh wpe_headless_tests db_name db_password localhost:/path/to/mysql/mysqld.sock
Install the composer packages from within wpe-headless
directory if you haven't already.
composer install
Within the wpe-headless
directory, run phpunit
either directly or as a composer command:
vendor/bin/phpunit
or
composer test
Use Codeception for running end-2-end tests in the browser.
- Install Composer.
- Within the
plugins/wpe-headless
directory, runcomposer install
.
- Within the
- Install Google Chrome.
- Install Chromedriver
- The major version will need to match your Google Chrome version. See Chromedriver Version Selection.
- Unzip the chromedriver zip file and move
chromedriver
application into the/usr/local/bin
directory.mv chromedriver /usr/local/bin
- In shell, run
chromedriver --version
. Note: If you are using OS X, it may prevent this program from opening. Open "Security & Privacy" and allow chromedriver. - Run
chromedriver --version
again. Note: On OS X, you may be prompted for a final time, click "Open". When you can see the version, chromedriver is ready.
- From within the headless site
examples/getting-started
copy.env.test.sample
to.env.test
.- If you are using the provided Docker build, you will not need to adjust any variables in the
.env.testing
file; else, you can adjust the environment variables as needed.
- If you are using the provided Docker build, you will not need to adjust any variables in the
- Move into the WPE Headless plugin directory
plugins/wpe-headless
. - Prepare a test WordPress site.
- We have provided a Docker build to reduce the setup needed. You are welcome to set up your own WordPress end-2-end testing site.
- Install Docker.
- Run
docker-compose up -d --build
. If building for the first time, it could take some time to download and build the images. - Run
docker-compose exec --workdir=/var/www/html/wp-content/plugins/wpe-headless --user=www-data wordpress wp plugin install wp-graphql --activate
- Run
docker-compose exec --workdir=/var/www/html/wp-content/plugins/wpe-headless --user=www-data wordpress wp db export tests/_data/dump.sql
- We have provided a Docker build to reduce the setup needed. You are welcome to set up your own WordPress end-2-end testing site.
- Copy
.env.testing.example
to.env.testing
.- If you are using the provided Docker build, you will not need to adjust any variables in the
.env.testing
file. - If you are not using the provided Docker build, edit the
.env.testing
file with your test WordPress site information.
- If you are using the provided Docker build, you will not need to adjust any variables in the
- Run
vendor/bin/codecept run acceptance
to start the end-2-end tests.
- Codeception Acceptance Tests
- Base framework for browser testing in php.
- WPBrowser
- WordPress framework wrapping Codeception for browser testing WordPress.
Developers with full GitHub repository access can create public releases:
- Update the
Version
in the file header atplugins/wpe-headless/wpe-headless.php
. - Update the changelog and 'stable tag' in
plugins/wpe-headless/readme.txt
. - Commit and push your changes for review.
- Tag the approved commit with
plugin/wpe-headless/[version]
, for example:git tag plugin/wpe-headless/0.3.5
and push the tag (git push --tags
). Or use GitHub to create a new release with that tag.
CircleCI will build and deploy the plugin zip. The latest version will be available here:
https://wp-product-info.wpesvc.net/v1/plugins/wpe-headless?download
- Update the
version
inpackages/headless/package.json
. - Update the changelog at
packages/headless/CHANGELOG.md
. - Commit and push your changes for review.
- Tag the approved commit with
package/headless/[version]
, for example:git tag package/headless/0.6.1
and push the tag (git push --tags
). Or use GitHub to create a new release with that tag.
CircleCI will build and deploy the package to npm. The updated package will be visible here:
https://www.npmjs.com/package/@wpengine/headless
To publish the package and plugin together, tag the commit you want to publish with two different tags in the above formats, then push the tags:
git checkout canary
git pull
git tag plugin/wpe-headless/1.0.0
git tag package/headless/1.0.0
git push --tags
This triggers the CircleCI jobs to publish the package and plugin.