cosmiconfig
cosmiconfig copied to clipboard
Documentation: first example in README is too abstract
The first example should be 100% concrete.
I have a npm project with an executable script under bin relative to the package.json location. I want to load that package.json in that binary (in order to feed version to commander's program.version()). I am looking at the first example, and it does not tell me exactly how to do that. It uses placeholders like moduleName. What module? I intend to load a file, not a module. I don't understand. pathToConfig - absolute, relative to binary, relative to cwd, relative to npm package root? Please get rid of this vagueness. A "getting started" example should enable a programmer to write a hello world against your library without studying the library's code to learn how it behaves.
PRs with concrete suggestions for improving the usage snippet are welcome. It's not really an "example," so much as an illustration of how the interface works. Another idea is adding an "Examples" section.