@sanity/util
Advanced tools
Comparing version 0.113.7 to 0.115.0-alpha.d2d05de5
@@ -11,5 +11,5 @@ 'use strict'; | ||
var _fsPromise = require('fs-promise'); | ||
var _fsExtra = require('fs-extra'); | ||
var _fsPromise2 = _interopRequireDefault(_fsPromise); | ||
var _fsExtra2 = _interopRequireDefault(_fsExtra); | ||
@@ -28,4 +28,4 @@ var _readLocalManifest = require('./readLocalManifest'); | ||
return manifest; | ||
}).then(manifest => _fsPromise2.default.writeJson(_path2.default.join(sanityDir, 'sanity.json'), manifest, { spaces: 2 })); | ||
}).then(manifest => _fsExtra2.default.writeJson(_path2.default.join(sanityDir, 'sanity.json'), manifest, { spaces: 2 })); | ||
exports.default = addPluginToManifest; |
@@ -12,3 +12,3 @@ 'use strict'; | ||
try { | ||
return _fsPromise2.default.readJson(_path2.default.join(dirName, fileName)); | ||
return _fsExtra2.default.readJson(_path2.default.join(dirName, fileName)); | ||
} catch (err) { | ||
@@ -28,5 +28,5 @@ if (err.code === 'ENOENT') { | ||
var _fsPromise = require('fs-promise'); | ||
var _fsExtra = require('fs-extra'); | ||
var _fsPromise2 = _interopRequireDefault(_fsPromise); | ||
var _fsExtra2 = _interopRequireDefault(_fsExtra); | ||
@@ -33,0 +33,0 @@ var _path = require('path'); |
@@ -6,31 +6,21 @@ 'use strict'; | ||
}); | ||
exports.loadJson = undefined; | ||
let loadJson = exports.loadJson = (() => { | ||
var _ref = _asyncToGenerator(function* (file, defaultVal) { | ||
return _fsPromise2.default.readJson(file).catch(function () { | ||
return defaultVal; | ||
}); | ||
}); | ||
return function loadJson(_x, _x2) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
})(); | ||
exports.loadJsonSync = loadJsonSync; | ||
exports.loadJson = loadJson; | ||
exports.parseJson = parseJson; | ||
var _fsPromise = require('fs-promise'); | ||
var _fsExtra = require('fs-extra'); | ||
var _fsPromise2 = _interopRequireDefault(_fsPromise); | ||
var _fsExtra2 = _interopRequireDefault(_fsExtra); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } | ||
function loadJsonSync(file, defaultVal) { | ||
return _fsPromise2.default.readJsonSync(file, { throws: false }) || defaultVal; | ||
// eslint-disable-next-line no-sync | ||
return _fsExtra2.default.readJsonSync(file, { throws: false }) || defaultVal; | ||
} | ||
function loadJson(file, defaultVal) { | ||
return _fsExtra2.default.readJson(file).catch(() => defaultVal); | ||
} | ||
function parseJson(json, defaultVal) { | ||
@@ -37,0 +27,0 @@ try { |
{ | ||
"name": "@sanity/util", | ||
"version": "0.113.7", | ||
"version": "0.115.0-alpha.d2d05de5", | ||
"description": "Utilities shared across projects of Sanity", | ||
@@ -25,3 +25,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"fs-promise": "^2.0.0", | ||
"fs-extra": "^4.0.2", | ||
"lodash": "^4.17.4", | ||
@@ -37,3 +37,3 @@ "resolve-from": "^4.0.0" | ||
"eslint": "^4.6.1", | ||
"eslint-config-sanity": "^3.0.1", | ||
"eslint-config-sanity": "^3.1.0", | ||
"mocha": "^3.2.0", | ||
@@ -40,0 +40,0 @@ "rimraf": "^2.6.1" |
Sorry, the diff of this file is not supported yet
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
59150
173
+ Addedfs-extra@^4.0.2
+ Addedfs-extra@4.0.3(transitive)
+ Addedjsonfile@4.0.0(transitive)
+ Addeduniversalify@0.1.2(transitive)
- Removedfs-promise@^2.0.0
- Removedany-promise@1.3.0(transitive)
- Removedfs-extra@2.1.2(transitive)
- Removedfs-promise@2.0.3(transitive)
- Removedjsonfile@2.4.0(transitive)
- Removedmz@2.7.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedthenify@3.3.1(transitive)
- Removedthenify-all@1.6.0(transitive)