Support custom Composer vendor directory locations#231
Conversation
There was a problem hiding this comment.
issue:
Thank you for the PR! As it is right now, it is not merge-ready because all workflows that execute Composer libraries would need to be updated, and so would the documentation.
Anyway, I would like to request a different approach by having Composer do the vendor, or rather bin directory resolving:
- name: Run PHP_CodeSniffer
run: ./$(composer config bin-dir)/phpcs ${{ inputs.PHPCS_ARGS }}This has multiple benefits over the current approach, IMO:
- Does not require any changes to calling workflows.
- Does not require any documentation updates.
- DRY; no repetition of paths in
composer.jsonand workflow files. - Uses
bin-dirto supportcomposer.jsonconfigs wherevendor-dirand/orbin-diris set (falls back to whatevervendorresolves to +/bin).
Please test this approach and apply it to all corresponding workflow files if it works. Thank you!
tyrann0us
left a comment
There was a problem hiding this comment.
Does not require any documentation updates.
I'm sorry, this was a lie. 🙈 I realized that in https://github.com/inpsyde/reusable-workflows/blob/main/docs/php.md, we state multiple times, "It does so by executing the binary in the ./vendor/bin/ folder." This is potentially no longer accurate, and I would simply remove all occurrences of that sentence.
Also, can you apply the change to the new Deployer workflow https://github.com/inpsyde/reusable-workflows/blob/main/.github/workflows/deploy-deployer.yml added in #227?
(I know this is still a draft PR. 🙂)
|
Thanks Philipp. The original issue was about projects where the project's vendor directory is in a non-standard location (e.g. |
Not really. |
|
That's right, thanks! |
tyrann0us
left a comment
There was a problem hiding this comment.
Thank you for working on this! 💪🏽 PR title and description no longer match the latest state, but this doesn't stop me from approving. 😉
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature
What is the current behavior? (You can also link to an open issue here)
The workflows hardcode
./vendor/bin/as the path to the binary files. Projects that configure a customvendor-dirincomposer.json(e.g.public/wp-content/vendor/) cannot use these workflows.What is the new behavior (if this is a feature change)?
Tools are now executed using the binary path resolved dynamically via
composer config bin-dir, instead of the hardcoded./vendor/bin/. This means workflows will automatically respect any custombin-dirconfigured in the project'scomposer.json, supporting setups where the vendor directory is not in the repository root (e.g.public/wp-content/vendor).Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
No
Other information