Thanks for taking the time to contribute!
To start, clone this repository into any WordPress install being used for development:
git clone git@github.com:xwp/pwa-wp.git wp-content/plugins/pwa
cd wp-content/plugins/pwa
npm install
Running npm install
will also automatically run composer install
; a pre-commit
hook will also automatically be installed for you via husky.
You may then just activate the plugin in the admin or via WP-CLI: wp plugin activate pwa
.
Your WordPress install must be configured to serve responses over HTTPS. Without this, your browser will refuse to install the service worker. The exception here is if your WordPress install is located at localhost
, in which case HTTPS is not required. But in general, WordPress development environments are often located at domains example.test
or example.local
, and for them:
- On VVV, see Setting Up HTTPS.
- On Local by Flywheel, installation of SSL certificates is supported in the UI.
- On Chassis, see Add and configure OpenSSL.
Pull requests will be checked against WordPress-Coding-Standards with PHPCS, and for JavaScript linting is done with ESLint. The pre-commit
hook will runs these tests will automatically prior to pushing.
To create a build of the plugin for installing in WordPress as a ZIP package, do:
npm run build
This will create an pwa.zip
in the plugin directory which you can install. The contents of this ZIP are also located in the build
directory which you can rsync
somewhere as well.
Please run these tests in an environment with WordPress unit tests installed, like VVV.
Run tests:
$ phpunit
Run tests with an HTML coverage report:
$ phpunit --coverage-html /tmp/report
When you push a commit to your PR, Travis CI will run the PHPUnit tests and sniffs against the WordPress Coding Standards.
Contributors who want to make a new release, follow these steps:
- Do
npm run build
and install thepwa.zip
onto a normal WordPress install running a stable release build; do smoke test to ensure it works. - Bump plugin versions in
package.json
(×1),package-lock.json
(×1, just donpm install
first),composer.json
(×1), and inpwa.php
(×2: the metadata block in the header and also thePWA_VERSION
constant). - Add changelog entry to readme.
- Draft blog post about the new release, presumably on Make/Core.
- Draft new release on GitHub targeting the release branch, with the new plugin version as the tag and release title. Attaching the
pwa.zip
build to the release. Include link to changelog in release tag. - Run
npm run deploy
to to commit the plugin to WordPress.org. - Confirm the release is available on WordPress.org; try installing it on a WordPress install and confirm it works.
- Publish GitHub release.
- Create built release tag:
git fetch --tags && git checkout $(git tag | tail -n1) && ./bin/tag-built.sh
(then add link from release) - Merge release tag into
master
. - Publish release blog post, including link to GitHub release.
- Close the GitHub milestone and project.
- Make announcements.