componentjs / component

frontend package manager and build tool for modular web applications
https://github.com/componentjs/guide
MIT License
4.55k stars 305 forks source link

Resolve `name` as `name/name`. #586

Closed antaranian closed 10 years ago

antaranian commented 10 years ago

Resolve main repository in organization, when only org-name is provided, where main repository is the one with the same name as organization.

E.g.

$ component install lodash moment

should be equivalent to:

$ component install lodash/lodash moment/moment

Same should work with require, like require('moment').

While using in conjunction with naming conventions introduced by Component v.1 all parties (publishers and users) can release and "require" modules without naming differences across Component and npm.

And require('name') looks better than require('name-name') I think.

jasonkuhrt commented 10 years ago

@Antaranian Expanding lodash to lodash/lodash etc. is not a bad idea. Thanks for suggesting it.

Note however that your motivation is based on some false assumptions I think. You do not need to do this:

require('name-repo')

component knows how to resolve just this:

require('repo')

The only time you would need require('name-repo') is if you have installed two dependencies with the same name. : )

jasonkuhrt commented 10 years ago

If @jonathanong is cool with it @Antaranian feel free to submit a pull-request. You basically just need a small pure function.

Also while we're on this topic here are other wacky possibilities:

component install component/emitter, tip, foobar lodash mnmly/sldr ios7-switch

Personally I don't need this stuff, just sharing.

stephenmathieson commented 10 years ago

@jasonkuhrt the comma thing seems silly, as brace expansion already works ;)

$ component install component/{emitter,tip}

     install : component/emitter@master
     install : component/tip@master
    complete : component/emitter
    complete : component/tip
jasonkuhrt commented 10 years ago

@stephenmathieson Yup! :+1:

antaranian commented 10 years ago

Wandering if it's more Spec's related and depends on decision guys will make on component/spec#52, as this change may or may not involve changes to dependencies section in manifest file?

jonathanong commented 10 years ago

i don't really see the point since the cases where this would actually be useful is very few

jonathanong commented 10 years ago

it's also needlessly ambiguous