Conversation
| Use the following command to install the command line tool via Composer: | ||
|
|
||
| `composer global require mglaman/drupalorg-cli` | ||
| `composer require mglaman/drupalorg-cli` |
There was a problem hiding this comment.
Where would someone run this? The project wasn't intended to be attached to a Drupal project, but rather as a global CLI command
There was a problem hiding this comment.
The user would run this on any project they are working on where they want access to the command. Does the tool have use for other projects like WordPress or Symphony based ones? If so, then the desired version would be added to the composer file for those projects with the same command.
https://www.sitepoint.com/composer-global-require-considered-harmful/
There was a problem hiding this comment.
Brew has some advantages over composer in this regard because it has access to the OS outside of the home folder and doesn't get tied to the dependencies of project based work. But, brew is also a real pain in the neck to maintain for an end user.
There was a problem hiding this comment.
For example, lets say, I have two projects, a WordPress one and a Drupal one. Both have different tools. But, both sets of tools share a dependency on a base library common to many tools. However, Drupal requires version 2 or lower of the dependency and WordPress requires version 3 or higher. If I'm putting tool dependencies in global, there is no path forward and I simply can't work on Drupal and WordPress together on one machine if they share dependencies and aren't on the same versions for their requirements.
There was a problem hiding this comment.
With Brew, every project's dependencies are separate even when a tool is installed in a global path.
There was a problem hiding this comment.
This is why I suggest primarily downloading the Phar from https://github.com/mglaman/drupalorg-cli/releases/latest. I can add a self-updater
There was a problem hiding this comment.
What about suggesting CGR instead - https://github.com/consolidation/cgr
|
I'm currently running drupalorg site-local, installed in a drupal project. It works nicely and I can use composer to install and update it. And, people are used to site-local installs for Drush and Drupal console. Anyway, I don't object to recommending global install using a phar file, but if using composer to install, either recommend site local or global install with GCR - or both, but not "composer global require" since this still works badly with Composer. |
|
I'm using this with https://github.com/consolidation/cgr as suggested in this comments and it works great. It allows to update and with the most ease of installing over manual actions. |
Removing the global from the install command helps avoid conflicts with other projects.