componentjs / spec

Component specs
34 stars 4 forks source link

omit main when component contains a single script #28

Closed jonathanong closed 10 years ago

jonathanong commented 10 years ago

https://github.com/component/builder.js/issues/34

ianstormtaylor commented 10 years ago

pretty sure chrome has fuzzy(er) matching now

jonathanong commented 10 years ago

what do you mean?

ianstormtaylor commented 10 years ago

one of the issues was people didnt want to use index.js so they wanted main to do the work for them still. but we use index.js for everything, and the matching has improved a lot so you can look by component name now and not get screwed like before while debugging

jonathanong commented 10 years ago

what does that have to do with chrome, though?

are you saying we could/should omit it now? i think it should default to index.js or scripts[0]

ianstormtaylor commented 10 years ago

im saying the want to not name things index.js should be greatly reduced now, and it seems like the debugging tools problem.

although i think main = scripts.length == 1 ? scripts[0] : 'index.js' might be better. otherwise with multiples it might be too much to assume.

regardless we should have a nicer failure state cuz ive been bitten by forgetting it a lot

jonathanong commented 10 years ago

yeah, i'm down for that too.

dominicbarnes commented 10 years ago

Any chance of main being implicitly included in scripts?

jonathanong commented 10 years ago

@dominicbarnes i'm meh on that. i'd rather be able to just do "scripts": "module.js".

another issue is globs without a main. there's no order, so you can't just do script[0]. we'd either have to force a main, or check/require an index.js within the glob.

jonathanong commented 10 years ago

@visionmedia opinions? otherwise i'm going to do main = scripts.length == 1 ? scripts[0] : 'index.js' and throw if scripts[0].indexOf('*') !== -1

jonathanong commented 10 years ago

@visionmedia what's your opinion on this?

jonathanong commented 10 years ago

i'm thinking that this is more of an implementation detail. if you don't specify a main file, then the builder can magically assume whatever it wants.

jonathanong commented 10 years ago

going to close for now. my opinion now is that the builder should be able to infer the main and be flexible with it. we can reopen if people actually run into issues.