first commit
This commit is contained in:
46
build/node_modules/write-json-file/index.js
generated
vendored
Normal file
46
build/node_modules/write-json-file/index.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
var path = require('path');
|
||||
var fs = require('graceful-fs');
|
||||
var writeFileAtomic = require('write-file-atomic');
|
||||
var sortKeys = require('sort-keys');
|
||||
var objectAssign = require('object-assign');
|
||||
var mkdirp = require('mkdirp');
|
||||
var Promise = require('pinkie-promise');
|
||||
var pify = require('pify');
|
||||
|
||||
function main(fn, fp, data, opts) {
|
||||
if (!fp) {
|
||||
throw new TypeError('Expected a filepath');
|
||||
}
|
||||
|
||||
if (data === undefined) {
|
||||
throw new TypeError('Expected data to stringify');
|
||||
}
|
||||
|
||||
opts = objectAssign({
|
||||
indent: '\t',
|
||||
sortKeys: false
|
||||
}, opts);
|
||||
|
||||
if (opts.sortKeys) {
|
||||
data = sortKeys(data, {
|
||||
deep: true,
|
||||
compare: typeof opts.sortKeys === 'function' && opts.sortKeys
|
||||
});
|
||||
}
|
||||
|
||||
var json = JSON.stringify(data, opts.replacer, opts.indent) + '\n';
|
||||
|
||||
return fn(fp, json, {mode: opts.mode});
|
||||
}
|
||||
|
||||
module.exports = function (fp, data, opts) {
|
||||
return pify(mkdirp, Promise)(path.dirname(fp), {fs: fs}).then(function () {
|
||||
return main(pify(writeFileAtomic, Promise), fp, data, opts);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.sync = function (fp, data, opts) {
|
||||
mkdirp.sync(path.dirname(fp), {fs: fs});
|
||||
main(writeFileAtomic.sync, fp, data, opts);
|
||||
};
|
||||
21
build/node_modules/write-json-file/license
generated
vendored
Normal file
21
build/node_modules/write-json-file/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
86
build/node_modules/write-json-file/package.json
generated
vendored
Normal file
86
build/node_modules/write-json-file/package.json
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"_from": "write-json-file@^1.2.0",
|
||||
"_id": "write-json-file@1.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-LV3+lqvDyIkFfJOXGqQAXvtUgTQ=",
|
||||
"_location": "/write-json-file",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "write-json-file@^1.2.0",
|
||||
"name": "write-json-file",
|
||||
"escapedName": "write-json-file",
|
||||
"rawSpec": "^1.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/pwa-manifest"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/write-json-file/-/write-json-file-1.2.0.tgz",
|
||||
"_shasum": "2d5dfe96abc3c889057c93971aa4005efb548134",
|
||||
"_spec": "write-json-file@^1.2.0",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build/node_modules/pwa-manifest",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/write-json-file/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.1.2",
|
||||
"mkdirp": "^0.5.1",
|
||||
"object-assign": "^4.0.1",
|
||||
"pify": "^2.0.0",
|
||||
"pinkie-promise": "^2.0.0",
|
||||
"sort-keys": "^1.1.1",
|
||||
"write-file-atomic": "^1.1.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Stringify and write JSON to a file atomically",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"tempfile": "^1.1.1",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/write-json-file#readme",
|
||||
"keywords": [
|
||||
"json",
|
||||
"write",
|
||||
"stringify",
|
||||
"file",
|
||||
"fs",
|
||||
"graceful",
|
||||
"stable",
|
||||
"sort",
|
||||
"newline",
|
||||
"indent",
|
||||
"atomic",
|
||||
"atomically"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "write-json-file",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/write-json-file.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "1.2.0",
|
||||
"xo": {
|
||||
"ignores": [
|
||||
"test.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
73
build/node_modules/write-json-file/readme.md
generated
vendored
Normal file
73
build/node_modules/write-json-file/readme.md
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
# write-json-file [](https://travis-ci.org/sindresorhus/write-json-file)
|
||||
|
||||
> Stringify and write JSON to a file [atomically](https://github.com/iarna/write-file-atomic)
|
||||
|
||||
Creates directories for you as needed.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save write-json-file
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const writeJsonFile = require('write-json-file');
|
||||
|
||||
writeJsonFile('foo.json', {foo: true}).then(() => {
|
||||
console.log('done');
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### writeJsonFile(filepath, data, [options])
|
||||
|
||||
Returns a promise.
|
||||
|
||||
### writeJsonFile.sync(filepath, data, [options])
|
||||
|
||||
#### options
|
||||
|
||||
##### indent
|
||||
|
||||
Type: `string`, `number`
|
||||
Default: `\t`
|
||||
|
||||
Indentation as a string or number of spaces.
|
||||
Pass in `null` for no formatting.
|
||||
|
||||
##### sortKeys
|
||||
|
||||
Type: `boolean`, `function`
|
||||
Default: `false`
|
||||
|
||||
Sort the keys recursively.
|
||||
Optionally pass in a [`compare`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) function.
|
||||
|
||||
##### replacer
|
||||
|
||||
Type: `function`
|
||||
|
||||
Passed into [`JSON.stringify`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter).
|
||||
|
||||
##### mode
|
||||
|
||||
Type: `number`
|
||||
Default `438` *(0666 in octal)*
|
||||
|
||||
[Mode](https://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation) used when writing the file.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [load-json-file](https://github.com/sindresorhus/load-json-file) - Read and parse a JSON file
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
Reference in New Issue
Block a user