Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKat Marchán <kzm@sykosomatic.org>2017-03-11 02:25:34 +0300
committerKat Marchán <kzm@sykosomatic.org>2017-03-11 03:02:22 +0300
commit3d80f8f70679ad2b8ce7227d20e8dbce257a47b9 (patch)
treef7ac137f1443ec803e34cd4105427370fa17b5db /node_modules/fs-vacuum
parent9008e4319e1646edc57f48d6af70feadd5822aaf (diff)
fs-vacuum@1.2.10
Fixes: #14012 PR-URL: https://github.com/npm/fs-vacuum/pull/6 Credit: @helio-frota Reviewed-By: @zkat
Diffstat (limited to 'node_modules/fs-vacuum')
-rw-r--r--node_modules/fs-vacuum/README.md2
-rw-r--r--node_modules/fs-vacuum/package.json61
-rw-r--r--node_modules/fs-vacuum/test/not-remove-home-directory.js46
-rw-r--r--node_modules/fs-vacuum/vacuum.js5
4 files changed, 87 insertions, 27 deletions
diff --git a/node_modules/fs-vacuum/README.md b/node_modules/fs-vacuum/README.md
index df31243df..8af1cb248 100644
--- a/node_modules/fs-vacuum/README.md
+++ b/node_modules/fs-vacuum/README.md
@@ -18,7 +18,7 @@ var options = {
/* Assuming there are no other files or directories in "out", "to", or "my",
* the final path will just be "/path/to/my/tree/root".
*/
-vacuum("/path/to/my/tree/root/out/to/my/files", function (error) {
+vacuum("/path/to/my/tree/root/out/to/my/files", options, function (error) {
if (error) console.error("Unable to cleanly vacuum:", error.message);
});
```
diff --git a/node_modules/fs-vacuum/package.json b/node_modules/fs-vacuum/package.json
index 7567a84fd..5f414b804 100644
--- a/node_modules/fs-vacuum/package.json
+++ b/node_modules/fs-vacuum/package.json
@@ -1,45 +1,54 @@
{
"_args": [
[
- "fs-vacuum@",
- "/Users/rebecca/code/npm"
+ {
+ "raw": "fs-vacuum@latest",
+ "scope": null,
+ "escapedName": "fs-vacuum",
+ "name": "fs-vacuum",
+ "rawSpec": "latest",
+ "spec": "latest",
+ "type": "tag"
+ },
+ "/Users/zkat/Documents/code/npm"
]
],
"_from": "fs-vacuum@latest",
- "_id": "fs-vacuum@1.2.9",
+ "_id": "fs-vacuum@1.2.10",
"_inCache": true,
- "_installable": true,
"_location": "/fs-vacuum",
- "_nodeVersion": "5.10.1",
+ "_nodeVersion": "7.7.1",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
- "tmp": "tmp/fs-vacuum-1.2.9.tgz_1461273179969_0.39465441973879933"
+ "tmp": "tmp/fs-vacuum-1.2.10.tgz_1489187970453_0.7888825018890202"
},
"_npmUser": {
- "email": "ogd@aoaioxxysz.net",
- "name": "othiym23"
+ "name": "zkat",
+ "email": "kat@sykosomatic.org"
},
- "_npmVersion": "3.8.7",
+ "_npmVersion": "4.4.2",
"_phantomChildren": {},
"_requested": {
- "name": "fs-vacuum",
- "raw": "fs-vacuum@",
- "rawSpec": "",
+ "raw": "fs-vacuum@latest",
"scope": null,
+ "escapedName": "fs-vacuum",
+ "name": "fs-vacuum",
+ "rawSpec": "latest",
"spec": "latest",
"type": "tag"
},
"_requiredBy": [
+ "#USER",
"/"
],
- "_resolved": "https://registry.npmjs.org/fs-vacuum/-/fs-vacuum-1.2.9.tgz",
- "_shasum": "4f90193ab8ea02890995bcd4e804659a5d366b2d",
+ "_resolved": "https://registry.npmjs.org/fs-vacuum/-/fs-vacuum-1.2.10.tgz",
+ "_shasum": "b7629bec07a4031a2548fdf99f5ecf1cc8b31e36",
"_shrinkwrap": null,
- "_spec": "fs-vacuum@",
- "_where": "/Users/rebecca/code/npm",
+ "_spec": "fs-vacuum@latest",
+ "_where": "/Users/zkat/Documents/code/npm",
"author": {
- "email": "ogd@aoaioxxysz.net",
- "name": "Forrest L Norvell"
+ "name": "Forrest L Norvell",
+ "email": "ogd@aoaioxxysz.net"
},
"bugs": {
"url": "https://github.com/npm/fs-vacuum/issues"
@@ -60,10 +69,10 @@
},
"directories": {},
"dist": {
- "shasum": "4f90193ab8ea02890995bcd4e804659a5d366b2d",
- "tarball": "https://registry.npmjs.org/fs-vacuum/-/fs-vacuum-1.2.9.tgz"
+ "shasum": "b7629bec07a4031a2548fdf99f5ecf1cc8b31e36",
+ "tarball": "https://registry.npmjs.org/fs-vacuum/-/fs-vacuum-1.2.10.tgz"
},
- "gitHead": "acff37c635731a0169367acb32338d9d4e7d615c",
+ "gitHead": "e2daf9ab461004d10cc934e286052a6cd72a6127",
"homepage": "https://github.com/npm/fs-vacuum",
"keywords": [
"rm",
@@ -74,12 +83,12 @@
"main": "vacuum.js",
"maintainers": [
{
- "email": "ogd@aoaioxxysz.net",
- "name": "othiym23"
+ "name": "othiym23",
+ "email": "ogd@aoaioxxysz.net"
},
{
- "email": "kat@sykosomatic.org",
- "name": "zkat"
+ "name": "zkat",
+ "email": "kat@sykosomatic.org"
}
],
"name": "fs-vacuum",
@@ -92,5 +101,5 @@
"scripts": {
"test": "standard && tap test/*.js"
},
- "version": "1.2.9"
+ "version": "1.2.10"
}
diff --git a/node_modules/fs-vacuum/test/not-remove-home-directory.js b/node_modules/fs-vacuum/test/not-remove-home-directory.js
new file mode 100644
index 000000000..8cab00945
--- /dev/null
+++ b/node_modules/fs-vacuum/test/not-remove-home-directory.js
@@ -0,0 +1,46 @@
+var path = require('path')
+
+var test = require('tap').test
+var mkdtemp = require('tmp').dir
+var mkdirp = require('mkdirp')
+
+var vacuum = require('../vacuum.js')
+
+// CONSTANTS
+var TEMP_OPTIONS = {
+ unsafeCleanup: true,
+ mode: '0700'
+}
+
+var BASE_PATH = path.join('foo')
+var HOME_PATH = path.join(BASE_PATH, 'foo', 'bar')
+
+var messages = []
+function log () { messages.push(Array.prototype.slice.call(arguments).join(' ')) }
+
+var homePath, basePath, realHome
+test('xXx setup xXx', function (t) {
+ mkdtemp(TEMP_OPTIONS, function (er, tmpdir) {
+ t.ifError(er, 'temp directory exists')
+
+ homePath = path.resolve(tmpdir, HOME_PATH)
+ basePath = path.resolve(tmpdir, BASE_PATH)
+
+ realHome = process.env.HOME
+ process.env.HOME = homePath
+
+ mkdirp(homePath, function (er) {
+ t.ifError(er, 'made test path')
+ t.end()
+ })
+ })
+})
+
+test('do not remove home directory', function (t) {
+ vacuum(homePath, {purge: false, base: basePath, log: log}, function (er) {
+ t.ifError(er, 'cleaned up to base')
+ t.equal(messages[0], 'quitting because cannot remove home directory ' + homePath)
+ process.env.HOME = realHome
+ t.end()
+ })
+})
diff --git a/node_modules/fs-vacuum/vacuum.js b/node_modules/fs-vacuum/vacuum.js
index 1fb674da9..050f87018 100644
--- a/node_modules/fs-vacuum/vacuum.js
+++ b/node_modules/fs-vacuum/vacuum.js
@@ -79,6 +79,11 @@ function vacuum (leaf, options, cb) {
return cb(null)
}
+ if (branch === process.env.HOME) {
+ log('quitting because cannot remove home directory', branch)
+ return cb(null)
+ }
+
log('removing', branch)
lstat(branch, function (error, stat) {
if (error) {