ck86 / gulp-bower-files

Build gulp.src() of your bower packages main files.
80 stars 13 forks source link

skips dependency that is listed in bower file #40

Closed akaha closed 10 years ago

akaha commented 10 years ago

My dependencies:

{
    "backbone": "~1.1.2",
    "backbone-hoodie": "~1.0.6",
    "hoodie": "~0.8.2",
    "jquery": "~1.11.0",
    "requirejs": "~2.1.11",
    "underscore": "~1.6.0"
}

backbone-hoodie isn't found by gulp-bower-files (version 0.2.3)

ck86 commented 10 years ago

I can not reproduce this, the debugging output looks like this:

[gulp] PackageCollection add backbone bower_components/backbone [gulp] PackageCollection add underscore bower_components/underscore [gulp] PackageCollection add backbone-hoodie bower_components/backbone-hoodie [gulp] PackageCollection add hoodie bower_components/hoodie [gulp] PackageCollection add jquery bower_components/jquery [gulp] PackageCollection add requirejs bower_components/requirejs [gulp] Package select file underscore bower_components/underscore/underscore.js [gulp] Package select file jquery bower_components/jquery/dist/jquery.js [gulp] Package select file requirejs bower_components/requirejs/require.js [gulp] Package select file backbone bower_components/backbone/backbone.js [gulp] Package select file hoodie bower_components/hoodie/dist/hoodie.js [gulp] Package select file backbone-hoodie bower_components/backbone-hoodie/backbone-hoodie.js

You can see, that gulp-bower-files has selected the backbone-hoodie.js.

akaha commented 10 years ago

My gulp-task looks like:

gulp.task('bower', function () {
    var jsFilter = $.filter('**/*.js', '!**/*.min.js');

    return $.bowerFiles()
        .pipe(jsFilter)
        .pipe($.uglify())
        .pipe(jsFilter.restore())
        .pipe(gulp.dest('public/dist/bower_components'));
});

Without the jsFilter there is no difference.

ck86 commented 10 years ago

Can you enable debugging and paste the output?

    return $.bowerFiles({ debugging: true })
akaha commented 10 years ago
[gulp] Starting 'bower'...
[gulp] PackageCollection add         backbone public/bower_components/backbone
[gulp] PackageCollection add         underscore public/bower_components/underscore
[gulp] PackageCollection add         backbone-hoodie public/bower_components/backbone-hoodie
[gulp] PackageCollection add         hoodie public/bower_components/hoodie
[gulp] PackageCollection add         jquery public/bower_components/jquery
[gulp] PackageCollection add         requirejs public/bower_components/requirejs
[gulp] PackageCollection add         backbone.marionette public/bower_components/backbone.marionette
[gulp] PackageCollection add         backbone.babysitter public/bower_components/backbone.babysitter
[gulp] PackageCollection add         backbone.wreqr public/bower_components/backbone.wreqr
[gulp] Package       select file     underscore public/bower_components/underscore/underscore.js
[gulp] Package       select file     jquery public/bower_components/jquery/dist/jquery.js
[gulp] Package       select file     requirejs public/bower_components/requirejs/require.js
[gulp] Package       select file     backbone.babysitter public/bower_components/backbone.babysitter/lib/backbone.babysitter.js
[gulp] Package       select file     backbone public/bower_components/backbone/backbone.js
[gulp] Package       select file     hoodie public/bower_components/hoodie/dist/hoodie.js
[gulp] Package       select file     backbone.wreqr public/bower_components/backbone.wreqr/lib/backbone.wreqr.js
[gulp] Package       select file     backbone-hoodie public/bower_components/backbone-hoodie/backbone-hoodie.js
[gulp] Package       select file     backbone.marionette public/bower_components/backbone.marionette/lib/backbone.marionette.js
[gulp] Package       select file     backbone.marionette public/bower_components/backbone.marionette/lib/core/amd/backbone.marionette.js
[gulp] Finished 'bower' after 3.37 s

Really weird. But the file is still not there. Maybe a problem with the hyphen?

ck86 commented 10 years ago

I don't think so. May the problem be at gulp-filter or gulp-uglify?

ck86 commented 10 years ago

Any updates?

akaha commented 10 years ago

I tested it without

.pipe(jsFilter)
.pipe($.uglify())
.pipe(jsFilter.restore())

but there is no difference. I close the issue when you can't reproduce.

ck86 commented 10 years ago

@akh91: If you are fine with it, ok. But may be you can create a basic project where I can reproduce it?

devinfd commented 10 years ago

I am experiencing the same issue. Not all bower components are selected

gulp.task('bower', function() { bower({ debugging: true }) .pipe(gulp.dest(distDir + 'scripts')); });

[18:33:42] Starting 'bower'... [18:33:42] PackageCollection add jquery assets/components/jquery [18:33:42] PackageCollection add backbone assets/components/backbone [18:33:42] PackageCollection add underscore assets/components/underscore [18:33:42] PackageCollection add accounting assets/components/accounting [18:33:42] PackageCollection add gmap3 assets/components/gmap3 [18:33:42] PackageCollection add purl assets/components/purl [18:33:42] PackageCollection add jquery-validate assets/components/jquery-validate [18:33:42] PackageCollection add jquery-cookie assets/components/jquery-cookie [18:33:42] PackageCollection add jcrop assets/components/jcrop [18:33:42] PackageCollection add modernizr assets/components/modernizr [18:33:42] Package select file jquery assets/components/jquery/dist/jquery.js [18:33:42] Package select file underscore assets/components/underscore/underscore.js [18:33:42] Package select file gmap3 assets/components/gmap3/dist/gmap3.min.js [18:33:42] Package select file purl assets/components/purl/purl.js [18:33:42] Package select file jquery-validate assets/components/jquery-validate/dist/jquery.validate.js [18:33:42] Package select file jquery-cookie assets/components/jquery-cookie/jquery.cookie.js [18:33:42] Package select file backbone assets/components/backbone/backbone.js [18:33:42] Finished 'bower' after 15 ms

ck86 commented 10 years ago

Can you create a gist with your bower.json?

devinfd commented 10 years ago

How about I just past the content of the file here or do you really need a gist?

{ "name": "app", "dependencies": { "jquery": "~2.1.1", "backbone": "~1.1.2", "accounting": "~0.3.2", "gmap3": "~6.0.0", "purl": "~2.3.1", "modernizer": "~2.8.2", "jquery-validate": "~1.13.0", "jquery-cookie": "~1.4.1", "jcrop": "~0.9.12" } }

ck86 commented 10 years ago

I fixed in 0.2.6 the order of the bower manifest files, because the .bower.json will be created by bower after installation and does not always have a main property, but it was used before package.json or component.json and sometimes there is a main property.

In addition the packages jcrop and modernizer does not have any manifest files with a main property, so you need to override them in your own bower.json:

{
    "name": "app",
    "dependencies": {
        "jquery": "~2.1.1",
        "backbone": "~1.1.2",
        "accounting": "~0.3.2",
        "gmap3": "~6.0.0",
        "purl": "~2.3.1",
        "modernizer": "~2.8.2",
        "jquery-validate": "~1.13.0",
        "jquery-cookie": "~1.4.1",
        "jcrop": "~0.9.12"
    },
    "overrides": {
        "jcrop": {
            "main": [
                "./js/jquery.Jcrop.js",
                "./css/jquery.Jcrop.css",
                "./css/Jcrop.gif"
            ]
        },
        "modernizer": {
            "main": "./modernizr.js"
        }
    }
}

Now it should work.

devinfd commented 10 years ago

It works now. Thanks!