dbashford / mimosa-bower

Bower integration module for mimosa
3 stars 2 forks source link

Support for updating bower and tracing bower copy. #32

Open ghost opened 10 years ago

ghost commented 10 years ago

Right now I don't know of a way to update bower packages. I was working with the Durandal Starter Kit which uses older versions of Bootstrap and Knockout. Bower itself doesn't have something like Nuget's Update-Package command, so I ended up running bower install <package-name> over every package to update it.

Ideally there would be a command that examines the bower dependency tree and updates each package to the maximum supported version and rewrite the bower.json to reflect the new structure.

I also ran into an issue with the bower.copy.mainOverrides feature. Bootstrap likes its asset structure a certain way (such as fonts being stored at ../fonts), so I was using copy overrides to try to copy the files to the assets/fonts folder with { "dist/fonts": "../../fonts" }

  bower:
    copy:
      mainOverrides:
        "knockout.js":["knockout.js","knockout.debug.js"]
        "bootstrap": [
          { "dist/fonts": "../../fonts" }
          "dist/js/bootstrap.js"
          "dist/css/bootstrap.css"
          "dist/css/bootstrap-theme.css"
        ]
        "font-awesome": [
          { fonts: "../../font" }
          "css/font-awesome.css"
        ]
        "durandal": [
          {
            img: "../../images"
            js: "durandal"
            css: "durandal"
          }
        ]

except the console output would only show that it has failed.

image

It would be useful to have a trace to see what directory mimosa-bower is trying to copy the files, but failing.

dbashford commented 10 years ago

Good stuff. Will take a look.

I'm super deep in some refactoring on the path towards getting a 2.0 out in the new year, but I should be able to tackle these in the next few weeks. I'll probably need the break. =)

Thanks!

dbashford commented 10 years ago

For the image you've attached, could I get the bower.json you were using?

dbashford commented 10 years ago

Now that I've taken a look...

The block of code that writes that warning should be fairly unreachable. I put it there to catch something that at the time I felt ought not happen, but I was covering my bases.

What you've exposed is a bug probably related to paths on Windows. mimosa-bower is attempting to match dist/fonts to dist\fonts and not finding any matches and it is getting confused about that, because where that is happening ought not happen.

I'm not sure if swapping the slashes will fix the problem in the short-term, but I'm hoping to get a fix in regardless.

ghost commented 10 years ago

I'll grab the bower.json when I get home today (you can grab the skeleton from BlueSpire / Durandal-Mimosa-Skeleton). My thinking with { 'dist/fonts' : '../../fonts' } is to move the contents of the directory to a new path. This would translate to xcopy /S <source folder> <destination folder>with the <source folder> and <destination folder> in double quotes when the path contains a space.

dbashford commented 10 years ago

That is exactly what that does. You'll notice it works just fine with { fonts: "../../font" }. The problem is with the Windows style paths I mentioned above. I believe its a windows only bug as that config works fine for me on my mac.

So the bower.json is unmodified from the skeleton? That's all I need then. Thanks!

ghost commented 10 years ago

Yes the bower.json file is the same except I ran bower install <package-name> --save over every dependency.