1.0.3 • Published 6 years ago

config-finder v1.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

config-finder

Find and load a configuration object. based on cosmiconfig

Installation

npm i config-finder

Features

  • Support functionaly evaluation with customize context.
  • Mixin multiple externals by extends property.

Usage

// cat package.json
{
  ...

  "fss": {
    "extends": [
      "./.fssrc.js"
    ],
    "foo": [ "bar" ]
  }
}

// cat ./.fssrc.js
module.exports = (ctx) => {
  return Object.assign({}, ctx,
    {
      rollup: { /* input, output */ }
    }
}
const configFinder = require('config-finder')
const yourModuleName = 'fss'
const modConfig = configFinder(yourModuleName)

const cfg = modConfig(ctx[, path, options])
  .then((result) => {
    // result.config is the parsed configuration object
    // result.filepath is the path to the config file that was found
  })
  .catch((parsingError) => {
    // do something constructive
  });

// sync mode
// const cfg = modConfig.sync(ctx[, path, options])

License

MIT

1.0.3

6 years ago

1.0.3-beta.2

6 years ago

1.0.3-beta.1

6 years ago

1.0.2

7 years ago

1.0.2-beta.4

7 years ago

1.0.2-beta.3

7 years ago

1.0.2-beta.2

7 years ago

1.0.2-beta.1

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago