Comments (4)
Hi! Glad to find this issue as I was about to open one about it :)
Disclaimer: I'm the current maintainer of https://github.com/bamarni/composer-bin-plugin.
First of all, for clarification an introduction to the plugin: it is only but a tiny wrapper to do a cd
before calling composer:
$ composer bin phpstan install phpstan/phpstan
> parses the composer command to see if it starts with "bin "
> parses the namespace (here "phpstan")
> creates the directory "vendor-bin/phpstan" if does not already exist
> do "cd vendor-bin/phpstan"
> strip the command from the bin directory, i.e. the new command is "composer install phpstan/phpstan"
> execute this new composer command (in the directory)
I may have forgotten a detail or two but this is what it boils down to and it doesn't do more because I don't want to start to temper with more internal Composer code/behaviour.
A current possible solution, as highlighted by @Aerendir is to leverage the working-directory
option:
- name: Install Composer PHPStan dependencies
uses: ramsey/composer-install@v1
with:
working-directory: 'vendor-bin/phpstan'
will work just fine.
The downside however is the symlinks but as you can see in bamarni/composer-bin-plugin#60 (comment) relying on the symlinks is a bad idea IMO. In fact I always disable symlinks whenever I use this plugin and I'm definitely gonna remove it in 2.0.
Regarding @Aerendir issue: I don't get the autoload part. You can check bamarni/composer-bin-plugin#57 for more details but there is no autoload concatenation of any sort.
In the current form, to support such a plugin, the best way to do it in the most "generic" way would be to offer a way to add a prefix option, for example:
- name: Install Composer dependencies
uses: ramsey/composer-install@v1
with:
composer-prefix-option: 'bin phpstan'
However I must say it does not look very elegant and IMO this is due to the design of this GitHub Actions that adds a layer of abstraction on what command to execute (the "locked", "highest" and "lowest" options). If instead you let the user pass the options, i.e. instead of "lowest" you do:
- name: Install Composer dependencies
uses: ramsey/composer-install@v1
with:
command: 'update'
composer-options: '--prefer-lowest'
The adding support for the plugin is already done:
- name: Install Composer dependencies
uses: ramsey/composer-install@v1
with:
command: 'bin phpstan update'
composer-options: '--prefer-lowest'
from composer-install.
I think providing a command
argument might work. If it's present, it would override dependency-versions
, and users would need to use composer-options
to specify whether to prefer lowest, etc., but this could be made clear in the documentation.
I'll think on this a bit and ask any questions I have on this thread.
from composer-install.
Hi! Thanks for the feature request.
I've never used bamarni/composer-bin-plugin
, nor am I familiar with it. I hesitate to add support for a Composer plugin like this, since it means I'll need to maintain support for something I don't use and, therefore, I won't be able to do a good job supporting it.
It sounds like your workflow falls outside the scope of this tool and requires more customization than most users will need. Have you considered forking this action, instead?
from composer-install.
First of all, thank you for the fast reply :)
I understand well your point and agree with it.
I've not considered to fork this action as I'm not able to maintain it as I'm not very versed in its language... Actually I don't know it, so I'm not able to modify it to adapt to my use case.
For what I saw, I think it is simply an if
condition to check if the key bin
is passed and, if it is, add it to command.
If it may help you deciding, I can tell you that the plugin has a very simple "frontend": it only requires to use bin [folder]
and nothing else: no options nor parameters, so, also the maintaining is very easy in the long run.
I would appreciate much a direct support for it as I know it is very used in projects that relies on a lot of dev dependencies (rector, phan, phpstan, php cs fixer, etc.).
I'm in your hands! 😬
from composer-install.
Related Issues (20)
- Compatibility with Composer 1 broken due to validate command HOT 1
- Action debug information showing in workflow run summary
- Heads-up: upcoming (helpful) change in setupPHP HOT 1
- Do not depend on awk and perl
- CI `run` job only tests with lock files HOT 5
- failed to open stream HOT 1
- Cannot find composer.json HOT 4
- Yaml is invalid? HOT 5
- Error: The process '/usr/local/bin/composer' failed with exit code 1 HOT 4
- Add `retries:` input HOT 2
- Add `--no-audit` to default options used ? HOT 1
- Better cache busting when using `dependency-versions: 'highest'` HOT 3
- `set-output` function is deprecated HOT 1
- "Could not authenticate against github.com" HOT 2
- Ability to swap out actions/cache for the faster alternative buildjet/cache HOT 1
- Failure to restore cache causes the GitHub Action step to run indefinitely HOT 8
- File "./composer.json" cannot be found in the current directory HOT 2
- locked version vs. missing lock file HOT 1
- Misleading error message when validate_composer fails due to missing HOME/COMPOSER_HOME HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from composer-install.