Closed andresgutgon closed 11 years ago
Would adding bower to .gitignore
solve the problem?
I think it dosn´t. bower works the same way that node_modules. In place of package.json
you have a component.json
. And with bower install the dependencies. This dependencies are not necessary for production if you have a build script.
The people that colaborate in the project can run a bower command to install these dependencies.
I think is good idea for this project let people exclude custom folders. But is only an idea :)
The reason I was asking about adding bower to .gitignore
is that if you did that it would be preserved between builds, and it wouldn't be committed to the gh-pages
branch with git add -A
. The important thing is that it has to be in the .gitignore
of both branches (your current branch & your build branch). Not sure how else I would implement an exclude.
Sorry. Maybe I´m missing something. But you avoid remove node_modules to avoid reinstall again. Right?
If I include bower folder in both .gitignore
a won´t avoid that this plugin delete the folder if is not included here:
'ls | grep -v ^' + options.dist + '$ | grep -v ^node_modules$ | xargs rm -r '
This is right?
Maybe you could pass here another option:
options: {
dist: 'dist',
build_branch: 'gh-pages',
pull: true,
dont_remove: 'bower_folder, another_folder, one-file.js'
},
And then generate in the plugin with underscore a string with the grep expresion:
Example:
var dont_remove = 'bower_folder, another_folder, one-file.js';
dont_remove = dont_remove.split(',');
dont_remove = ' | ' + _.map(dont_remove, function(folder){
var clean_folder = folder.trim();
return 'grep -v ^' + clean_folder + '$';
}).join(' | ');
console.log(dont_remove);
Here the live example: http://jsfiddle.net/v8c3k/
Yeah, you're right. It has to be in .gitignore
and it has to be part of the grep -v ...
.
I do like the idea of passing in additional excluded directories. I'd probably make it an array of excluded files strings instead of one big string, so you could just iterate over dont_remove = ['bower', 'other']
.... not sure if using minmatch would be necessary.
I'll add this at some point, or if you want send a pull request.
Great!. Thanks :) Yes, better an array. More easy to implement.
What you mean with minmatch
?
@andresgutgon - I added this in and did a quick test. Let me know if it works for you. Thanks, Peter.
The new option is exclude
.
Great!. Thanks :+1: I'll try it
Reading this again.
Now I understand why you are excluding.
But what happend if in development I´m working with Bower? https://github.com/bower/bower
Which is a pakage management system for Front-End libraries.
Bower generates a folder with all the packages. And is excluded from my repository. And I would like to maintain bettwen deploys.
Could you add a config param to add more directories like bower generated? It would be great.