fs-extra-tf
Advanced tools
Comparing version 0.30.4 to 1.0.0
103
CHANGELOG.md
@@ -0,1 +1,34 @@ | ||
Unreleased | ||
---------- | ||
### Added | ||
### Removed | ||
### Changed | ||
### Fixed | ||
1.0.0 / 2016-11-01 | ||
------------------ | ||
After five years of development, we finally have reach the 1.0.0 milestone! Big thanks goes | ||
to [Ryan Zim](https://github.com/RyanZim) for leading the charge on this release! | ||
### Added | ||
- `walkSync()` | ||
### Changed | ||
- **BREAKING**: dropped Node v0.10 support. | ||
- disabled `rimaf` globbing, wasn't used. [#280] | ||
- deprecate `copy()/copySync()` option `filter` if it's a `RegExp`. `filter` should now be a function. | ||
- inline `rimraf`. This is temporary and was done because `rimraf` depended upon the beefy `glob` which `fs-extra` does not use. [#300] | ||
### Fixed | ||
- bug fix proper closing of file handle on `utimesMillis()` [#271] | ||
- proper escaping of files with dollar signs [#291] | ||
- `copySync()` failed if user didn't own file. [#199], [#301] | ||
0.30.0 / 2016-04-28 | ||
@@ -317,2 +350,72 @@ ------------------- | ||
[#307]: https://github.com/jprichardson/node-fs-extra/pull/307 "Fix coverage" | ||
[#306]: https://github.com/jprichardson/node-fs-extra/pull/306 "Update devDeps, fix lint error" | ||
[#305]: https://github.com/jprichardson/node-fs-extra/pull/305 "Re-add Coveralls" | ||
[#304]: https://github.com/jprichardson/node-fs-extra/pull/304 "Remove path-is-absolute [enhancement]" | ||
[#303]: https://github.com/jprichardson/node-fs-extra/pull/303 "Document copySync filter inconsistency [documentation, feature-copy]" | ||
[#302]: https://github.com/jprichardson/node-fs-extra/pull/302 "fix(console): depreciated -> deprecated" | ||
[#301]: https://github.com/jprichardson/node-fs-extra/pull/301 "Remove chmod call from copySync [feature-copy]" | ||
[#300]: https://github.com/jprichardson/node-fs-extra/pull/300 "Inline Rimraf [enhancement, feature-move, feature-remove]" | ||
[#299]: https://github.com/jprichardson/node-fs-extra/pull/299 "Warn when filter is a RegExp [feature-copy]" | ||
[#298]: https://github.com/jprichardson/node-fs-extra/issues/298 "API Docs [documentation]" | ||
[#297]: https://github.com/jprichardson/node-fs-extra/pull/297 "Warn about using preserveTimestamps on 32-bit node" | ||
[#296]: https://github.com/jprichardson/node-fs-extra/pull/296 "Improve EEXIST error message for copySync [enhancement]" | ||
[#295]: https://github.com/jprichardson/node-fs-extra/pull/295 "Depreciate using regular expressions for copy's filter option [documentation]" | ||
[#294]: https://github.com/jprichardson/node-fs-extra/pull/294 "BREAKING: Refactor lib/copy/ncp.js [feature-copy]" | ||
[#293]: https://github.com/jprichardson/node-fs-extra/pull/293 "Update CI configs" | ||
[#292]: https://github.com/jprichardson/node-fs-extra/issues/292 "Rewrite lib/copy/ncp.js [enhancement, feature-copy]" | ||
[#291]: https://github.com/jprichardson/node-fs-extra/pull/291 "Escape '$' in replacement string for async file copying" | ||
[#290]: https://github.com/jprichardson/node-fs-extra/issues/290 "Exclude files pattern while copying using copy.config.js [question]" | ||
[#289]: https://github.com/jprichardson/node-fs-extra/pull/289 "(Closes #271) lib/util/utimes: properly close file descriptors in the event of an error" | ||
[#288]: https://github.com/jprichardson/node-fs-extra/pull/288 "(Closes #271) lib/util/utimes: properly close file descriptors in the event of an error" | ||
[#287]: https://github.com/jprichardson/node-fs-extra/issues/287 "emptyDir() callback arguments are inconsistent [enhancement, feature-remove]" | ||
[#286]: https://github.com/jprichardson/node-fs-extra/pull/286 "Added walkSync function" | ||
[#285]: https://github.com/jprichardson/node-fs-extra/issues/285 "CITGM test failing on s390" | ||
[#284]: https://github.com/jprichardson/node-fs-extra/issues/284 "outputFile method is missing a check to determine if existing item is a folder or not" | ||
[#283]: https://github.com/jprichardson/node-fs-extra/pull/283 "Apply filter also on directories and symlinks for copySync()" | ||
[#282]: https://github.com/jprichardson/node-fs-extra/pull/282 "Apply filter also on directories and symlinks for copySync()" | ||
[#281]: https://github.com/jprichardson/node-fs-extra/issues/281 "remove function executes "successfully" but doesn't do anything?" | ||
[#280]: https://github.com/jprichardson/node-fs-extra/pull/280 "Disable rimraf globbing" | ||
[#279]: https://github.com/jprichardson/node-fs-extra/issues/279 "Some code is vendored instead of included [awaiting-reply]" | ||
[#278]: https://github.com/jprichardson/node-fs-extra/issues/278 "copy() does not preserve file/directory ownership" | ||
[#277]: https://github.com/jprichardson/node-fs-extra/pull/277 "Mention defaults for clobber and dereference options" | ||
[#276]: https://github.com/jprichardson/node-fs-extra/issues/276 "Cannot connect to Shared Folder [awaiting-reply]" | ||
[#275]: https://github.com/jprichardson/node-fs-extra/issues/275 "EMFILE, too many open files on Mac OS with JSON API" | ||
[#274]: https://github.com/jprichardson/node-fs-extra/issues/274 "Use with memory-fs? [enhancement, future]" | ||
[#273]: https://github.com/jprichardson/node-fs-extra/pull/273 "tests: rename `remote.test.js` to `remove.test.js`" | ||
[#272]: https://github.com/jprichardson/node-fs-extra/issues/272 "Copy clobber flag never err even when true [bug, feature-copy]" | ||
[#271]: https://github.com/jprichardson/node-fs-extra/issues/271 "Unclosed file handle on futimes error" | ||
[#270]: https://github.com/jprichardson/node-fs-extra/issues/270 "copy not working as desired on Windows [feature-copy, platform-windows]" | ||
[#269]: https://github.com/jprichardson/node-fs-extra/issues/269 "Copying with preserveTimeStamps: true is inaccurate using 32bit node [feature-copy]" | ||
[#268]: https://github.com/jprichardson/node-fs-extra/pull/268 "port fix for mkdirp issue #111" | ||
[#267]: https://github.com/jprichardson/node-fs-extra/issues/267 "WARN deprecated wrench@1.5.9: wrench.js is deprecated!" | ||
[#266]: https://github.com/jprichardson/node-fs-extra/issues/266 "fs-extra" | ||
[#265]: https://github.com/jprichardson/node-fs-extra/issues/265 "Link the `fs.stat fs.exists` etc. methods for replace the `fs` module forever?" | ||
[#264]: https://github.com/jprichardson/node-fs-extra/issues/264 "Renaming a file using move fails when a file inside is open (at least on windows) [wont-fix]" | ||
[#263]: https://github.com/jprichardson/node-fs-extra/issues/263 "ENOSYS: function not implemented, link [needs-confirmed]" | ||
[#262]: https://github.com/jprichardson/node-fs-extra/issues/262 "Add .exists() and .existsSync()" | ||
[#261]: https://github.com/jprichardson/node-fs-extra/issues/261 "Cannot read property 'prototype' of undefined" | ||
[#260]: https://github.com/jprichardson/node-fs-extra/pull/260 "use more specific path for method require" | ||
[#259]: https://github.com/jprichardson/node-fs-extra/issues/259 "Feature Request: isEmpty" | ||
[#258]: https://github.com/jprichardson/node-fs-extra/issues/258 "copy files does not preserve file timestamp" | ||
[#257]: https://github.com/jprichardson/node-fs-extra/issues/257 "Copying a file on windows fails" | ||
[#256]: https://github.com/jprichardson/node-fs-extra/pull/256 "Updated Readme " | ||
[#255]: https://github.com/jprichardson/node-fs-extra/issues/255 "Update rimraf required version" | ||
[#254]: https://github.com/jprichardson/node-fs-extra/issues/254 "request for readTree, readTreeSync, walkSync method" | ||
[#253]: https://github.com/jprichardson/node-fs-extra/issues/253 "outputFile does not touch mtime when file exists" | ||
[#252]: https://github.com/jprichardson/node-fs-extra/pull/252 "Fixing problem when copying file with no write permission" | ||
[#251]: https://github.com/jprichardson/node-fs-extra/issues/251 "Just wanted to say thank you" | ||
[#250]: https://github.com/jprichardson/node-fs-extra/issues/250 "`fs.remove()` not removing files (works with `rm -rf`)" | ||
[#249]: https://github.com/jprichardson/node-fs-extra/issues/249 "Just a Question ... Remove Servers" | ||
[#248]: https://github.com/jprichardson/node-fs-extra/issues/248 "Allow option to not preserve permissions for copy" | ||
[#247]: https://github.com/jprichardson/node-fs-extra/issues/247 "Add TypeScript typing directly in the fs-extra package" | ||
[#246]: https://github.com/jprichardson/node-fs-extra/issues/246 "fse.remove() && fse.removeSync() don't throw error on ENOENT file" | ||
[#245]: https://github.com/jprichardson/node-fs-extra/issues/245 "filter for empty dir [enhancement]" | ||
[#244]: https://github.com/jprichardson/node-fs-extra/issues/244 "copySync doesn't apply the filter to directories" | ||
[#243]: https://github.com/jprichardson/node-fs-extra/issues/243 "Can I request fs.walk() to be synchronous?" | ||
[#242]: https://github.com/jprichardson/node-fs-extra/issues/242 "Accidentally truncates file names ending with $$ [bug, feature-copy]" | ||
[#241]: https://github.com/jprichardson/node-fs-extra/pull/241 "Remove link to createOutputStream" | ||
[#240]: https://github.com/jprichardson/node-fs-extra/issues/240 "walkSync request" | ||
[#239]: https://github.com/jprichardson/node-fs-extra/issues/239 "Depreciate regular expressions for copy's filter [documentation, feature-copy]" | ||
[#238]: https://github.com/jprichardson/node-fs-extra/issues/238 "Can't write to files while in a worker thread." | ||
@@ -319,0 +422,0 @@ [#237]: https://github.com/jprichardson/node-fs-extra/issues/237 ".ensureDir(..) fails silently when passed an invalid path..." |
@@ -12,6 +12,9 @@ var fs = require('graceful-fs') | ||
if (clobber) { | ||
fs.chmodSync(destFile, parseInt('777', 8)) | ||
fs.unlinkSync(destFile) | ||
} else { | ||
throw Error('EEXIST') | ||
var err = new Error('EEXIST: ' + destFile + ' already exists.') | ||
err.code = 'EEXIST' | ||
err.errno = -17 | ||
err.path = destFile | ||
throw err | ||
} | ||
@@ -18,0 +21,0 @@ } |
@@ -21,2 +21,8 @@ var fs = require('graceful-fs') | ||
// Warn about using preserveTimestamps on 32-bit node: | ||
if (options.preserveTimestamps && process.arch === 'ia32') { | ||
console.warn('fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n' + | ||
'see https://github.com/jprichardson/node-fs-extra/issues/269') | ||
} | ||
var stats = (options.recursive && !options.dereference) ? fs.lstatSync(src) : fs.statSync(src) | ||
@@ -28,4 +34,6 @@ var destFolder = path.dirname(dest) | ||
if (stats.isFile()) { | ||
if (options.filter instanceof RegExp) performCopy = options.filter.test(src) | ||
else if (typeof options.filter === 'function') performCopy = options.passStats ? options.filter(src, stats) : options.filter(src) | ||
if (options.filter instanceof RegExp) { | ||
console.warn('Warning: fs-extra: Passing a RegExp filter is deprecated, use a function') | ||
performCopy = options.filter.test(src) | ||
} else if (typeof options.filter === 'function') performCopy = options.passStats ? options.filter(src, stats) : options.filter(src) | ||
@@ -32,0 +40,0 @@ if (performCopy) { |
@@ -16,2 +16,8 @@ var fs = require('graceful-fs') | ||
// Warn about using preserveTimestamps on 32-bit node: | ||
if (options.preserveTimestamps && process.arch === 'ia32') { | ||
console.warn('fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n' + | ||
'see https://github.com/jprichardson/node-fs-extra/issues/269') | ||
} | ||
// don't allow src and dest to be the same | ||
@@ -18,0 +24,0 @@ var basePath = process.cwd() |
@@ -20,15 +20,12 @@ // imported from ncp (this is temporary, will rewrite) | ||
var transform = options.transform | ||
var clobber = options.clobber !== false | ||
var clobber = options.clobber !== false // default true | ||
var dereference = options.dereference | ||
var preserveTimestamps = options.preserveTimestamps === true | ||
var errs = null | ||
var started = 0 | ||
var finished = 0 | ||
var running = 0 | ||
// this is pretty useless now that we're using graceful-fs | ||
// consider removing | ||
var limit = options.limit || 512 | ||
var errored = false | ||
startCopy(currentPath) | ||
@@ -38,14 +35,16 @@ | ||
started++ | ||
if (filter instanceof RegExp) { | ||
passStats = false | ||
if (!filter.test(source)) { | ||
return doneOne(true) | ||
if (filter) { | ||
if (filter instanceof RegExp) { | ||
passStats = false | ||
console.warn('Warning: fs-extra: Passing a RegExp filter is deprecated, use a function') | ||
if (!filter.test(source)) { | ||
return doneOne(true) | ||
} | ||
} else if (!passStats && typeof filter === 'function') { | ||
if (!filter(source)) { | ||
return doneOne(true) | ||
} | ||
} | ||
} | ||
if (!passStats && typeof filter === 'function' && !filter(source)) { | ||
return doneOne(true) | ||
} | ||
getStats(source) | ||
@@ -56,7 +55,2 @@ } | ||
var stat = dereference ? fs.stat : fs.lstat | ||
if (running >= limit) { | ||
return setImmediate(function () { | ||
getStats(source) | ||
}) | ||
} | ||
running++ | ||
@@ -92,3 +86,3 @@ stat(source, function (err, stats) { | ||
function onFile (file) { | ||
var target = file.name.replace(currentPath, targetPath) | ||
var target = file.name.replace(currentPath, targetPath.replace('$', '$$$$')) // escapes '$' with '$$' | ||
isWritable(target, function (writable) { | ||
@@ -103,3 +97,7 @@ if (writable) { | ||
} else { | ||
doneOne() | ||
var err = new Error('EEXIST: ' + target + ' already exists.') | ||
err.code = 'EEXIST' | ||
err.errno = -17 | ||
err.path = target | ||
onError(err) | ||
} | ||
@@ -148,3 +146,3 @@ } | ||
function onDir (dir) { | ||
var target = dir.name.replace(currentPath, targetPath) | ||
var target = dir.name.replace(currentPath, targetPath.replace('$', '$$$$')) // escapes '$' with '$$' | ||
isWritable(target, function (writable) { | ||
@@ -230,15 +228,7 @@ if (writable) { | ||
function onError (err) { | ||
if (options.stopOnError) { | ||
// ensure callback is defined & called only once: | ||
if (!errored && callback !== undefined) { | ||
errored = true | ||
return callback(err) | ||
} else if (!errs && options.errs) { | ||
errs = fs.createWriteStream(options.errs) | ||
} else if (!errs) { | ||
errs = [] | ||
} | ||
if (typeof errs.write === 'undefined') { | ||
errs.push(err) | ||
} else { | ||
errs.write(err.stack + '\n\n') | ||
} | ||
return doneOne() | ||
} | ||
@@ -251,3 +241,3 @@ | ||
if (callback !== undefined) { | ||
return errs ? callback(errs) : callback(null) | ||
return callback(null) | ||
} | ||
@@ -254,0 +244,0 @@ } |
var path = require('path') | ||
// path.isAbsolute shim for Node.js 0.10 support | ||
path.isAbsolute = (path.isAbsolute) ? path.isAbsolute : require('path-is-absolute') | ||
var fs = require('graceful-fs') | ||
@@ -5,0 +4,0 @@ |
@@ -23,2 +23,3 @@ var assign = require('./util/assign') | ||
assign(fs, require('./walk')) | ||
assign(fs, require('./walk-sync')) | ||
@@ -25,0 +26,0 @@ module.exports = fs |
@@ -10,3 +10,3 @@ // most of this code was written by Andrew Kelley | ||
var path = require('path') | ||
var rimraf = require('rimraf') | ||
var remove = require('../remove').remove | ||
var mkdirp = require('../mkdirs').mkdirs | ||
@@ -44,3 +44,3 @@ | ||
if (err.code === 'ENOTEMPTY' || err.code === 'EEXIST') { | ||
rimraf(dest, function (err) { | ||
remove(dest, function (err) { | ||
if (err) return callback(err) | ||
@@ -56,3 +56,3 @@ options.clobber = false // just clobbered it, no need to do it again | ||
setTimeout(function () { | ||
rimraf(dest, function (err) { | ||
remove(dest, function (err) { | ||
if (err) return callback(err) | ||
@@ -148,3 +148,3 @@ options.clobber = false | ||
if (errList) return callback(errList[0]) | ||
rimraf(source, callback) | ||
remove(source, callback) | ||
}) | ||
@@ -154,3 +154,3 @@ } | ||
if (clobber) { | ||
rimraf(dest, function (err) { | ||
remove(dest, function (err) { | ||
if (err) return callback(err) | ||
@@ -157,0 +157,0 @@ startNcp() |
@@ -1,2 +0,2 @@ | ||
var rimraf = require('rimraf') | ||
var rimraf = require('./rimraf') | ||
@@ -3,0 +3,0 @@ function removeSync (dir) { |
{ | ||
"name": "fs-extra-tf", | ||
"version": "0.30.4", | ||
"version": "1.0.0", | ||
"description": "fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.", | ||
@@ -36,10 +36,8 @@ "homepage": "https://github.com/jprichardson/node-fs-extra", | ||
"dependencies": { | ||
"graceful-fs": "^4.1.9", | ||
"graceful-fs": "^4.1.10", | ||
"jsonfile": "^2.4.0", | ||
"klaw": "^1.3.1", | ||
"path-is-absolute": "^1.0.1", | ||
"rimraf": "^2.5.4" | ||
"klaw": "^1.3.1" | ||
}, | ||
"devDependencies": { | ||
"coveralls": "^2.11.14", | ||
"coveralls": "^2.11.15", | ||
"istanbul": "^0.4.5", | ||
@@ -50,2 +48,3 @@ "minimist": "^1.2.0", | ||
"read-dir-files": "^0.1.1", | ||
"rimraf": "^2.5.4", | ||
"secure-random": "^1.1.1", | ||
@@ -57,3 +56,3 @@ "semver": "^5.3.0", | ||
"scripts": { | ||
"coverage": "istanbul cover test.js", | ||
"coverage": "istanbul cover -i 'lib/**' -x '**/__tests__/**' test.js", | ||
"coveralls": "npm run coverage && coveralls < coverage/lcov.info", | ||
@@ -60,0 +59,0 @@ "lint": "standard", |
@@ -14,3 +14,3 @@ Node.js: fs-extra | ||
**NOTE (2016-04-28):** Node v0.10 will be unsupported 2016-10-01. Node v0.12 will be unsupported on 2017-04-01. | ||
**NOTE (2016-11-01):** Node v0.12 will be unsupported on 2016-12-31. | ||
@@ -115,2 +115,3 @@ | ||
- [walk](#walk) | ||
- [walkSync](#walksyncdir) | ||
- [writeJson](#writejsonfile-object-options-callback) | ||
@@ -134,3 +135,3 @@ - [writeJsonSync](#writejsonfile-object-options-callback) | ||
- preserveTimestamps (boolean): will set last modification and access times to the ones of the original source files, default is `false`. | ||
- filter: Function or RegExp to filter copied files. If function, return true to include, false to exclude. If RegExp, same as function, where `filter` is `filter.test`. | ||
- filter: Function to filter copied files. Return `true` to include, `false` to exclude. This can also be a RegExp, however this is deprecated (See [issue #239](https://github.com/jprichardson/node-fs-extra/issues/239) for background). _Warning: `copySync` currently applies the filter only to files (see [#180](https://github.com/jprichardson/node-fs-extra/issues/180)). This will be fixed in a future release._ | ||
@@ -455,3 +456,15 @@ Sync: `copySync()` | ||
### walkSync(dir) | ||
Lists all files inside a directory recursively | ||
Examples: | ||
```js | ||
var fs = require('fs-extra') | ||
var files = fs.walkSync('/home/jprichardson') | ||
// files = ['/home/jprichardson/file1', '/home/jprichardson/dir1/file2'] | ||
``` | ||
### writeJson(file, object, [options], callback) | ||
@@ -458,0 +471,0 @@ |
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
206329
3
45
1410
0
604
10
- Removedpath-is-absolute@^1.0.1
- Removedrimraf@^2.5.4
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedrimraf@2.7.1(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedgraceful-fs@^4.1.10