wp-cli / scaffold-package-command

Scaffolds WP-CLI commands with functional tests, full README.md, and more.
MIT License
68 stars 19 forks source link

Scaffold command fails #167

Closed kirtangajjar closed 6 years ago

kirtangajjar commented 6 years ago

I tried scaffolding a command. It fails with following message:

➜  wp-cli git:(master) ✗ bin/wp scaffold package wp-cli/hello --dir=hello-command
Success: Created package files in hello-command
Success: Created package test files.
Success: Created package readme.
Success: Created package GitHub configuration.
Installing package wp-cli/hello (dev-master)
Updating /Users/apple/.wp-cli/packages/composer.json to require the package...
Registering /Users/apple/code/rtcamp/wp-cli/hello-command as a path repository...
Using Composer to install the package...
---
Loading composer repositories with package information
Updating dependencies
Resolving dependencies through SAT
Dependency resolution completed in 0.004 seconds
Your requirements could not be resolved to an installable set of packages.
Problem 1
    - Installation request for wp-cli/wp-cli 2.0.0-alpha -> satisfiable by wp-cli/wp-cli[2.0.0-alpha].
    - wp-cli/hello 9999999-dev requires wp-cli/wp-cli ^1.1.0 -> satisfiable by wp-cli/wp-cli[1.5.x-dev, v1.1.0, v1.2.0, v1.2.1, v1.3.0, v1.4.0, v1.4.1,v1.5.0].
    - Can only install one of: wp-cli/wp-cli[1.5.x-dev, 2.0.0-alpha].
    - Can only install one of: wp-cli/wp-cli[v1.1.0, 2.0.0-alpha].
    - Can only install one of: wp-cli/wp-cli[v1.2.0, 2.0.0-alpha].
    - Can only install one of: wp-cli/wp-cli[v1.2.1, 2.0.0-alpha].
    - Can only install one of: wp-cli/wp-cli[v1.3.0, 2.0.0-alpha].
    - Can only install one of: wp-cli/wp-cli[v1.4.0, 2.0.0-alpha].
    - Can only install one of: wp-cli/wp-cli[v1.4.1, 2.0.0-alpha].
    - Can only install one of: wp-cli/wp-cli[v1.5.0, 2.0.0-alpha].
    - Installation request for wp-cli/hello dev-master -> satisfiable by wp-cli/hello[9999999-dev].
Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.
---
Error: Package installation failed (Composer return code 2).
Reverted composer.json.
schlessera commented 6 years ago

This happens because we tagged the new source with v2.0.0-alpha, which is a breaking change to Composer of course. The packages require 1.x.x.

We need to discuss how best to handle this. Options are:

Option A. is probably the easier one, but B is the one that correctly uses the dependency resolutions in Composer, so I tend to prefer B.

We can add command releases that are compatible to v2.x.x for now, and when we're introducing breaking changes that won't work with a specific command, we can adapt that command to require v1.x.x only.

schlessera commented 6 years ago

Going through the code, I noticed that this has nothing to do with the branch alias or a tagged release.

In the package manager, we're manually setting the required version for the framework to WP_CI_VERSION: https://github.com/wp-cli/package-command/blob/1a3eefa19d137b9587b75d419b3762d587ac2130/src/Package_Command.php#L302

This could should be adapted for to not take over the v2.x.x signature, as our packages are not ready yet.

schlessera commented 6 years ago

Working on a fix now: https://github.com/wp-cli/package-command/pull/70 It will take a few PR-back-and-forth until we have a new tagged version of the wp-cli/package-command, which is the culprit.

schlessera commented 6 years ago

@kirtangajjar The next nightly should fix this.