sindresorhus/conf

Documentation Request: File Creation & Location.

CodeMan99 opened this issue · 0 comments

Questions

  • What causes the configuration file to be read?
  • What causes the configuration file to be written?
  • Where does the file exist?

Current Documentation

In my opinion, this sentence does not answer those questions.

All you have to care about is what to persist. This module will handle all the dull details like where and how.

Maybe that is intentional.

Experience

I just spent 2+ hours trying to understand when the file would be read. I found my answer by looking into the FAQ, which lead me to the env-paths module. Then I finally searched the source code, where I was able to identify my answers.

Answers Found

Suggestion One

Add details to the Conf constructor description. Maybe something like this?

Returns a new instance using the default values and file input. Will persist a default value if missing.

Suggestion Two

In the FAQ, find a way to suggest it's a good idea to keep configuration of your application in a single module. During development this pattern is useful for creating a default config by running node path/to/config-module.js.