szepeviktor / composer-envato

Composer plugin for Envato 💚 Install WordPress themes and plugins from ThemeForest‎‎ and CodeCanyon
https://packagist.org/packages/szepeviktor/composer-envato
MIT License
33 stars 4 forks source link

How do use this with Trellis + Bedrock? #9

Closed DannyTaki closed 1 year ago

DannyTaki commented 1 year ago

Following the install instructions after running composer global require --update-no-dev szepeviktor/composer-envato, I cannot find my config.json file the only file is composer.json in the directory /home/$USER/.config/composer.

image

Since this installs the file on my local directory how would this work with a Trellis+Bedrock set up? Would I have to manually run the installation command on the server? What happens when I have to re-provision server will it remove the szepeviktor/composer-envato plugin?

szepeviktor commented 1 year ago

Hello Daniel! Thank you for your issue. I'm not a woman, so I can answer a single question only.

config.json lives in you $COMPOSER_HOME, on my server it is ~/.composer/ Please find yours and create config.json there.

szepeviktor commented 1 year ago

This command may tell you where that directory is composer global config --absolute home

szepeviktor commented 1 year ago

What happens when I have to re-provision server will it remove the szepeviktor/composer-envato plugin?

Yes, this Composer plugin and its configuration file - config.json - lives outside your project. It needs to live outside your project as in Composer v1 world you cannot run a plugin locally that modifies package URL-s. In Composer v2 there is a solution for this. Pull Requests welcome!

DannyTaki commented 1 year ago

Haha! I wasn't even expecting an answer much less from the plugin author! That's awesome. Thank you so much. Will re-provisioning a Trellis server remove your custom composer plugin on the server after I have manually installed it?

szepeviktor commented 1 year ago

I do not really know Trellis. The work of Rocks people is not acceptable for me.

Just tell Trellis to copy your config.json file there and install this Composer plugin globally.

DannyTaki commented 1 year ago

I created a config.json in the /home/$USER/.config/composer/ directory and added the following json and then added the package in my project's composer.json require "envato/woocommerce-pipedrive-crm-integration": "*". I get the folllowing error when running composer update:

PHP Fatal error:  Declaration of SzepeViktor\Composer\Envato\EnvatoPackage::getDistType() must be compatible with Composer\Package\Package::getDistType(): ?string in /home/dannytaki/.config/composer/vendor/szepeviktor/composer-envato/src/EnvatoPackage.php on line 53

Fatal error: Declaration of SzepeViktor\Composer\Envato\EnvatoPackage::getDistType() must be compatible with Composer\Package\Package::getDistType(): ?string in /home/dannytaki/.config/composer/vendor/szepeviktor/composer-envato/src/EnvatoPackage.php on line 53

Composer command itself won't work and emits that error unless I remove the config.json file I created.

Running composer global config --absolute home returns Changed current directory to /home/dannytaki/.config/composer /home/dannytaki/.config/composer image config

szepeviktor commented 1 year ago

PHP Fatal error

You must be using Composer v2. This plugin is not yet Composer v2 compatible.

szepeviktor commented 1 year ago

No, this plugin is Composer v2 compatible. Recent Composer releases introduced new typehints. https://github.com/composer/composer/commit/7abc8da7d3fa2db2f259517d84acb753399fab07

Please send a PR!