Question

I created a vendor lib (Symfony2 Bundle) in git repository. Added composer.json to it.

In multiple projects I use it as a vendor (vcs in composer.json). Everything works fine unless I want to modify original bunlde/vendor.

I can't push to it directly from the projet, that uses the bundle. I have to clone bundle's repo in new dir, change it there and push. This isn't convinient as bundle doesn't work itself, so commits are kinda try-and-see-what-happens.

What would be the best practise to maintain my own vendor repo?

Was it helpful?

Solution

Provided your vendor is installed from source, you can modify and push it. To force installing from source, use the --prefer-source option:

composer install/update --prefer-source

Then cd to your vendor's directory and you'll see it's a separate git repo. You can do a pull in there to get the latest version, make a change and push it back.

The same works for 3rd party bundles. In that case you just need to add a git remote to your fork to push to it.

OTHER TIPS

When I am writing a Bundle like this, I have a mock project (working, but not purposeful).
Inside this I have the cloned master copy of the Bundle, so I can edit, test, then commit the changes and push etc.

The only thing you need to make sure works first is the install from composer.

If you need more details about this, just let me know and I'll beef this up a bit for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top