rimraf 2.3.4 → 2.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/bin.js +11 -4
- package/package.json +11 -7
- package/rimraf.js +4 -3
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
[](https://travis-ci.org/isaacs/rimraf) [](https://david-dm.org/isaacs/rimraf) [](https://david-dm.org/isaacs/rimraf#info=devDependencies)
|
|
2
|
+
|
|
1
3
|
The [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for node.
|
|
2
4
|
|
|
3
5
|
Install with `npm install rimraf`, or just drop rimraf.js somewhere.
|
|
@@ -28,7 +30,7 @@ the async API. It's better.
|
|
|
28
30
|
## CLI
|
|
29
31
|
|
|
30
32
|
If installed with `npm install rimraf -g` it can be used as a global
|
|
31
|
-
command `rimraf <path
|
|
33
|
+
command `rimraf <path> [<path> ...]` which is useful for cross platform support.
|
|
32
34
|
|
|
33
35
|
## mkdirp
|
|
34
36
|
|
package/bin.js
CHANGED
|
@@ -18,7 +18,7 @@ var args = process.argv.slice(2).filter(function(arg) {
|
|
|
18
18
|
if (help || args.length === 0) {
|
|
19
19
|
// If they didn't ask for help, then this is not a "success"
|
|
20
20
|
var log = help ? console.log : console.error
|
|
21
|
-
log('Usage: rimraf <path>')
|
|
21
|
+
log('Usage: rimraf <path> [<path> ...]')
|
|
22
22
|
log('')
|
|
23
23
|
log(' Deletes all files and folders at "path" recursively.')
|
|
24
24
|
log('')
|
|
@@ -26,8 +26,15 @@ if (help || args.length === 0) {
|
|
|
26
26
|
log('')
|
|
27
27
|
log(' -h, --help Display this usage info')
|
|
28
28
|
process.exit(help ? 0 : 1)
|
|
29
|
-
} else
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
} else
|
|
30
|
+
go(0)
|
|
31
|
+
|
|
32
|
+
function go (n) {
|
|
33
|
+
if (n >= args.length)
|
|
34
|
+
return
|
|
35
|
+
rimraf(args[n], function (er) {
|
|
36
|
+
if (er)
|
|
37
|
+
throw er
|
|
38
|
+
go(n+1)
|
|
32
39
|
})
|
|
33
40
|
}
|
package/package.json
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rimraf",
|
|
3
|
-
"version": "2.3
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"main": "rimraf.js",
|
|
5
5
|
"description": "A deep deletion module for node (like `rm -rf`)",
|
|
6
6
|
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
|
7
7
|
"license": "ISC",
|
|
8
8
|
"repository": "git://github.com/isaacs/rimraf.git",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"test": "
|
|
10
|
+
"test": "tap test/*.js"
|
|
11
11
|
},
|
|
12
12
|
"bin": "./bin.js",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"glob": "^
|
|
14
|
+
"glob": "^5.0.14"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
|
-
"bin.js",
|
|
18
|
-
"rimraf.js",
|
|
19
17
|
"LICENSE",
|
|
20
|
-
"README.md"
|
|
21
|
-
|
|
18
|
+
"README.md",
|
|
19
|
+
"bin.js",
|
|
20
|
+
"rimraf.js"
|
|
21
|
+
],
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"mkdirp": "^0.5.1",
|
|
24
|
+
"tap": "^1.3.1"
|
|
25
|
+
}
|
|
22
26
|
}
|
package/rimraf.js
CHANGED
|
@@ -35,6 +35,7 @@ function defaults (options) {
|
|
|
35
35
|
|
|
36
36
|
options.maxBusyTries = options.maxBusyTries || 3
|
|
37
37
|
options.emfileWait = options.emfileWait || 1000
|
|
38
|
+
options.disableGlob = options.disableGlob || false
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
function rimraf (p, options, cb) {
|
|
@@ -55,7 +56,7 @@ function rimraf (p, options, cb) {
|
|
|
55
56
|
var errState = null
|
|
56
57
|
var n = 0
|
|
57
58
|
|
|
58
|
-
if (!glob.hasMagic(p))
|
|
59
|
+
if (options.disableGlob || !glob.hasMagic(p))
|
|
59
60
|
return afterGlob(null, [p])
|
|
60
61
|
|
|
61
62
|
fs.lstat(p, function (er, stat) {
|
|
@@ -82,7 +83,7 @@ function rimraf (p, options, cb) {
|
|
|
82
83
|
results.forEach(function (p) {
|
|
83
84
|
rimraf_(p, options, function CB (er) {
|
|
84
85
|
if (er) {
|
|
85
|
-
if (isWindows && (er.code === "EBUSY" || er.code === "ENOTEMPTY") &&
|
|
86
|
+
if (isWindows && (er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") &&
|
|
86
87
|
busyTries < options.maxBusyTries) {
|
|
87
88
|
busyTries ++
|
|
88
89
|
var time = busyTries * 100
|
|
@@ -262,7 +263,7 @@ function rimrafSync (p, options) {
|
|
|
262
263
|
|
|
263
264
|
var results
|
|
264
265
|
|
|
265
|
-
if (!glob.hasMagic(p)) {
|
|
266
|
+
if (options.disableGlob || !glob.hasMagic(p)) {
|
|
266
267
|
results = [p]
|
|
267
268
|
} else {
|
|
268
269
|
try {
|