zont / gulp-bower

MIT License
82 stars 22 forks source link

Creates duplicate bower_components directory. #21

Closed joshbedo closed 9 years ago

joshbedo commented 9 years ago

I came across an issue where gulp-bower generates the bower_components directory at the destination i set but it also creates a bower_components directory in the directory containing the bower.json file outside of the destination. I'm also seeing this via terminal and it seems like the bower task finishes then it runs a caching implementation which creates another directory.

Joshs-MacBook-Pro:dev jbedo$ gulp pinchme
[11:49:10] Using gulpfile ~/Desktop/PINCHme/kendall/kendall/pinchme_mobile/dev/gulpfile.js
[11:49:10] Starting 'less'...
[11:49:10] Finished 'less' after 9.98 ms
[11:49:10] Starting 'js'...
[11:49:10] Finished 'js' after 15 ms
[11:49:10] Starting 'bower'...
../www/js/vendors/
[11:49:10] Using cwd:  /Users/jbedo/Desktop/PINCHme/kendall/kendall/pinchme_mobile/dev
[11:49:10] Using bower dir:  ./bower_components
[11:49:10] Finished 'bower' after 4.53 ms
[11:49:10] Starting 'pinchme'...
[11:49:10] Finished 'pinchme' after 9.35 μs
[11:49:16] bower cached git://github.com/marionettejs/backbone.marionette.git#2.2.2
[11:49:16] bower validate 2.2.2 against git://github.com/marionettejs/backbone.marionette.git#~2.2.2
[11:49:16] bower cached git://github.com/marionettejs/backbone.radio.git#0.8.2
[11:49:16] bower validate 0.8.2 against git://github.com/marionettejs/backbone.radio.git#~0.8.2
[11:49:21] bower cached git://github.com/jashkenas/backbone.git#1.1.2
[11:49:21] bower validate 1.1.2 against git://github.com/jashkenas/backbone.git#>=0.9.9 <=1.1.2
[11:49:21] bower cached git://github.com/jashkenas/underscore.git#1.7.0
[11:49:21] bower validate 1.7.0 against git://github.com/jashkenas/underscore.git#>=1.4.4 <=1.7.0
[11:49:21] bower cached git://github.com/jashkenas/underscore.git#1.6.0
[11:49:21] bower validate 1.6.0 against git://github.com/jashkenas/underscore.git#1.4.4 - 1.6.0
[11:49:21] bower cached git://github.com/jquery/jquery.git#2.1.1
[11:49:21] bower validate 2.1.1 against git://github.com/jquery/jquery.git#^1.8.0 || ^2.0.0
[11:49:21] bower cached git://github.com/marionettejs/backbone.wreqr.git#1.3.1
[11:49:21] bower validate 1.3.1 against git://github.com/marionettejs/backbone.wreqr.git#^1.0.0
[11:49:21] bower cached git://github.com/marionettejs/backbone.babysitter.git#0.1.5
[11:49:21] bower validate 0.1.5 against git://github.com/marionettejs/backbone.babysitter.git#^0.1.0
[11:49:21] bower install backbone.radio#0.8.2
[11:49:21] bower install marionette#2.2.2
[11:49:21] bower install underscore#1.6.0
[11:49:21] bower install backbone.wreqr#1.3.1
[11:49:21] bower install backbone.babysitter#0.1.5
[11:49:21] bower install backbone#1.1.2
[11:49:21] bower install jquery#2.1.1

gulpfile.js

// package.json has the projectPath: '../www/js/vendors/` set
gulp.task('bower', function() {
  console.log(pkg.projectPath);
  return bower()
    .pipe(gulp.dest(pkg.projectPath))
});
sashasochka commented 9 years ago

I can agree, I have the same behaviour.

zont commented 9 years ago

You can use .bowerrc for configure bower directory: http://bower.io/docs/config/#directory

joshbedo commented 9 years ago

The problem occurs when you configure a bower directory within the .bowerrc file. It creates the specified directory and also creates a bower_components directory.

zont commented 9 years ago

Use:

gulp.task('bower', function() {
  console.log(pkg.projectPath);
  return bower()
});