write-json-file
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -6,3 +6,3 @@ 'use strict'; | ||
const sortKeys = require('sort-keys'); | ||
const mkdirp = require('mkdirp'); | ||
const makeDir = require('make-dir'); | ||
const pify = require('pify'); | ||
@@ -37,8 +37,8 @@ | ||
module.exports = (fp, data, opts) => | ||
pify(mkdirp)(path.dirname(fp), {fs}) | ||
makeDir(path.dirname(fp), {fs}) | ||
.then(() => main(pify(writeFileAtomic), fp, data, opts)); | ||
module.exports.sync = (fp, data, opts) => { | ||
mkdirp.sync(path.dirname(fp), {fs}); | ||
makeDir.sync(path.dirname(fp), {fs}); | ||
main(writeFileAtomic.sync, fp, data, opts); | ||
}; |
{ | ||
"name": "write-json-file", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Stringify and write JSON to a file atomically", | ||
@@ -37,15 +37,12 @@ "license": "MIT", | ||
"graceful-fs": "^4.1.2", | ||
"mkdirp": "^0.5.1", | ||
"make-dir": "^1.0.0", | ||
"pify": "^2.0.0", | ||
"sort-keys": "^1.1.1", | ||
"write-file-atomic": "^1.1.2" | ||
"write-file-atomic": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"tempfile": "^1.1.1", | ||
"tempfile": "^2.0.0", | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"esnext": true | ||
} | ||
} |
# write-json-file [![Build Status](https://travis-ci.org/sindresorhus/write-json-file.svg?branch=master)](https://travis-ci.org/sindresorhus/write-json-file) | ||
> Stringify and write JSON to a file [atomically](https://github.com/iarna/write-file-atomic) | ||
> Stringify and write JSON to a file [atomically](https://github.com/npm/write-file-atomic) | ||
@@ -30,3 +30,3 @@ Creates directories for you as needed. | ||
Returns a promise. | ||
Returns a `Promise`. | ||
@@ -37,8 +37,10 @@ ### writeJsonFile.sync(filepath, data, [options]) | ||
Type: `Object` | ||
##### indent | ||
Type: `string`, `number` | ||
Type: `string` `number`<br> | ||
Default: `\t` | ||
Indentation as a string or number of spaces. | ||
Indentation as a string or number of spaces.<br> | ||
Pass in `null` for no formatting. | ||
@@ -48,6 +50,6 @@ | ||
Type: `boolean`, `function` | ||
Type: `boolean` `function`<br> | ||
Default: `false` | ||
Sort the keys recursively. | ||
Sort the keys recursively.<br> | ||
Optionally pass in a [`compare`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) function. | ||
@@ -63,4 +65,4 @@ | ||
Type: `number` | ||
Default `438` *(0666 in octal)* | ||
Type: `number`<br> | ||
Default: `0o666` | ||
@@ -73,2 +75,3 @@ [Mode](https://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation) used when writing the file. | ||
- [load-json-file](https://github.com/sindresorhus/load-json-file) - Read and parse a JSON file | ||
- [make-dir](https://github.com/sindresorhus/make-dir) - Make a directory and its parents if needed | ||
@@ -78,2 +81,2 @@ | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
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
4635
77
+ Addedmake-dir@^1.0.0
+ Addedmake-dir@1.3.0(transitive)
+ Addedpify@3.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedwrite-file-atomic@2.4.3(transitive)
- Removedmkdirp@^0.5.1
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedslide@1.1.6(transitive)
- Removedwrite-file-atomic@1.3.4(transitive)
Updatedwrite-file-atomic@^2.0.0