RaveJS / rave

Zero-configuration application bootstrap and development
277 stars 8 forks source link

why has directories.lib support been added #60

Open KidkArolis opened 10 years ago

KidkArolis commented 10 years ago

What changed since https://github.com/RaveJS/rave/issues/3#issuecomment-39242879? Is it not a bad idea to make this incompatible with node?

unscriptable commented 10 years ago

I said:

I'm not sure we can use directories.lib since npm and node ignore it. If one environment uses it and another doesn't, this would prevent code from being portable between rave and node.

Thanks for reminding me! It's somewhat ironic, but I added this feature because there are already packages on npm that aren't compatible with node!

My latest thinking is that if the npm folks really want to claim that npm is not just for node, then we need to make sure we can consume packages that aren't structured in "the node way". This feature would help.

What do you think, @KidkArolis?

unscriptable commented 10 years ago

After talking with @briancavalier, we outlined our options for "safely" supporting npm packages that don't follow node's directory conventions:

  1. Keep the functionality that we released in 0.3.0 and discourage use of a top-level directories.lib through documentation.
  2. Keep the functionality that we released in 0.3.0 and prevent use of a top-level directories.lib through special-case logic.
  3. Change the metadata property from directories.lib to something unique like modules_root. :)

Any other ideas?

unscriptable commented 10 years ago

Any further opinion or comment on this issue?

phated commented 10 years ago

Can you compare the directories.lib to the main property and see if they share a common path? Typically, if the main doesn't exist in the directories.lib, then it is the entry point that will load files from directories.lib. Also, note that npm init currently adds directories it sees to directories.

unscriptable commented 10 years ago

Pasted from #cujojs:

[9:41pm] phated: if i set directories.lib to 'src/'
[9:41pm] phated: and my main is 'src/main.js'
[9:41pm] phated: since they share the src/ directory
[9:41pm] phated: the root of my package is probably src/
[9:42pm] phated: instead of /
[9:42pm] phated: if i just had 'main.js', the root of my package is /
[9:42pm] phated: and main.js will probably require from src/

Seems reasonable. Any thoughts from others?