Comparing version 0.2.0 to 0.3.0
@@ -21,2 +21,4 @@ #! /usr/bin/env node | ||
var local = cc.find('.'+name+'rc') | ||
return deepExtend.apply(null, [ | ||
@@ -30,3 +32,4 @@ defaults, | ||
cc.json(join(home, '.' + name + 'rc')), | ||
cc.json(argv.config), | ||
cc.json(local || argv.config), | ||
local ? {config: local} : null, | ||
cc.env(name + '_'), | ||
@@ -33,0 +36,0 @@ argv |
@@ -41,1 +41,18 @@ var fs = require('fs') | ||
} | ||
var find = exports.find = function () { | ||
var rel = path.join.apply(null, [].slice.call(arguments)) | ||
function find(start, rel) { | ||
var file = path.join(start, rel) | ||
try { | ||
fs.statSync(file) | ||
return file | ||
} catch (err) { | ||
if(path.dirname(start) !== start) // root | ||
return find(path.dirname(start), rel) | ||
} | ||
} | ||
return find(process.cwd(), rel) | ||
} | ||
{ | ||
"name": "rc", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "hardwired configuration loader", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -24,2 +24,3 @@ # rc | ||
* if you passed an option `--config file` then from that file | ||
* a local `.${APPNAME}rc` or the first found looking in `./ ../ ../../ ../../../` etc. | ||
* `$HOME/.${APPNAME}rc` | ||
@@ -26,0 +27,0 @@ * `$HOME/.${APPNAME}/config` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8577
124
45