0

We have created successfully a bower package and it is working great with Subversion and private-bower.

The issue I am facing now, is that we need also the generated files to be commited into (Subversion or Git) to work properly for

bower install or bower update

Now every build creates a conflict in the local copy of the repository.

My question is, can I tell bower to do a post install or post update command to execute a build? In my case it should run a grunt task to build the files locally.

Just wondering if bower is not capable of doing such steps to avoid conflicts on the git/svn repository? Or what is the suggested way to avoid merge conflicts?

cilap
  • 2,215
  • 1
  • 25
  • 51

1 Answers1

0

There are postinstall hooks in bower https://github.com/bower/bower/blob/master/HOOKS.md but you can't rely on it as a package provider (they're designed to be used by the developpers who install your package)

For your situation, teams that provide bower packages that require a build step have two main workflows:

  • The repo tied to the bower registry is the source repo. Sources & build files are in it (like bootstrap). So when you bower install, you retrieve the whole repo with all the sources, build routines, etc ... which can be quite big. That's your case currently.
  • The repo tied to the bower registry and the repo holding the sources are two different repos (like angular):
    • Your build directory is in fact the repo tied to bower
    • Each time you make a new release, you build and then commit from that repo.

If you're having versionning problems, maybe you should switch to the second workflow (which will also let you clean all the unecessary files like build routines).

topheman
  • 7,422
  • 4
  • 24
  • 33
  • the angular way is the more "professional" way since it does not force you to deliver generated code into the repository. But for me it is unclear how can I handle it with private-bower project. Afaik private-bower is forcing me to add the generated sources to a SVN repository. Is there a way to say, here in SVN are my sources and on delivering, I only deliver the generated distribution to private-bower? – cilap Sep 18 '15 at 15:47