componentjs / component

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

component.json name vs repo name? #557

Closed jasonkuhrt closed 10 years ago

jasonkuhrt commented 10 years ago

I need some clarity on component.json .name vs the project user/repo.

It seems that the .name field is not used downstream by requireing apps; instead downstream requireers must require('<repo-name>');

If true, and it seems so, this is a bit problematic. Here's the scenario:

Organization forg with repo foobar that is both a npm and component module.

They want the URI to this repo to be forg/foobar and the moudle name to be forg-foobar. This way in a registry they get to collect modules under:

forg-foobar
forg-foobar2
forg-*
...

This is easy with npm because npm uses the name field of package.json as the thing downstream will require. This is where component differs? It appears that component relies on the remote repo name.

_MOST_ of the time a repo name that matches module name is the standard but this breaks down in the organization context when you want _modules_ to be prefixed with the organization name.

jonathanong commented 10 years ago

user-repo, repo, and name should all work. i just fixed a bug with just using .name though, so you'll have to update all your deps.

jasonkuhrt commented 10 years ago

@jonathanong a bug that has yet to be rolled into component/component?

Are you saying that if a component.json has .name of "foobar" that downstream should be able to just require('foobar')?

jonathanong commented 10 years ago

yeah. ex. visionmedia/page.js. you should be able to do require('visionmedia-page.js'), require('page.js'), or require('page') (its name according to component.json). otherwise, it's a bug.

jonathanong commented 10 years ago

it's a builder bug, so i just published it to builder. just update builder and you should be good. not pinning deps here yet.

jasonkuhrt commented 10 years ago

@jonathanong Ok sweet seems to be working now!