From 9ed3adc0eee1eff3b342230e6a6bf904f7b37a00 Mon Sep 17 00:00:00 2001 From: Colin Jones Date: Wed, 26 Feb 2020 20:27:37 -0600 Subject: [PATCH 1/5] Get tests back to passing with ava/xo releases --- package.json | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index ff67270..bea02ae 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "url": "github.com/kevva" }, "engines": { - "node": ">=4" + "node": ">=7.6.0" }, "scripts": { "test": "xo && ava" @@ -41,9 +41,20 @@ }, "devDependencies": { "ava": "*", + "esm": "^3.2.25", "is-jpg": "^1.0.0", "path-exists": "^3.0.0", "pify": "^2.3.0", "xo": "*" + }, + "ava": { + "require": [ + "esm" + ] + }, + "xo": { + "rules": { + "promise/prefer-await-to-then": "off" + } } } From eac3aceb5a36040cb61eeefd2c866cd4dc8dd2fb Mon Sep 17 00:00:00 2001 From: Jeff Rafter Date: Thu, 27 Feb 2020 07:25:56 -0800 Subject: [PATCH 2/5] Add an option to disable symlinks Co-Authored-By: James Brady --- index.js | 6 +++--- test.js | 11 +++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 9193ebd..5a675a9 100644 --- a/index.js +++ b/index.js @@ -54,15 +54,15 @@ const extractFile = (input, output, opts) => runPlugins(input, opts).then(files return makeDir(path.dirname(dest)) .then(() => { - if (x.type === 'link') { + if (x.type === 'link' && opts.symlinks !== false) { return fsP.link(x.linkname, dest); } - if (x.type === 'symlink' && process.platform === 'win32') { + if (x.type === 'symlink' && process.platform === 'win32' && opts.symlinks !== false) { return fsP.link(x.linkname, dest); } - if (x.type === 'symlink') { + if (x.type === 'symlink' && opts.symlinks !== false) { return fsP.symlink(x.linkname, dest); } diff --git a/test.js b/test.js index d145ba0..83c1489 100644 --- a/test.js +++ b/test.js @@ -50,7 +50,14 @@ test.serial('extract file to directory', async t => { await fsP.unlink(path.join(__dirname, 'test.jpg')); }); -test('extract symlink', async t => { +test.serial('extract without symlink', async t => { + await m(path.join(__dirname, 'fixtures', 'symlink.tar'), __dirname, {strip: 1, symlinks: false}); + t.not(await fsP.realpath(path.join(__dirname, 'symlink')), path.join(__dirname, 'file.txt')); + await fsP.unlink(path.join(__dirname, 'symlink')); + await fsP.unlink(path.join(__dirname, 'file.txt')); +}); + +test.serial('extract symlink', async t => { await m(path.join(__dirname, 'fixtures', 'symlink.tar'), __dirname, {strip: 1}); t.is(await fsP.realpath(path.join(__dirname, 'symlink')), path.join(__dirname, 'file.txt')); await fsP.unlink(path.join(__dirname, 'symlink')); @@ -99,7 +106,7 @@ test.serial('set mtime', async t => { await fsP.unlink(path.join(__dirname, 'test.jpg')); }); -test('return emptpy array if no plugins are set', async t => { +test('return empty array if no plugins are set', async t => { const files = await m(path.join(__dirname, 'fixtures', 'file.tar'), {plugins: []}); t.is(files.length, 0); }); From 9fb6732ef6cad7868f7f475fe05776dd06e27e44 Mon Sep 17 00:00:00 2001 From: Jeff Rafter Date: Thu, 27 Feb 2020 08:04:38 -0800 Subject: [PATCH 3/5] Do not write empty files when not processing symlinks Co-Authored-By: James Brady --- index.js | 10 +++++++--- test.js | 3 +-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 5a675a9..a8a551e 100644 --- a/index.js +++ b/index.js @@ -54,15 +54,19 @@ const extractFile = (input, output, opts) => runPlugins(input, opts).then(files return makeDir(path.dirname(dest)) .then(() => { - if (x.type === 'link' && opts.symlinks !== false) { + if ((x.type === 'link' || x.type === 'symlink') && opts.symlinks === false) { + return; + } + + if (x.type === 'link') { return fsP.link(x.linkname, dest); } - if (x.type === 'symlink' && process.platform === 'win32' && opts.symlinks !== false) { + if (x.type === 'symlink' && process.platform === 'win32') { return fsP.link(x.linkname, dest); } - if (x.type === 'symlink' && opts.symlinks !== false) { + if (x.type === 'symlink') { return fsP.symlink(x.linkname, dest); } diff --git a/test.js b/test.js index 83c1489..2f28c62 100644 --- a/test.js +++ b/test.js @@ -52,8 +52,7 @@ test.serial('extract file to directory', async t => { test.serial('extract without symlink', async t => { await m(path.join(__dirname, 'fixtures', 'symlink.tar'), __dirname, {strip: 1, symlinks: false}); - t.not(await fsP.realpath(path.join(__dirname, 'symlink')), path.join(__dirname, 'file.txt')); - await fsP.unlink(path.join(__dirname, 'symlink')); + t.false(fs.existsSync(path.join(__dirname, 'symlink'))); await fsP.unlink(path.join(__dirname, 'file.txt')); }); From 04780b09a2d0ac3a9b4fc82361d4d4340823fb30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Mon, 29 Jul 2019 02:13:12 +0200 Subject: [PATCH 4/5] Bump dependencies --- .travis.yml | 4 ++-- index.js | 4 ++-- package.json | 22 +++++++++++++++------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 57505cf..f09222f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ sudo: false language: node_js node_js: + - '12' + - '10' - '8' - - '6' - - '4' diff --git a/index.js b/index.js index a8a551e..213ad06 100644 --- a/index.js +++ b/index.js @@ -87,12 +87,12 @@ module.exports = (input, output, opts) => { output = null; } - opts = Object.assign({plugins: [ + opts = {plugins: [ decompressTar(), decompressTarbz2(), decompressTargz(), decompressUnzip() - ]}, opts); + ], ...opts}; const read = typeof input === 'string' ? fsP.readFile(input) : Promise.resolve(input); diff --git a/package.json b/package.json index bea02ae..4052dd1 100644 --- a/package.json +++ b/package.json @@ -35,15 +35,15 @@ "decompress-targz": "^4.0.0", "decompress-unzip": "^4.0.1", "graceful-fs": "^4.1.10", - "make-dir": "^1.0.0", - "pify": "^2.3.0", - "strip-dirs": "^2.0.0" + "make-dir": "^3.0.0", + "pify": "^4.0.1", + "strip-dirs": "^3.0.0" }, "devDependencies": { "ava": "*", "esm": "^3.2.25", - "is-jpg": "^1.0.0", - "path-exists": "^3.0.0", + "is-jpg": "^2.0.0", + "path-exists": "^4.0.0", "pify": "^2.3.0", "xo": "*" }, @@ -54,7 +54,15 @@ }, "xo": { "rules": { - "promise/prefer-await-to-then": "off" - } + "promise/prefer-await-to-then": "warn" + }, + "overrides": [ + { + "files": "test.js", + "rules": { + "import/default": "ignore" + } + } + ] } } From 5baf54df6e088be52f4f4883e1d802b6f812d8f4 Mon Sep 17 00:00:00 2001 From: Jeff Rafter Date: Thu, 27 Feb 2020 11:11:55 -0800 Subject: [PATCH 5/5] Bump