dbashford / mimosa-bower

Bower integration module for mimosa
3 stars 2 forks source link

Not copying components into project #1

Closed aharonp closed 11 years ago

aharonp commented 11 years ago

I'm using the default config. I've reinstalled mimosa + modules to latest versions.

I created a bower.json file in the project root and added one component to the dependency list.

When I run mimosa bower:install or mimosa build the bower component is downloaded into .mimosa/bower_components but does not get copied into the mimosa output folder.

dbashford commented 11 years ago

Do you have a javascripts/vendor? What might the structure of your app be?

aharonp commented 11 years ago

I've defined:

vendor:
  javascripts: 'js/vendor'

I have not specified any bower config as the defaults are fine.

Is there something else I should be doing?

aharonp commented 11 years ago

Commenting out the vendor config (i.e. using the default JS vendor path of javascripts/vendor) doesn't seem to help.

dbashford commented 11 years ago

Refresh me, what is your OS/node version?

aharonp commented 11 years ago

Ubuntu 13.04 Node version 0.10.13

Let me know if there's any other info I can provide.

dbashford commented 11 years ago

Hopefully this isn't an ubuntu thing, if so I won't be able to replicate it.

One thing I didn't do much of with the bower module is sprinking logger.debug statements. So if it does end up being something I can't track down, I may just add a bunch of logging and see if that doesn't help narrow things down on your machine.

Sorry for the trouble!!

dbashford commented 11 years ago

One thing I should add, between tests to try and get it working, remove the .mimosa/bower_components directory (or enable cleaning and just use mimosa bower). Bower itself, when pointed at that directory, smartly only pulls in the things that haven't been installed yet or that have had a version change. So, if you've got a bug with the copying into the vendor directories, then to attempt to try things out, between mimosa bower or mimosa watch executions, you'll need to nuke that folder.

Once the copy happens successfully, obviously that won't be a problem as it'll just keep doing what it ought to do. When you change a version, it'll detect it and do all the appropriate copying.

dbashford commented 11 years ago

So I have updated mimosa-bower with some debugging and a few small refactors. No fundamental changes though.

I also tossed up a real simple test project that mimics the mimosa new output, except uses bower to pull in requirejs and jquery. https://github.com/dbashford/MimosaBowerExample When you get a minute, could you pull that down and throw a mimosa watch -s on it and let me know how that goes? If that works for you, then I know its something to do with folders being changed.

If that doesn't work, could you post the output from mimosa bower -D (after hand deleting .mimosa)

aharonp commented 11 years ago

That seems to have worked.

$ mimosa watch -s
23:37:22 - Did not find compiled directory [[ /projects/MimosaBowerExample/public ]], so making it for you
23:37:45 - mimosa-bower created file [[ /projects/MimosaBowerExample/assets/javascripts/vendor/jquery/jquery.js ]]
23:37:45 - mimosa-bower created file [[ /projects/MimosaBowerExample/assets/javascripts/vendor/requirejs/require.js ]]
23:37:45 - Watching /projects/MimosaBowerExample/assets
23:37:45 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/main.js ]]
23:37:45 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/app/example-view.js ]]
23:37:46 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/vendor/requirejs/require.js ]]
23:37:46 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/vendor/jquery/jquery.js ]]
23:37:46 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/app/template/handlebars-helpers.js ]]
23:37:46 - Compiled/copied [[ /projects/MimosaBowerExample/public/stylesheets/style.css ]]
23:37:46 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/templates.js ]]
23:37:46 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/vendor/handlebars.js ]]
23:37:46 - Mimosa is starting your server: /projects/MimosaBowerExample/server.coffee
Express server listening on port 3000 in development mode
   info  - socket.io started
dbashford commented 11 years ago

What is the dependency you added that isn't working?

If you add it to the bower.json of the MimosaBowerExample, does it do what you expect?

aharonp commented 11 years ago

Aha!

This is my bower.json file. When I added the component uri.js to the test project's bower.json file, it installs the other components but not this one. In my case, I see no output at all, as I have just this one dependency defined.

{
  "name": "test",
  "version": "0.1.0",
  "dependencies": {
    "uri.js": "1.10"
  }
}

It still doesn't explain why this component doesn't get installed.

aharonp commented 11 years ago

OK this get even more strange...

I changed the test project's bower.json file to this:

{
  "name": "test",
  "version": "1.0.0",
  "dependencies": {
    "jquery": "latest"
  }
}

