Launch Week Day 2: Introducing Reports: An Extensible Reporting Framework for Socket Data.Learn More
Socket
Book a DemoSign in
Socket

clobfig

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clobfig

A configurator library

latest
Source
npmnpm
Version
1.2.8
Version published
Weekly downloads
14
27.27%
Maintainers
1
Weekly downloads
 
Created
Source

clobfig

A configurator library

getting started

clobfig looks for a config/ folder one folder up or in the root of the running application using appRoot. clobfig clobbers all of the files within the config folder found that have 'config.js' in their name and all .json files. The json files are loaded first and are loaded as [name].json (ex: pages.json => clobfig.pages). Note: all json files are loaded this way with the exception of config.json

Finally, clobfig provides a mechanism for overridding values from a present package.json file. Using the schema title: "@{title}" tells clobfig to pull this value from the package.json file in the root of the project. You can prime the loading of clobfig by simply passing the values to grab from the package.json with:

  const config = require('clobfig')({ title: "@title" })

usage

/config/config.json:

{
  "value1": "one"
}

/config/config.js:

module.exports = {
  version: "@version"
}

/config/data.json:

{
  "somedata": "somevalue"
}

/package.json:

{
  "title": "example app",
  "version": "0.1.0"
}

/index.js:

const config = require('clobfig')({ title: "@title" })

console.log(config)

The code example above will output:

{
  title: "example app",
  version: "0.1.0",
  data: {
    somedata: "somevalue"
  },
  value1: "one"
}

Keywords

node

FAQs

Package last updated on 19 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts