yeoman / bower-requirejs

[DEPRECATED] Automagically wire-up installed Bower components into your RequireJS config
375 stars 68 forks source link

Add as package #76

Closed adorsk closed 10 years ago

adorsk commented 10 years ago

Here's a naive implementation for adding as package based on moduleType, per issue #1.

There a few unit tests added, but no acceptance tests. Variable/string names will probably change based on final version of moduleType in bower.json spec.

I'm also not sure yet how yall want to handle location/main, looks like there was some considerable discussion on this.

But perhaps this is can be an initial strawman. (it's actually something I need for my current projects anyway).

robdodson commented 10 years ago

I think this looks good. Can you fix up the conflicts? I'm inclined to say we check it in and see how people like it. I think using the canonicalDir unless a location is specified is the way to go. We can always evolve it if people need more flexibility. Good stuff!

adorsk commented 10 years ago

Cool, sounds good to me! I merged in the latest upstream changes just now, ready for review.

robdodson commented 10 years ago

I think moduleType is also going to come in as an array. This is what bower init generates.

{
  "name": "foo",
  "version": "0.0.0",
  "authors": [
    "Rob Dodson <robdodson@google.com>"
  ],
  "moduleType": [
    "node"
  ],
  "license": "MIT",
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "test",
    "tests"
  ],
  "dependencies": {
    "polymer": "~0.2.0"
  }
}
robdodson commented 10 years ago

@sindresorhus @wibblymat are there any packages registered that have a moduleType set to node? I'd like to build acceptance tests for this feature if you guys think it's ok to move ahead.

sindresorhus commented 10 years ago

@robdodson i doubt it. it isn't even in the spec. but you could just create one for testing.

adorsk commented 10 years ago

Just added handling for moduleType as array

robdodson commented 10 years ago

@adorsk do you want to put together an acceptance test based on @sindresorhus 's suggestion? If we can get tests in then I'd be happy to land this when bower ships the next version that contains moduleType.

adorsk commented 10 years ago

Hi @robdodson, sure thing, I'll put together an acceptance test per @sindresorhus 's suggestion. And I'll see if I can pull out the 'return config as object' feature into a separate PR.

adorsk commented 10 years ago

@robdodson acceptance test added, ready for review

sindresorhus commented 10 years ago

@robdodson

robdodson commented 10 years ago

I checked this before bower shipped moduleType but it looked ok to me then. I'm traveling this week but can look at merging this in maybe Friday if I can find some down time.

sindresorhus commented 10 years ago

@adorsk also need to fix the merge conflict ;)

adorsk commented 10 years ago

@sindresorhus Try this commit.

There was a fair amount of stuff to merge in, but it should be all there now.

robdodson commented 10 years ago

Thanks @adorsk! I've updated the grunt task, updated readmes, and published everything to npm.

adorsk commented 10 years ago

Nice! And thank you @robdodson, pleasure to contribute to this project. I like your work.