Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to add library to repo because the /dist directory is ignored #400

Closed
btoone opened this issue Jan 25, 2015 · 8 comments
Closed

Unable to add library to repo because the /dist directory is ignored #400

btoone opened this issue Jan 25, 2015 · 8 comments

Comments

@btoone
Copy link
Contributor

btoone commented Jan 25, 2015

Problem

I'm using this project in a Rails app that I've wired up to use Bower to manage dependencies and am deploying to Heroku.

I have a staging environment and everything would work fine when I ran the app in staging locally but when I pushed to Heroku, I would get an error about Sprockets not being able to find the file underscore.string/dist/underscore.string.js. When I looked on the Heroku file system, sure enough the /dist directory wasn't there.

Eventually I realized the reason this was happening is because I was adding all of my bower_components to the repo so Heroku would just use what was being pushed rather than downloading fresh from a bower install. Now because the /dist directory is in the .gitignore file for this project it wasn't being added to the bower_components/underscore.string/ folder in my repo and therefore never pushed to Heroku.

I solved my problem by removing this library from the bower_components folder in the repo and just let Heroku download it. However this isn't ideal because I would like to have the option to store the library in my repo if I want.

So as I understand it, since the /dist directory is ignored in this project no one is able to simply do a bower install --save and commit this lib to their repo. If you want this lib stored in your repo you have to either:

  • Force commit the /dist folder to the repo
  • Don't add to the repo and instead have the server download the library.

Solutions

I've never maintained a project for Bower distribution so I don't know what the best answer is (you guys probably have some ideas already) but after doing some research here is what I came up with.

Tell Bower to ignore everything: According to this blog post it is pretty common to use the ignore property in bower.json to ignore everything except what should be distributed. Thoughtbot's Bourbon project takes this approach.

Create a project specifically for Bower distribution: Having a separate project specifically for Bower distribution also appears to be pretty common. As an example this is what the Angular team does.

Thoughts?

@esamattis
Copy link
Owner

I think we can just drop the ignore on /dist because it's not actually working as I thought it would. I thought it would hide changes to the dist files from git status but it does not.

@stoeffel
Copy link
Collaborator

I think we can just drop the ignore on /dist

👍

@btoone
Copy link
Contributor Author

btoone commented Jan 25, 2015

That's interesting. To me it makes sense that you would want to ignore the /dist directory as a maintainer so I didn't really think that would be an option.

But since you specify the ./dist/underscore.string.js in the main property of bower.json it makes sense to me now that you'll need to NOT ignore it.

Thanks.

@stoeffel
Copy link
Collaborator

If we drop the dist from .gitignore we'll have to make sure that the gh-pages download links point to the tag of the current release and not to master.

@esamattis
Copy link
Owner

@stoeffel I don't think nothing changes from this. We'll still just commit files in dist only when doing releases.

@stoeffel
Copy link
Collaborator

@epeli yes you are right. And we can reject PRs with dist files.

@esamattis
Copy link
Owner

@caspyin try 3.0.2 to see if this issue is fixed now

@btoone
Copy link
Contributor Author

btoone commented Jan 25, 2015

Yep it does! Thanks, you're both awesome! 🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants