Skip to content

Instantly share code, notes, and snippets.

@KidkArolis
Last active December 15, 2015 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KidkArolis/5297165 to your computer and use it in GitHub Desktop.
Save KidkArolis/5297165 to your computer and use it in GitHub Desktop.

If the files in your filesystem looked like this

lib
  underscore.js
  backbone.js
  backbone.marionette.js
  backbone.wreqr.js
  backbone.babysitter.js

interdependencies would be resolved nicely. However, with bower's file structure, this won't work out of the box.That's why I personally don't use bower :-/ or any package manager for that matter, we pretty much manually maintain our lib directory, which kinda sucks.

I would say bower is pretty incompatible with AMD, unless like you're suggesting there existed another project that sits in between, and can structure bower packages correctly in the filesystem for AMD to consume out of the box.

Also, this particular example with marionette (node-backbone) is very fishy. In general, Bower installs depedencies in a flat way, which is what we want in a frontend package manager. E.g. if you change your component.json to

{
  "name": "node-backbone",
  "version": "0.0.0",
  "dependencies": {
    "requirejs": "~2.1.5",
    "backbone.marionette": "~1.0.2"
  }
}

That will install jquery and backbone in the same level as backbone.marionette (as those are dependencies for backbone.marionette in backbone.marionette/component.json). However this doesn't install underscore, backbone.wreqr or backbone.babysitter. So I would say that backbone and backbone.marionette packages in bower are misconfigured (bower doesn't install dependencies for those correctly), which makes the whole thing quite useless, because now you need to know about the dependencies of both of those packages and configure them in your component.json (i.e. by adding underscore as dep, and backbone.wreq as a dep, even though you shouldn't care, or what you did, configure a nested package ./components/backbone.marionette/components/backbone.wreqr/lib/amd/backbone.wreqr (where did that even come from, it's not installed for me if I run bower install)).

A bit of a mess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment