@blinkmobile/blinkmrc
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -59,12 +59,16 @@ 'use strict'; | ||
function write (filePath, data) { | ||
return writeJson(filePath, data) | ||
function write (filePath, options, data) { | ||
options = Object.assign({}, { | ||
indent: 2, | ||
sortKeys: true | ||
}, options); | ||
return writeJson(filePath, data, options) | ||
.then(() => data); | ||
} | ||
function update (filePath, updater) { | ||
function update (filePath, options, updater) { | ||
assertUpdater(updater); | ||
// it's okay if the file does not exist yet | ||
return resolveOnError(load, 'ENOENT', {})(filePath) | ||
.then((data) => write(filePath, updater(data))); | ||
.then((data) => write(filePath, options, updater(data))); | ||
} | ||
@@ -81,4 +85,4 @@ | ||
load: load.bind(null, filePath), | ||
update: update.bind(null, filePath), | ||
write: write.bind(null, filePath) | ||
update: update.bind(null, filePath, { mode: options.fileMode }), | ||
write: write.bind(null, filePath, { mode: options.fileMode }) | ||
}; | ||
@@ -85,0 +89,0 @@ } |
@@ -17,2 +17,3 @@ 'use strict'; | ||
options.dir = options.cwd || process.cwd(); | ||
options.fileMode = options.fileMode || 0o666; | ||
@@ -19,0 +20,0 @@ return config(options); |
@@ -40,2 +40,4 @@ 'use strict'; | ||
options.fileMode = options.fileMode || 0o600; | ||
const cfg = config(options); | ||
@@ -42,0 +44,0 @@ |
{ | ||
"name": "@blinkmobile/blinkmrc", | ||
"description": "bit like https://github.com/yeoman/configstore but with home-directory and project-specific files", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"bugs": { | ||
@@ -6,0 +6,0 @@ "url": "https://github.com/blinkmobile/blinkmrc.js/issues" |
@@ -48,4 +48,5 @@ # blinkmrc.js | ||
interface ConfigOptions { | ||
fileMode = 0o600: Number, | ||
userConfigDir?: String, | ||
...ConfigOptions | ||
...ConfigOptions | ||
} | ||
@@ -67,2 +68,3 @@ ``` | ||
cwd = process.cwd(): String, | ||
fileMode = 0o666: Number, | ||
...ConfigOptions | ||
@@ -78,3 +80,4 @@ } | ||
name: String, | ||
filename = 'blinkmrc.json': String | ||
filename = 'blinkmrc.json': String, | ||
fileMode?: Number | ||
} | ||
@@ -81,0 +84,0 @@ ``` |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
9867
8
129
122
1