hechoendrupal / drupal-console

The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal.
http://drupalconsole.com
GNU General Public License v2.0
940 stars 559 forks source link

Package type "drupal-console-library" is not supported #4210

Open nvaken opened 4 years ago

nvaken commented 4 years ago

Issue title

Package type "drupal-console-library" is not supported

Problem/Motivation

A few years back we developed a Drupal Console extending package. This package extends Drupal Console by defining itself as a drupal-console-library package type, as discussed by me and @jmolivas here and illustrated by the repository drupal-console-extend-example.

This has worked like a charm for years, but somehow, since a few months, our composer updates seem to fail with the message Package type "drupal-console-library" is not supported. I'm not sure what introduced this change, but I'm also seeing that drupal-console-dotenv is even removing this package type to make this error go away. As far as I can tell, we need that type to make sure we are even able to extend our commands?

I'll be testing the removal of the type attribute of our package and if it influences the functionality, but still am opening this issue since I'm not sure why I'm even trying to remove it.

Details to include:

jmolivas commented 4 years ago

@nvaken this could be related to some changes introduced by @enzolutions and @harold20 I am pinging them since they should have a better answer and what could be the best fit.

hjuarez20 commented 4 years ago

Hi @nvaken We created a custom composer-installer for drupal-cosnole-library in https://github.com/hechoendrupal/drupal-console-extend-plugin/pull/22 Please update your launcher to the latest version of DC and try it again

nvaken commented 4 years ago

@harold20, our update process does not use the launcher, but uses the binary directly from /vendor/bin/drupal. But I guess this is not directly related to the launcher right? Am I correct to assume we just need the drupal-console-extend-plugin package in our projects?

Edit: Btw, I tested my package without the drupal-console-library type, but as I expected, the commands did not work anymore after that.

nvaken commented 4 years ago

I'm not able to workaround this issue, I'm unable to update packages in any of our projects with this bug / feature. I'll be downgrading drupal console related packages to a version prior to this update concerning drupal-console-library. As far as I'm concerned, this an ongoing issue.

nvaken commented 4 years ago

Even downgrading seems to be an incredibly hard feat.

@harold20 / @jmolivas: I still think this is quite the bug. I've just now checked if our projects are in any way different then a default Drupal 8 setup. So what I've done is;

  1. Install a default Drupal 8 setup with the drupal-composer/drupal-project project, which includes the drupal/console packages by default (including the drupal/console-extend-plugin package).
$ composer create-project drupal-composer/drupal-project:8.x-dev some-dir --no-interaction
  1. Then, first thing I do, is try to install the drupal/console-extend-example example package. But even that returns the error.
composer require drupal/console-extend-example
    1/3:        http://repo.packagist.org/p/provider-latest$30b4aeffde5a1f04b41d65e26966b484759c8ead38f09e96ba51e0c7ca0434c1.json
    2/3:        http://repo.packagist.org/p/provider-2019-10$74c47055c0802a70faf3f41ef9be96ee4ae0e6aa5dcb8e69661a47e7c37667af.json
    3/3:        http://repo.packagist.org/p/provider-2018$e56746f49a5d4aec4c522ec9710cf9b3b853bdfaac5c535aa20111f960e4b85d.json
    Finished: success: 3, skipped: 0, failure: 0, total: 3
Using version ^0.2.0 for drupal/console-extend-example
./composer.json has been updated
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals

Installation failed, reverting ./composer.json to its original content.

  [InvalidArgumentException]
  Package type "drupal-console-library" is not supported

require [--dev] [--prefer-source] [--prefer-dist] [--fixed] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...

Again, is this a bug or am I missing something here?

Version infos:

$ drupal --version
Drupal Console Launcher 1.9.4

$ drupal --version    # Within project
Drupal Console version 1.9.4

$ composer --version
Composer version 1.10-dev (1.10-dev+082422f334f1bf2d593ea395fe4d8c056b24fc8e) 2019-12-13 11:11:50
jmolivas commented 4 years ago

@nvaken Thanks for testing and updating the issue. Probably @enzolutions who is taking the lead of the project have more ideas about it. I recall he have more knowledge about this composer changes.

nvaken commented 4 years ago

@enzolutions ?

DuaelFr commented 4 years ago

This issue still exists.

I've found an ugly workaround that is to add "vendor/{$vendor}/{$name}": ["type:drupal-console-library"] in the installer-paths of my composer.json but it does not feel right.

Does someone have clues to make it work without workaround?