yatskevich / grunt-bower-task

Grunt plugin for Bower
MIT License
490 stars 117 forks source link

.bowerrc file overrides options set in Gruntfile #90

Open seanhess opened 10 years ago

seanhess commented 10 years ago

I have a bower.json in the root of my repository. I followed the setup instructions carefully. I am an experienced grunt and bower user.

bower: {
  install: {}
}

When I run it, it says the following

hintprint> grunt bower:install
Running "bower:install" (bower) task
>> Installed bower packages
>> Copied packages to /Users/myname/projects/xxxx/lib

Done, without errors.

There are no files in the lib directory. It exits successfully, but doesn't seem to do anything.

Here is my bower file: (saved in bower.json in the root of the repository)

{
  "name": "angularjs-bootstrap",
  "version": "0.1.0",
  "license": "MIT",
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "test",
    "tests"
  ],
  "dependencies": {
    "bootstrap": "~3.0.0",
    "jquery": "~2.0.3",
    "angular": "v1.2.0",
    "angular-route": "~1.2.0",
    "Snap.svg": "~0.1.0",
    "svg.js": "*",
    "svg.pattern.js": "wout/svg.pattern.js",
    "svg.import.js": "wout/svg.import.js",
    "bootstrap-slider": "pammacdotnet/bootstrap-slider",
    "font-awesome": "~4.0.3",
    "lodash": "~2.3.0"
  }
}
yatskevich commented 10 years ago

@seanhess what version of the task do you use? Version 0.3.3 introduced this issue, but it was fixed quickly in 0.3.4.

seanhess commented 10 years ago

I installed it via NPM yesterday. I'll check soon and let you know.

On Sunday, November 24, 2013, Ivan Yatskevich wrote:

@seanhess https://github.com/seanhess what version of the task do you use? Version 0.3.3 introduced this issue, but it was fixed quickly in 0.3.4.

— Reply to this email directly or view it on GitHubhttps://github.com/yatskevich/grunt-bower-task/issues/90#issuecomment-29152800 .

seanhess commented 10 years ago

I am using 0.3.4 and still have the issue. Am I configuring it wrong? Does it check for bower.json automatically or am I supposed to tell the config about the file or something?

seanhess commented 10 years ago

Any word on a fix for this?

seanhess commented 10 years ago

This bug is because I have a .bowerrc file that tells bower to install to a different directory. It must override whatever settings you are sending it. So, it was installing the dependencies to my public/bower/ directory the whole time, but it printed that it installed to a different folder in the terminal so I thought it wasn't working.

So all this does is run bower install for you? Does it have any facility for reading bower.json to look for the assets and scripts and move them around or concatenate them?

seanhess commented 10 years ago

