fs-jetpack
Advanced tools
Comparing version
@@ -1,3 +0,1 @@ | ||
/* eslint no-console: 0 */ | ||
"use strict"; | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
/* eslint no-console: 0 */ | ||
"use strict"; | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
/* eslint no-console:0 */ | ||
"use strict"; | ||
@@ -65,3 +63,3 @@ | ||
const showDifferenceInfo = (jetpackTime, nativeTime) => { | ||
const perc = Math.round(jetpackTime / nativeTime * 100) - 100; | ||
const perc = Math.round((jetpackTime / nativeTime) * 100) - 100; | ||
console.log(`Jetpack is ${perc}% slower than native`); | ||
@@ -68,0 +66,0 @@ }; |
@@ -0,1 +1,4 @@ | ||
# 1.3.1 (2018-07-09) | ||
- Fixed bug in `existsAsync()`. | ||
# 1.3.0 (2018-02-09) | ||
@@ -2,0 +5,0 @@ - `overwrite` function passed to `copyAsync()` can return promise. |
@@ -40,4 +40,3 @@ "use strict"; | ||
return new Promise((resolve, reject) => { | ||
fs | ||
.appendFile(path, data, options) | ||
fs.appendFile(path, data, options) | ||
.then(resolve) | ||
@@ -44,0 +43,0 @@ .catch(err => { |
@@ -248,4 +248,3 @@ "use strict"; | ||
return new Promise((resolve, reject) => { | ||
fs | ||
.symlink(symlinkPointsAt, to) | ||
fs.symlink(symlinkPointsAt, to) | ||
.then(resolve) | ||
@@ -256,4 +255,3 @@ .catch(err => { | ||
// Must erase it manually, otherwise system won't allow us to place symlink there. | ||
fs | ||
.unlink(to) | ||
fs.unlink(to) | ||
.then(() => { | ||
@@ -260,0 +258,0 @@ // Retry... |
@@ -31,5 +31,3 @@ "use strict"; | ||
return new Error( | ||
`Path ${ | ||
path | ||
} exists but is not a directory. Halting jetpack.dir() call for safety reasons.` | ||
`Path ${path} exists but is not a directory. Halting jetpack.dir() call for safety reasons.` | ||
); | ||
@@ -118,4 +116,3 @@ }; | ||
return new Promise((resolve, reject) => { | ||
fs | ||
.stat(path) | ||
fs.stat(path) | ||
.then(stat => { | ||
@@ -143,4 +140,3 @@ if (stat.isDirectory()) { | ||
return new Promise((resolve, reject) => { | ||
fs | ||
.readdir(path) | ||
fs.readdir(path) | ||
.then(list => { | ||
@@ -191,4 +187,3 @@ const doOne = index => { | ||
return new Promise((resolve, reject) => { | ||
fs | ||
.mkdir(path, options.mode) | ||
fs.mkdir(path, options.mode) | ||
.then(resolve) | ||
@@ -195,0 +190,0 @@ .catch(err => { |
@@ -39,4 +39,13 @@ "use strict"; | ||
return new Promise((resolve, reject) => { | ||
fs.stat(path, (err, stat) => { | ||
if (err) { | ||
fs.stat(path) | ||
.then(stat => { | ||
if (stat.isDirectory()) { | ||
resolve("dir"); | ||
} else if (stat.isFile()) { | ||
resolve("file"); | ||
} else { | ||
resolve("other"); | ||
} | ||
}) | ||
.catch(err => { | ||
if (err.code === "ENOENT") { | ||
@@ -47,10 +56,3 @@ resolve(false); | ||
} | ||
} else if (stat.isDirectory()) { | ||
resolve("dir"); | ||
} else if (stat.isFile()) { | ||
resolve("file"); | ||
} else { | ||
resolve("other"); | ||
} | ||
}); | ||
}); | ||
}); | ||
@@ -57,0 +59,0 @@ }; |
@@ -28,5 +28,3 @@ "use strict"; | ||
return new Error( | ||
`Path ${ | ||
path | ||
} exists but is not a file. Halting jetpack.file() call for safety reasons.` | ||
`Path ${path} exists but is not a file. Halting jetpack.file() call for safety reasons.` | ||
); | ||
@@ -111,4 +109,3 @@ }; | ||
return new Promise((resolve, reject) => { | ||
fs | ||
.stat(path) | ||
fs.stat(path) | ||
.then(stat => { | ||
@@ -115,0 +112,0 @@ if (stat.isFile()) { |
@@ -24,5 +24,3 @@ "use strict"; | ||
throw new Error( | ||
`Argument "options.checksum" passed to ${ | ||
methodSignature | ||
} must have one of values: ${inspect.supportedChecksumAlgorithms.join( | ||
`Argument "options.checksum" passed to ${methodSignature} must have one of values: ${inspect.supportedChecksumAlgorithms.join( | ||
", " | ||
@@ -39,5 +37,5 @@ )}` | ||
throw new Error( | ||
`Argument "options.symlinks" passed to ${ | ||
methodSignature | ||
} must have one of values: ${inspect.symlinkOptions.join(", ")}` | ||
`Argument "options.symlinks" passed to ${methodSignature} must have one of values: ${inspect.symlinkOptions.join( | ||
", " | ||
)}` | ||
); | ||
@@ -44,0 +42,0 @@ } |
@@ -29,5 +29,5 @@ "use strict"; | ||
throw new Error( | ||
`Argument "options.checksum" passed to ${ | ||
methodSignature | ||
} must have one of values: ${supportedChecksumAlgorithms.join(", ")}` | ||
`Argument "options.checksum" passed to ${methodSignature} must have one of values: ${supportedChecksumAlgorithms.join( | ||
", " | ||
)}` | ||
); | ||
@@ -42,5 +42,5 @@ } | ||
throw new Error( | ||
`Argument "options.symlinks" passed to ${ | ||
methodSignature | ||
} must have one of values: ${symlinkOptions.join(", ")}` | ||
`Argument "options.symlinks" passed to ${methodSignature} must have one of values: ${symlinkOptions.join( | ||
", " | ||
)}` | ||
); | ||
@@ -47,0 +47,0 @@ } |
@@ -1,3 +0,1 @@ | ||
/* eslint no-param-reassign:0 */ | ||
"use strict"; | ||
@@ -4,0 +2,0 @@ |
@@ -33,4 +33,3 @@ "use strict"; | ||
return new Promise((resolve, reject) => { | ||
fs | ||
.readdir(path) | ||
fs.readdir(path) | ||
.then(list => { | ||
@@ -37,0 +36,0 @@ resolve(list); |
@@ -71,4 +71,3 @@ "use strict"; | ||
return new Promise((resolve, reject) => { | ||
fs | ||
.rename(from, to) | ||
fs.rename(from, to) | ||
.then(resolve) | ||
@@ -75,0 +74,0 @@ .catch(err => { |
@@ -1,3 +0,1 @@ | ||
/* eslint no-console:1 */ | ||
"use strict"; | ||
@@ -20,5 +18,5 @@ | ||
throw new Error( | ||
`Argument "returnAs" passed to ${ | ||
methodSignature | ||
} must have one of values: ${supportedReturnAs.join(", ")}` | ||
`Argument "returnAs" passed to ${methodSignature} must have one of values: ${supportedReturnAs.join( | ||
", " | ||
)}` | ||
); | ||
@@ -97,4 +95,3 @@ } | ||
fs | ||
.readFile(path, { encoding }) | ||
fs.readFile(path, { encoding }) | ||
.then(data => { | ||
@@ -101,0 +98,0 @@ // Make final parsing of the data before returning. |
@@ -71,4 +71,3 @@ "use strict"; | ||
// Assume the path is a file and just try to remove it. | ||
fs | ||
.unlink(path) | ||
fs.unlink(path) | ||
.then(resolve) | ||
@@ -75,0 +74,0 @@ .catch(err => { |
@@ -38,4 +38,3 @@ "use strict"; | ||
return new Promise((resolve, reject) => { | ||
fs | ||
.symlink(symlinkValue, path) | ||
fs.symlink(symlinkValue, path) | ||
.then(resolve) | ||
@@ -42,0 +41,0 @@ .catch(err => { |
@@ -1,3 +0,1 @@ | ||
/* eslint no-underscore-dangle:0 */ | ||
"use strict"; | ||
@@ -4,0 +2,0 @@ |
@@ -110,7 +110,5 @@ "use strict"; | ||
throw new Error( | ||
`Argument "${argumentName}" passed to ${ | ||
methodName | ||
} must be ${prettyPrintTypes(argumentMustBe)}. Received ${detectTypeDeep( | ||
argumentValue | ||
)}` | ||
`Argument "${argumentName}" passed to ${methodName} must be ${prettyPrintTypes( | ||
argumentMustBe | ||
)}. Received ${detectTypeDeep(argumentValue)}` | ||
); | ||
@@ -117,0 +115,0 @@ } |
@@ -83,4 +83,3 @@ "use strict"; | ||
return new Promise((resolve, reject) => { | ||
fs | ||
.writeFile(path, data, options) | ||
fs.writeFile(path, data, options) | ||
.then(resolve) | ||
@@ -87,0 +86,0 @@ .catch(err => { |
{ | ||
"name": "fs-jetpack", | ||
"description": "Better file system API", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"author": "Jakub Szwacz <jakub@szwacz.com>", | ||
@@ -10,11 +10,11 @@ "dependencies": { | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"codecov": "^2.2.0", | ||
"fs-extra": "^0.16.3", | ||
"chai": "^4.1.2", | ||
"codecov": "^3.0.2", | ||
"fs-extra": "^5.0.0", | ||
"istanbul": "^0.4.5", | ||
"lint-staged": "^3.4.0", | ||
"mocha": "^3.1.2", | ||
"lint-staged": "^7.2.0", | ||
"mocha": "^5.2.0", | ||
"pre-commit": "^1.1.2", | ||
"prettier": "1.8.2", | ||
"pretty-bytes": "^4.0.2", | ||
"prettier": "1.13.5", | ||
"pretty-bytes": "^5.1.0", | ||
"release-assist": "^1.0.1" | ||
@@ -21,0 +21,0 @@ }, |
@@ -60,5 +60,3 @@ "use strict"; | ||
const generateMessage = (expected, found) => { | ||
message = `File ${path} should have content "${expected}" but found "${ | ||
found | ||
}"`; | ||
message = `File ${path} should have content "${expected}" but found "${found}"`; | ||
}; | ||
@@ -101,5 +99,3 @@ | ||
if (mode !== expectedMode) { | ||
message = `Path ${path} should have mode "${ | ||
expectedMode | ||
}" but have instead "${mode}"`; | ||
message = `Path ${path} should have mode "${expectedMode}" but have instead "${mode}"`; | ||
} | ||
@@ -106,0 +102,0 @@ } catch (err) { |
@@ -614,3 +614,5 @@ "use strict"; | ||
}).to.throw( | ||
`Argument "from" passed to ${test.methodName}(from, to, [options]) must be a string. Received undefined` | ||
`Argument "from" passed to ${ | ||
test.methodName | ||
}(from, to, [options]) must be a string. Received undefined` | ||
); | ||
@@ -627,3 +629,5 @@ }); | ||
}).to.throw( | ||
`Argument "to" passed to ${test.methodName}(from, to, [options]) must be a string. Received undefined` | ||
`Argument "to" passed to ${ | ||
test.methodName | ||
}(from, to, [options]) must be a string. Received undefined` | ||
); | ||
@@ -641,3 +645,5 @@ }); | ||
}).to.throw( | ||
`Argument "options.overwrite" passed to ${test.methodName}(from, to, [options]) must be a boolean or a function. Received number` | ||
`Argument "options.overwrite" passed to ${ | ||
test.methodName | ||
}(from, to, [options]) must be a boolean or a function. Received number` | ||
); | ||
@@ -653,3 +659,5 @@ }); | ||
}).to.throw( | ||
`Argument "options.matching" passed to ${test.methodName}(from, to, [options]) must be a string or an array of string. Received number` | ||
`Argument "options.matching" passed to ${ | ||
test.methodName | ||
}(from, to, [options]) must be a string or an array of string. Received number` | ||
); | ||
@@ -656,0 +664,0 @@ }); |
@@ -1,3 +0,1 @@ | ||
/* eslint no-console:0 */ | ||
"use strict"; | ||
@@ -4,0 +2,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
NPM Shrinkwrap
Supply chain riskPackage contains a shrinkwrap file. This may allow the package to bypass normal install procedures.
Found 1 instance in 1 package
0
-100%264740
-20.81%61
-1.61%7762
-21.64%