Issue
I am new to both Composer and Git/GitHub so please excuse me if this is a stupid question!
I have built a WordPress plugin which I have in a repository on GitHub and I will use the repository to distribute updates to the plugin using this plugin update checker library: https://github.com/YahnisElsts/plugin-update-checker
The plugin has a number of Composer dependencies that I have installed. I've been researching and apparently you aren't supposed to include the composer vendors directory in your GitHub repository (see here: https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md) however my confusion is how can I distribute the plugin from GitHub using the update checker if the vendors directory is not included?
What is the correct way to achieve this? Am I missing something obvious?
Thanks a lot in advance, Hayden
Solution
The rule of not committing the vendor folder makes sense in the case of a "composer-friendly" project, when running composer install
is guaranteed by a build or release step and/or it is run manually during development.
I did not take a detailed look on the plugin-update-checker library you're using, but there are 2 cases:
- It only knows to fetch code from a branch - if this is the case, then you will have to commit the vendor folder, there are no other options.
- On the other hand, if it can handle getting the code from releases published on GitHub, then you can skip committing the vendor folder and only include it in your release builds. A pretty popular WordPress plugin does this, take a look on how they do it: https://github.com/Yoast/wordpress-seo. You will see that vendor is not committed, but if you download a release, it is there in the archive.
Answered By - Zoli Szabó Answer Checked By - Candace Johnson (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.