Ok, I think this is maybe just a documentation problem. I was originally ONLY looking for a tool to grab the main files from each bower dependencies and put them somewhere. This tool can do that, but it is hidden way down the page, and the workflow is confusing (I originally had bower and this tool targeting the same folder, which didn't work).

drozzy commented 10 years ago

So this doesn't really do anything for me either....

seanhess commented 10 years ago

I switched to using https://github.com/sapegin/grunt-bower-concat - It doesn't do the same thing, but is more what I wanted. The maintainer is active.

On Tue, Dec 10, 2013 at 3:01 PM, drozzy notifications@github.com wrote:

So this doesn't really do anything for me either....

— Reply to this email directly or view it on GitHubhttps://github.com/yatskevich/grunt-bower-task/issues/90#issuecomment-30272641 .

drozzy commented 10 years ago

@seanhess Wow, looks great. Thanks. EDIT: Yeah... that doesn't work flawlessly either. And it doesn't work for non-js files (css/fonts etc.)

yatskevich commented 10 years ago

@seanhess Could you please point to a docs section which is not clear or misleading? I'd be happy to improve the docs :smile:

@drozzy What do you expect from grunt-bower-task?

seanhess commented 10 years ago

I think it wasn't clear that the files are installed to a folder different from your bower folder. See my comment above.

I needed a tool that made bower "just work", and copying main files into a folder isn't as important as combining the JS in dependency order. That's why I'm using grunt-bower-concat. I'm not sure what problem this solves. I just checked the docs, and it jumps right in to usage. I think a section on the problem you're solving would be good.

I think you should clear up what all the folders mean in the docs.

yatskevich commented 10 years ago

Thanks for the clarification! We're going to simplify workflow in the next version (see #93).

yatskevich commented 10 years ago

@seanhess Do you think we can close this issue for now?

seanhess commented 10 years ago

Yes, go ahead

On Wed, Dec 11, 2013 at 8:49 AM, Ivan Yatskevich notifications@github.comwrote:

Do you think we can close this issue for now?

— Reply to this email directly or view it on GitHubhttps://github.com/yatskevich/grunt-bower-task/issues/90#issuecomment-30331529 .

drozzy commented 10 years ago

No, I think copying the files is pretty important too. For example consider a workflow with coffee/script or live script which need to be compiled prior to distribution. The problem with this plugin was that it didn't do anything when I ran the grunt bower:install command (no folder was created under my lib or anything).

yatskevich commented 10 years ago

@drozzy If you create a gist (like this one) which reproduces your problem, then I'll be able to check things out on my machine.

cheton commented 10 years ago

I encountered the same issue while coping files to another folder (i.e. from bower_components/*.* to web/bower_components/*.*) with version 0.3.x, but everything is fine after I rollback to 0.2.x.

    {
        "directory": "bower_components",
        "json": "bower.json"
    }
    bower: {
        copy: {                                                                                                                                              
            options: {                                                                                                                                       
                targetDir: 'web/bower_components', // A directory where you want to keep your Bower packages.                                                
                install: false, // Whether you want to run bower install task itself (e.g. you might not want to do this each time on CI server).            
                cleanTargetDir: true, // Will clean target dir before running install.                                                                       
                cleanBowerDir: false, // Will remove bower's dir after copying all needed files into target dir.                                             
                copy: true, // Copy Bower packages to target directory.                                                                                      
                //cleanup: false, // If set to true or false then both cleanBowerDir & cleanTargetDir are set to the value of cleanup.                       
                layout: function(type, component) { // There are two built-in named layouts: byType and byComponent.                                         
                     return path.join(type, component);                                                                                                       
                },                                                                                                                                           
                verbose: true // The task will provide more (debug) output when this option is set to true.                                                  
            }
        }
    }
aesnyder commented 10 years ago

I'm having the same issue mentioned above ^

originative commented 10 years ago

I was having the same problems and tracked it down the bower.commands.list call. This little patch fixed the problems for me.

--- a/tasks/lib/bower_assets.js
+++ b/tasks/lib/bower_assets.js
@@ -57,7 +57,7 @@ BowerAssets.prototype.get = function() {
   var bowerConfig = grunt.file.readJSON(path.join(this.cwd, this.config));
   var exportsOverride = bowerConfig.exportsOverride;

-  var paths = bower.commands.list({paths: true});
+  var paths = bower.commands.list({paths: true, relative: false});
   paths.on('end', function(data) {
     this.emit('end', this.mergePaths(data, exportsOverride ? exportsOverride : 
   }.bind(this));
atomicleopard commented 10 years ago

I also had this issue, I can confirm that removing my .bowerrc made the task work as expected. With it present nothing seems to happen (although it reports success).

imjared commented 10 years ago

+1 for the .bowerrc issue persisting in 0.3.4

mynameistechno commented 10 years ago

Why doesn't it respect the directory setting in .bowerrc? This requires me having to specify it in 2 locations, making it brittle.

Dakuan commented 10 years ago

+1 for the .bowerrc issue persisting in 0.3.4

petergillardmoss commented 10 years ago

+1 I'm getting this as well.