fxpio / composer-asset-plugin

NPM/Bower Dependency Manager for Composer
MIT License
893 stars 156 forks source link

Compatibility with Composer 2.0 #334

Open cebe opened 4 years ago

cebe commented 4 years ago

Running composer 2.0 disabled the composer-asset-plugin:

The "fxp/composer-asset-plugin" plugin was skipped because it requires a Plugin API version ("^1.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.

Here is the list of changes:

https://github.com/composer/composer/blob/master/UPGRADE-2.0.md#for-integrators-and-plugin-authors

schmunk42 commented 3 years ago

Bump, since composer 2 is the stable now.

haohetao commented 3 years ago

request support for composer 2.0

encryptedroot commented 3 years ago

I second (or "third" I guess?) this request

samuelexyz commented 3 years ago

request support for composer 2.0

francoispluchino commented 3 years ago

Until the end of the year, it is very difficult for me to have time for my open source projects. So if you want to help, any contribution is welcome. Thanks

huaiguoguo commented 3 years ago

when i am compose self-update --2 then i am exec "composer create-project --prefer-dist yiisoft/yii2-app-advanced ./" its response "Could not find package yiisoft/yii2-app-advanced with stability stable."

MrPetovan commented 3 years ago

Hi, this question doesn't have anything to do with the composer-asset-plugin, please refer to the Composer documentation about package stability: https://getcomposer.org/doc/01-basic-usage.md#package-version-constraints

sagittaracc commented 3 years ago

How do I downgrade composer to 1.0?

MrPetovan commented 3 years ago

If you used composer selfupdate, you can revert to your previous bersion with composer selfupdate -r.

Otherwise, you can download the latest 1.x version from the official website: https://getcomposer.org/composer-1.phar

wiltonlcsj commented 3 years ago

Any news or date to merge this?

MrPetovan commented 3 years ago

No work has been done towards solving this issue yet.

Insolita commented 3 years ago

Does anyone work for solving this?

MrPetovan commented 3 years ago

Probably not.

sagittaracc commented 3 years ago

Fuck this! Happy New Year guys 🥳

philwolstenholme commented 3 years ago

Looks like Composer 2 support has already been added for the Foxy project which is the successor to this project:

https://github.com/fxpio/foxy/issues/33

If you are a user of this package and need Composer 2 support then why not take a look at how the Foxy project fixed the issue and see if you can make the same changes for this project? Alternatively you could switch your projects to use to Foxy instead.

Either way, leaving entitled and rude comments like the one above won't help yourself or anyone else. Change and updates in open source projects usually comes from maintainers who are generous with their own time (for which we should be grateful), or from people fixing their own problems rather than complaining about them.

francoispluchino commented 3 years ago

I will not note the relevance of certain comments, even if I can still understand the frustration that can cause. However I would like to thank @philwolstenholme for his reminder that a lot of projects like this one are managed by people in their spare time, and that there are no companies or larger projects to allow to allocate part of their resources to maintain the code. It is therefore only through personal motivation that leads these people to give of their personal time to maintain open source projects.

As indicated in one of my previous comments on this issue, my end of the professional year was very busy, and I still planned to take a day to try to make this plugin compatible with Composer 2. I would like to remind that it is indicated on the README, the following note:

Important:

The next major version of Composer Asset Plugin is so different, but also incompatible with the current version, that it became a new project named Foxy.

Foxy is the new way to manage the assets of PHP libraries, because it works nativelly with all the features of NPM or Yarn. However, this plugin will continue to be maintained by the community, without having new features.

You can read the reasons for this new version, or the difference between Foxy and Fxp Composer Asset Plugin, but also how does Foxy work.

This project is therefore maintained by contributors other than me, however, I understand that few people can contribute, because it takes a minimum of knowledge of the internal workings of Composer. It is for this reason that I still to contribute to this project (when I can), even if it is no longer used by any of my personal and professional projects. I just spent the day trying to make this plugin compatible with Composer 2, however, unlike Foxy, this plugin uses a lot more internal components, which makes the upgrade much more complex, especially since there have been many changes.

So I appreciate after spending a whole Sunday working for free for others instead of spending time with my family, to read this kind of comment. I understand that more and more contributors are detaching themselves from open source projects. Most of the time, contributing is in our DNA, and we keep ignoring that sort of thing, but it is certain that does not motivate us at all to give of our personal time. Thoughts can get heated in comments of issues when there is disagreement between developers on a project, but respect must always be present.

Frustration should therefore not lead people to be insulting, but more to have the will to technically understand a project, and try to contribute to it.

I take this opportunity to thank all the contributors who continue to maintain this small project, initially personal, even if it is recommended to switch to Foxy.

WNYmathGuy commented 3 years ago

If you used composer selfupdate, you can revert to your previous bersion with composer selfupdate -r.

Dude! You just rescued me again! What kind of gift should I send you? I got in a jamb by updating my Friendica badly (I went from 2020 09 to 2021 01 unknowingly skipping the December version).

php7.4 /home/outmathadmin/bin/composer install --no-dev
The "fxp/composer-asset-plugin" plugin was skipped because it requires a Plugin API version ("^1.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.

  Problem 1
    - fxp/composer-asset-plugin is locked to version v1.4.6 and an update of this package was not requested.
    - fxp/composer-asset-plugin v1.4.6 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.

You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.

That php7.4 /home/outmathadmin/bin/composer selfupdate -r command got it working again.

MrPetovan commented 3 years ago

Glad I could help you! And while it's irrelevant to this thread I'd like to point out that from version 2020.03 on, you can skip versions when updating Friendica.

simialbi commented 1 year ago

I tried to update it to get it running with composer v2: I had some success, so installing already works. But my knowledge of the internals of composer is not the same as the one from @francoispluchino. So it's in alpha stage: https://github.com/simialbi/composer-asset-plugin

simialbi commented 1 year ago

Update: Update command does work too now. And i added Artifactory bower support (they have an own bower resolver) and a possibility to override npm registry url (e.g. to use with Artifactory)

MrPetovan commented 1 year ago

Thanks, I wasn't able to figure out how Foxy works with regard to our current workflow, so you might have saved us from deprecation hell.

simialbi commented 1 year ago

I've you'd like to give it a try, you can install it with composer global require simialbi/composer-asset-plugin:2.0.0-beta.2.

MrPetovan commented 1 year ago

Thanks!

francoispluchino commented 1 year ago

@simialbi It's good news that you were able to take the time to evolve this plugin.

Small precision, this plugin is not deprecated, but as indicated, it is maintained by contributors other than me. Foxy remains another project which is effectively an evolution of the same need, but with other asset management tools.

I welcome any contributions that can benefit all users of this plugin, and therefore, do not hesitate to make a Pull Request if you wish. Of course, I always remain open to welcome new maintainers.

MrPetovan commented 1 year ago

I've you'd like to give it a try, you can install it with composer global require simialbi/composer-asset-plugin:2.0.0-beta.2.

Hmm, unfortunately it's PHP 8 minimum, this won't work with our project, but I appreciate you spearheading this initiative!