-
-
Notifications
You must be signed in to change notification settings - Fork 26
find: Start from process.cwd() instead of __dirname. #12
Conversation
This supports a globally-installed dependency on config-chain being able to traverse a more sensible directory tree, instead of /usr/local/*.
ah, that does make more sense, but you know what? config-chain is getting messy, what you should do, is just publish this as a separate module. really, the start directory should be a parameter, anyway. Also, are you using other config-chain features? Instantly, they are freed from having to document precisely how their configuration works. |
Any reason why rc is a separate module? It is just a thin wrapper around config-chain (and directly depends on it). Why not just fold that functionality into config-chain? |
@dominictarr I think the only reason I decided not to use rc was its conflation of optimist (we use (I went down the path of making the starting directory a parameter, but went for the simplest change instead) |
Because the point of Having that as part of config-chain wouldn't be the same. Also, now |
Configuration is the sort of thing that strongly benefits from opinions, and picking just one way to do it. Even @isaacs has stated, that if he was to start npm over, he'd just use Anyway, this is technically a breaking change, so I'd want to hear from @isaacs about this change... (by the way, I've just updated rc to remove it's config-chain dep) what does nopt do that optimist doesn't do? |
nopt does extensible param validity checking. IMO, config-chain should not ever do anything with files. It should strictly be a thing to chain together config objects, and limit itself to that. npmconf only uses the ConfigChain class as a slightly more customized version of ProtoList. The file-loading opinions belong in rc (the "config file loader" module) rather than in config-chain (the "config object resolver" module). If you make breaking changes, just bump the major version. npmconf is using |
so, I no longer have anything that depends on config chain, so we can remove the file stuff, but, this pull request can be published as a new module. |
I totally respect opinionated software, I just don't like having two libraries trying to do the same thing in my module dependencies. I appreciate the changes made to rc today, and I'll explore publishing another module to incorporate the functionality we need. Thanks for all the input! |
This supports a globally-installed dependency on config-chain being able to traverse a more sensible directory tree, instead of /usr/local/*. This makes the
cc.find(".myconfigrc")
result more consistent with expectations when run by a global utility.beautifier/js-beautify#228 demonstrates this problem.