The WordPress plugin is called The Shorthand Editor, and uses the
short name the-shorthand-editor internally and for translation.
See the accompanying LICENSE file to understand how development and distribution is permitted.
A production release is built and deployed when a version tag is
pushed to the repository. The CircleCI production-release workflow
is gated on tags and handles bundling, uploading to the production
S3 bucket, creating a GitHub release, and invalidating CloudFront.
Pushes to master trigger a non-production bundle and upload via
the wp-plugin-workflow; no production branch is used.
The following release checklist should be observed before tagging:
- The version should be updated in all relevant places (See Version).
- The changelog should be updated in
./deploy/update.json. - Tag
masterwith the new version number and push the tag. Thetag:releasescript inpackage.jsonreads the version fromdeploy/update.jsonand pushes the tag for you.
The version of the plugin is currently stored in several files:
- The top-level plugin file,
php/src/the-shorthand-editor.php - The
Version.phpconstant,php/src/lib/Core/Version.php - The update-check file,
deploy/update.json - The WordPress directory file,
php/src/readme.txt
When performing a release, the version of the plugin should be updated in all these places.
The plugin is written in PHP and TypeScript. No additional PHP tooling is
needed to serve the plugin locally (see below). Its TypeScript components
are built with ESBuild, during pnpm build.
It can be bundled as a ZIP for distribution or remote testing.
The source for the plugin does not need any additional PHP tooling to bundle the plugin for distribution (see Distribution).
Other tasks such as dependency management or compatibility checking require
the composer tool, which may be installed via homebrew.
brew install composerDependency libraries are pinned in the composer.lock file, but may be
updated by running composer update from the php directory (see Third-
party dependencies for more information).
Note: the use of magento/php-compatibility-fork works around a bug in phpcompatibility/php-compatibility
version 9.3.5 which, while fixed in version 10, would cause a conflict with other
dependencies over squizzlabs/php_codesniffer.
The plugin supports a minimum PHP version of 7.4.
Although this is higher than the initial target of 7.2, this may still
present some hurdles when developing in the presence of later language features.
Therefore, consider the following utilities defined in composer.json
which may be run from within the php directory with composer installed.
After making PHP source modifications, consider downcompiling the source
to the earlier PHP language version. Note that this modifies source in place,
so treat this command as if it were destructive and manage the risk, e.g. by
adding your php/src directory to your Git index.
composer run-script downcompileBefore committing your PHP changes, check the source against the compatibility rules for the lower language version.
composer run-script check-7.2For the PHP unit tests, run the following command from within the php
directory.
composer testBest practices for WordPress plugins recommend bundling third-party library dependencies in a custom namespace to avoid version conflicts between plugins.
The plugin depends on the firebase/php-jwt library for signin JWTs. To
incorporate an updated version of the library (and any others), run the
following command from the php directory.
composer run-script prefix-dependenciesThis will additionally downcompile the source to the lower version of the PHP
language, namespace it under the Shorthand\Vendor namespace, and copy it into
the src/vendor_prefixed directory. These files are checked in, as they are
pinned, and are distributed as a part of the plugin under their declared licenses.
The top-level docker-compose.yml file brings up a local WordPress stack at
http://localhost:4577/wordpress.
pnpm build
docker compose upInteroperation with Shorthand requires SSL, so the container should be proxied,
although this is not set up in this repository. The home and site URLs set up by
the container assume the proxy is at https://localhost:9443/wordpress.
To generate the meta.json file, run
METAFILE=1 pnpm buildThe docker-compose.yml file also contains a profile with an older combination
of WordPress and PHP, wp60_php72. This opens up a WordPress instance on port 4578.
The plugin can be bundled as a ZIP file. This is the most convenient way to share the file for testing or distribution.
To generate a ZIP file of the WordPress plugin for distribution, run
NODE_ENV=production pnpm bundleWhen bundling, the meta.json file will be generated in
the dist folder when METAFILE=1 is specified.