site-kit-wp icon indicating copy to clipboard operation
site-kit-wp copied to clipboard

Composer tweaks

Open aaemnnosttv opened this issue 7 years ago • 5 comments

Feature Description

This issue proposes a few minor changes to the composer.json file:

  1. The composer.json file currently contains a version key. 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.

  2. Regarding the scripts section, the vendor/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 in composer.json.

Implementation Brief

  • Remove the vendor/bin/ prefix from lint and lint-fix commands in composer.json

Per @swissspidy's comment

  • Set sort-packages config to true (and sort existing requires)
  • Add roave/security-advisories to require-dev
  • Replace phpcompatibility/php-compatibility with phpcompatibility/phpcompatibility-wp
    phpcompatibility/php-compatibility will still be installed, but as a dependency of the WP variant
  • Adding required PHP extensions to require
    • ext-json
    • ext-openssl
    • what else?

Changelog entry

  • N/A

aaemnnosttv avatar Jul 03 '19 16:07 aaemnnosttv

As for the version number, the same goes for package.json, especially when the package is not published on npm.

swissspidy avatar Jul 04 '19 07:07 swissspidy

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.

felixarntz avatar Oct 28 '19 13:10 felixarntz

There are some other configuration changes that might be useful in composer.json:

  • Adding required PHP extensions to require
  • Adding roave/security-advisories as a dev dependency
  • Require phpcompatibility/phpcompatibility-wp instead of phpcompatibility/php-compatibility
  • Set config.sort-packages to true

swissspidy avatar Oct 28 '19 13:10 swissspidy

IB ✅

felixarntz avatar Nov 04 '19 14:11 felixarntz

Confirmed that composer functions after installing homebrew and running brew install php

Verified .zip was functional and able to update builds properly.

Passed QA ✅

cole10up avatar Jan 08 '20 05:01 cole10up