Git Source Control Workflow? Updating Private Bower and Composer Package Repositories?

I’m loving Sage and the Roots push for bringing modern web development practices to WordPress.

I am looking to setup projects using Bower and Composer and splitting functionality I use often into plugins and front end components.

What I am currently wondering is how to best integrate these package managers with Git.

Is it possible to make my own private Bower and Composer packages, pulling them in by their respective package managers and then update those projects through Git while also updating my theme as necessary?

For instance, I start a new theme using Sage as my starter theme. I use Bower to pull in my private Sass library and composer to pull in a couple private plugins. During the course of my workflow, I make changes to the theme, the Sass library and the plugins. How can I make sure these changes get reflected in their desired repositories.

Any suggestions? Much thanks!

1 Like

Composer: yes
Bower: yes

Composer - https://getcomposer.org/doc/04-schema.md & https://getcomposer.org/doc/05-repositories.md
Bower: http://bower.io/docs/creating-packages/ (look into “private”) and maybe host Your own https://github.com/bower/registry :slight_smile: some hints for bower: http://www.frontendjunkie.com/2014/01/using-bower-as-package-management-tool.html

All in all - You can run private repos for all package managers like nobody’s business :wink:

1 Like

Thanks,

What if I want to update the repository that a package gets pulled from within the structure of a Sage theme I am working on? For instance, if I need a new Sass function, and I think it would be useful for future projects as well, I would want to add it to my Sass library that I have pulled into my Sage theme via Bower. Is it possible to update the package where it sits in the theme’s bower_components directory, test it, and then update the respective repository?

Sure, you just need to commit the new code to the actual package’s repository, and then update any projects that are using that package in order to get the new updates.

You can use bower install git/path to install your plugin. It may not be the proper way (please correct if not), but by using the bower.json files you can have gulp build js and css into the dist folders. I’m still not sure the best way to include other things, like a php library.

Thanks,

I’ve figured out how to pull in my private Bitbucket repository through bower and have created the necessary bower.json file for the package.

I’m still stuck on submitting changes back to the repository. I’m fairly new to git and pulling in through the package manager doesn’t pull down the usual git information.

Any suggestions?

There is a --prefer-source option for Composer that downloads the full repository to the vendor directory. I haven’t found similar for Bower.