I ran mimosa build and it works as expected. The jquery component gets installed to the `javascripts/vendor' folder. Here is the output:

$ mimosa build
00:21:36 - Beginning build
00:21:36 - Did not find compiled directory [[ /projects/MimosaBowerExample/public ]], so making it for you
00:21:37 - mimosa-bower created file [[ /projects/MimosaBowerExample/assets/javascripts/vendor/jquery/jquery.js ]]
00:21:37 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/main.js ]]
00:21:37 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/app/example-view.js ]]
00:21:37 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/app/template/handlebars-helpers.js ]]
00:21:37 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/vendor/jquery/jquery.js ]]
00:21:37 - Compiled/copied [[ /projects/MimosaBowerExample/public/stylesheets/style.css ]]
00:21:37 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/templates.js ]]
00:21:37 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/vendor/handlebars.js ]]
00:21:37 - Finished build

Then I changed bower.json to this below (just added uri.js):

{
  "name": "test",
  "version": "1.0.0",
  "dependencies": {
    "jquery": "latest",
    "uri.js": "1.10"
  }
}

I then deleted the .mimosa, assets/javascripts/vendor and public folders and ran mimosa build again. This time I get the following result:

$ mimosa build
00:29:06 - Beginning build
00:29:06 - Did not find compiled directory [[ /projects/MimosaBowerExample/public ]], so making it for you
00:29:06 - mimosa-bower created file [[ /projects/MimosaBowerExample/assets/javascripts/vendor/jquery/jquery.js ]]
00:29:06 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/main.js ]]
00:29:06 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/app/example-view.js ]]
00:29:06 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/app/template/handlebars-helpers.js ]]
00:29:06 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/vendor/jquery/jquery.js ]]
00:29:07 - Deleted file [[ /projects/MimosaBowerExample/public/javascripts/vendor/jquery/jquery.js ]]
00:29:07 - Compiled/copied [[ /projects/MimosaBowerExample/public/stylesheets/style.css ]]
00:29:07 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/templates.js ]]
00:29:07 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/vendor/handlebars.js ]]
00:29:07 - Dependency [[ vendor/jquery/jquery ]] for path alias [[ jquery ]], inside file [[ /projects/MimosaBowerExample/public/javascripts/main.js ]], cannot be found.
00:29:07 - Dependency [[ jquery ]], inside file [[ /projects/MimosaBowerExample/public/javascripts/app/example-view.js ]], cannot be found.
00:29:07 - Finished build

I notice that it installs jquery and then deletes it for some reason. It seems to completely ignore the second component, uri.js.

aharonp commented 11 years ago

Now running it again with the two components specified in bower.json: jquery and uri.js (having deleted the .mimosa folder), I get this result:

$ mimosa build
00:36:34 - Beginning build
00:36:34 - Did not find compiled directory [[ /projects/MimosaBowerExample/public ]], so making it for you
$

i.e. nothing at all, except both components seem to have been downloaded into .mimosa/bower_components.

Running mimosa build again (without deleting anything first), I get this:

$ mimosa build
00:40:27 - Beginning build
00:40:27 - No bower packages to install.
00:40:27 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/main.js ]]
00:40:27 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/app/example-view.js ]]
00:40:27 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/app/template/handlebars-helpers.js ]]
00:40:28 - Compiled/copied [[ /projects/MimosaBowerExample/public/stylesheets/style.css ]]
00:40:28 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/templates.js ]]
00:40:28 - Compiled/copied [[ /projects/MimosaBowerExample/public/javascripts/vendor/handlebars.js ]]
00:40:28 - Dependency [[ vendor/jquery/jquery ]] for path alias [[ jquery ]], inside file [[ /projects/MimosaBowerExample/public/javascripts/main.js ]], cannot be found.
00:40:28 - Dependency [[ jquery ]], inside file [[ /projects/MimosaBowerExample/public/javascripts/app/example-view.js ]], cannot be found.
00:40:28 - Finished build

I hope that's enough information to help figure out what's going on.

dbashford commented 11 years ago

Yep, all good info. Clearly certain packages causing trouble. Will start digging.

dbashford commented 11 years ago

I've got a fix for the initial problem. Going to break out the oddness when you run mimosa build as a second issue. In case that issue ends up being difficult to track down, going to go ahead and release a new version with the fix for this so you can play around with it.

dbashford commented 11 years ago

0.2.1 published to npm with the fix for the initial problem. Digging into the other one now.

egaga commented 10 years ago

I got similar problem. Has this been fixed yet? egaga$ bower --version 1.3.2 egaga$ mimosa --version 2.1.22 egaga$ npm --version 1.4.3

dbashford commented 10 years ago

Open new issue with details?

A sample repo helps a good deal too.

egaga commented 10 years ago

Sorry to bother you, I managed to get it working most of the dependencies by cleaning up things, and eventually I found that there was also a knockout/bower.js issue: https://github.com/knockout/knockout/issues/1039

For some reason, knockout was the only dependency that was installed in bower_components but not copied to assets/.../vendor

I get it to work by *): 1) bower install --save http://knockoutjs.com/downloads/knockout-3.1.0.js 2) having the following in bower.json: "knockout": "http://knockoutjs.com/downloads/knockout-3.1.0.js"

*) https://github.com/knockout/knockout/issues/1039#issuecomment-40360472