Composer tweaks
Feature Description
This issue proposes a few minor changes to the composer.json file:
-
The
composer.jsonfile currently contains aversionkey. This is recommended to be omitted according to the schema. Unless this is necessary for some reason, it's better for this to be inferred from VCS. -
Regarding the
scriptssection, thevendor/bin/prefix on the commands is unnecessary and generally a good idea to omit as the location of the vendor directory is configurable. As noted in the documentation for writing custom commands:
Before executing scripts, Composer's bin-dir is temporarily pushed on top of the PATH environment variable so that binaries of dependencies are easily accessible.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- Remove the
vendor/bin/prefix on the commands incomposer.json.
Implementation Brief
- Remove the
vendor/bin/prefix fromlintandlint-fixcommands incomposer.json
- Set
sort-packagesconfig totrue(and sort existing requires) - Add
roave/security-advisoriestorequire-dev - Replace
phpcompatibility/php-compatibilitywithphpcompatibility/phpcompatibility-wp
phpcompatibility/php-compatibilitywill still be installed, but as a dependency of the WP variant - Adding required PHP extensions to
requireext-jsonext-openssl- what else?
Changelog entry
- N/A
As for the version number, the same goes for package.json, especially when the package is not published on npm.
Regarding the version number in composer.json and package.json, I just removed that in https://github.com/google/site-kit-wp/commit/246842c90d7cf678e310b7b2ca79af44478923c5. That leaves us with just the second point for this one.
There are some other configuration changes that might be useful in composer.json:
- Adding required PHP extensions to
require - Adding
roave/security-advisoriesas a dev dependency - Require
phpcompatibility/phpcompatibility-wpinstead ofphpcompatibility/php-compatibility - Set
config.sort-packagestotrue
IB ✅
Confirmed that composer functions after installing homebrew and running brew install php
Verified .zip was functional and able to update builds properly.
Passed QA ✅