myconf
Easily manage a config file in your project.
Last updated 5 years ago by kchan .
MIT · Original npm · Tarball · package.json
$ cnpm install myconf 
SYNC missed versions from official npm registry.

myconf

NPM version NPM download David Status

Easily manage a config file in your project.

You always want to make it possible for users to save some custom configs with a Node.js command line tool, such like you made a node-version Git tool and wanna save the configs to /Users/$username/.gitconfig. That's why I made this tool to facilitate your development.

Example

import Config from 'myconf'

// This points to a file $USER_HOME/.customconfig
const config = new Config('.customconfig')

// or save the file to a custom path
config.path('/path/to/save/to')

// or change a parser, the default is `json`
// parser in ['json', 'yaml']
config.parser('yaml')

// set a property
config
  .set('name', 'config for my project')
  .then(data => console.log(data.name))

// set multi properties
config
  .set({name: 'egoist', version: '1.4.2'})
  .then(data => console.log(data))

// get a property
config
  .get('name')
  .then(name => console.log(name))

// get all properties
config
  .get()
  .then(data => console.log(data.name))

// override the config file
config
  .save({newName: 'inori', oldName: 'will_gone'})
  .then(data => console.log(data))

License

This project is released under SOX license that means you can do whatever you want to do, but you have to open source your copy on github if you let the public uses it. All copies should be released under the same license. The owner of each copy is only reponsible for his own copy, not for the parents, not for the children.

permitted use:
fork on github
change
do evil with your copy

prohibted use:
do evil with copies not of your own
open source your copy without declaring your parent copy

Current Tags

  • 0.0.32                                ...           latest (5 years ago)

7 Versions

  • 0.0.32                                ...           5 years ago
  • 0.0.31                                ...           5 years ago
  • 0.0.3                                ...           5 years ago
  • 0.0.21                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
  • 0.0.11                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 8
Last Day 1
Last Week 1
Last Month 9
Dependencies (4)
Dev Dependencies (3)
Dependents (3)

Copyright 2014 - 2016 © taobao.org |