#43558 closed enhancement (fixed)
Add `composer.json` file for development dependencies
Reported by: | clarinetlord | Owned by: | pento |
---|---|---|---|
Milestone: | 5.1 | Priority: | normal |
Severity: | normal | Version: | 5.1 |
Component: | Build/Test Tools | Keywords: | has-patch |
Focuses: | Cc: |
Description
I understand #43449 and why a composer.json isn't part of the release package or part of https://github.com/WordPress/Wordpress, but I don't see any reason why a basic composer.json file couldn't be a part of the core project.
It would live at the root alongside all the other config files, and wouldn't need any dependencies (yet). The main benefit at present would be for it to show up in https://github.com/WordPress/wordpress-develop so others (like myself) can use it more easily in composer-built projects ran against the core test suite, like for plugin development.
Attachments (2)
Change History (14)
#1
follow-up:
↓ 2
@
7 years ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
#2
in reply to:
↑ 1
@
7 years ago
- Resolution duplicate deleted
- Status changed from closed to reopened
Replying to swissspidy:
Duplicate of #23912.
This ticket that you marked mine a duplicate of is different than mine. I'm not proposing adding composer.json
to the distribution package as #23912 is discussing. I think @JohnPBloch's mirror works just fine for production WordPress dependency management. I'm suggesting only adding a composer file to the root of the develop repo, alongside package.json and the other config/meta files.
#4
follow-up:
↓ 10
@
6 years ago
Copying in @GaryJ's ticket:23912#comment:98 for further context:
Treating WordPress as a dependency of a site may not be the prevalent use case across all WP installs, but it is popular and handy for those that have taken that approach. I personally use WPStarter but other wrappers of WP are available too.
Something not mentioned so far, and that has changed since this ticket has started, is the use of PHP_CodeSniffer. Obviously, PHPUnit has been in use since before this ticket as well.
These core development dependencies should be documented in the
composer.json
require-dev
section, so that we explicitly declare and isolate dependencies. Running versions earlier than PHP_CodeSniffer 3.2 will cause different results than 3.2+, for instance. WP should not be relying on globally installed dependencies of varying versions.
The
.travis.yml
files shows PHPUnit can be used at version 4, 5 or 6, depending on the PHP version available - and that's great, but get it down in acomposer.json
, and acomposer install
means that the switch statement can be dropped, and developers working locally can get the right version too.
Whatever the rest of the
composer.json
does or doesn't do for the external benefit of those consuming this package, having a simplecomposer.json
which lists the development dependencies gives internal benefit to contributors and automated tools.
#5
@
6 years ago
- Keywords has-patch added
- Milestone changed from Awaiting Review to 5.0
- Owner set to pento
- Status changed from reopened to reviewing
- Summary changed from Add composer.json file to Add `composer.json` file for development dependencies
I discussed this with @pento today, and we are both in agreement in landing this for WP 5.0
The 43558.diff patch installs the following require-dev
packages:
squizlabs/php_codesniffer
- PHPCSwp-coding-standards/wpcs
WordPress PHP Coding Standards for - PHPCSdealerdirect/phpcodesniffer-composer-installer
- PHPCS ruleset installer
Additional Composer require-dev
packages can be considered in new tickets on a case-by-case basis.
Related: #43218 PHPUnit 7.x support
Related: 41057-grunt.diff
#7
@
6 years ago
@netweb: could you open a new ticket for:
- Fixing the coding standards issues that
compose run-script format
finds. - Adding a
grunt precommit
task to run theformat
script. - Adding a new Travis job that checks that running the
format
script doesn't change anything.
#8
@
6 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Minor, but can we update the description to match the new tagline on w.org?
WordPress is open source software you can use to create a beautiful website, blog, or app.
#10
in reply to:
↑ 4
@
6 years ago
Replying to netweb:
Copying in @GaryJ's ticket:23912#comment:98 for further context:
The
.travis.yml
files shows PHPUnit can be used at version 4, 5 or 6, depending on the PHP version available - and that's great, but get it down in acomposer.json
, and acomposer install
means that the switch statement can be dropped, and developers working locally can get the right version too.
A note for anyone who tries to tackle this: The concept of conditional dependencies does not exist in Composer, which is why this logic is in .travis.yml
and why (AFAIK) we can't add PHPUnit as a Composer dependency.
#11
@
6 years ago
Could we add https://github.com/WordPress/wordpress-develop to the wordpress
vendor on Packagist? Who has access to do that?
Duplicate of #23912.