Comparing version 2.1.7 to 2.2.0
@@ -11,3 +11,3 @@ #!/usr/bin/env node | ||
describe: "Force use of node.js or native zip methods", | ||
choices: ["node", "native"] | ||
choices: ["node", "native"], | ||
}) | ||
@@ -30,10 +30,10 @@ .demand(2).argv; | ||
destination: destination, | ||
verbose: argv.verbose | ||
verbose: argv.verbose, | ||
}) | ||
.then(function() { | ||
.then(function () { | ||
console.log("zipped!"); | ||
}) | ||
.catch(function(err) { | ||
.catch(function (err) { | ||
console.error(err); | ||
process.exit(1); | ||
}); |
@@ -26,3 +26,3 @@ // creates a zip file using either the native `zip` command if available, | ||
noext: true, // no (a|b) | ||
nobrace: true // no {a,b} | ||
nobrace: true, // no {a,b} | ||
}; | ||
@@ -56,3 +56,3 @@ // first handle arrays | ||
function walkDir(fullPath) { | ||
const files = fs.readdirSync(fullPath).map(f => { | ||
const files = fs.readdirSync(fullPath).map((f) => { | ||
const filePath = path.join(fullPath, f); | ||
@@ -68,3 +68,3 @@ const stats = fs.statSync(filePath); | ||
const nativeZip = options => | ||
const nativeZip = (options) => | ||
new Promise((resolve, reject) => { | ||
@@ -79,6 +79,6 @@ const cwd = options.cwd || process.cwd(); | ||
stdio: "inherit", | ||
cwd | ||
cwd, | ||
}); | ||
zipProcess.on("error", reject); | ||
zipProcess.on("close", exitCode => { | ||
zipProcess.on("close", (exitCode) => { | ||
if (exitCode === 0) { | ||
@@ -102,3 +102,3 @@ resolve(); | ||
// based on http://stackoverflow.com/questions/15641243/need-to-zip-an-entire-directory-using-node-js/18775083#18775083 | ||
const nodeZip = options => | ||
const nodeZip = (options) => | ||
new Promise((resolve, reject) => { | ||
@@ -117,3 +117,3 @@ const cwd = options.cwd || process.cwd(); | ||
const destPath = source; | ||
fs.stat(fullPath, function(err, stats) { | ||
fs.stat(fullPath, function (err, stats) { | ||
if (err) { | ||
@@ -125,6 +125,6 @@ return next(err); | ||
const files = walkDir(fullPath); | ||
files.forEach(f => { | ||
files.forEach((f) => { | ||
const subPath = f.substring(fullPath.length); | ||
archive.file(f, { | ||
name: destPath + subPath | ||
name: destPath + subPath, | ||
}); | ||
@@ -143,3 +143,3 @@ }); | ||
} | ||
async.forEach(expandedSources, addSource, err => { | ||
async.forEach(expandedSources, addSource, (err) => { | ||
if (err) { | ||
@@ -158,3 +158,3 @@ return reject(err); | ||
source: arguments[1], | ||
destination: arguments[0] | ||
destination: arguments[0], | ||
}; | ||
@@ -161,0 +161,0 @@ } |
{ | ||
"name": "bestzip", | ||
"version": "2.1.7", | ||
"version": "2.2.0", | ||
"description": "Uses OS zip command if avaliable (for better performance and speed) or node.js version if there is no system command avaliable. Can be called via node or command line.", | ||
@@ -9,2 +9,5 @@ "main": "lib/bestzip.js", | ||
}, | ||
"engines": { | ||
"node": ">=10" | ||
}, | ||
"scripts": { | ||
@@ -25,22 +28,21 @@ "lint": "eslint .", | ||
"dependencies": { | ||
"archiver": "^4.0.2", | ||
"archiver": "^5.3.0", | ||
"async": "^3.2.0", | ||
"glob": "^7.1.3", | ||
"which": "^1.3.1", | ||
"yargs": "^13.2.4" | ||
"glob": "^7.1.6", | ||
"which": "^2.0.2", | ||
"yargs": "^16.2.0" | ||
}, | ||
"devDependencies": { | ||
"chai": "^4.2.0", | ||
"chai": "^4.3.4", | ||
"command-line-test": "^1.0.10", | ||
"eslint": "^5.6.1", | ||
"eslint-config-prettier": "^4.2.0", | ||
"eslint-plugin-prettier": "^3.1.0", | ||
"fs": "0.0.1-security", | ||
"jest": "^24.8.0", | ||
"eslint": "^7.22.0", | ||
"eslint-config-prettier": "^8.1.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"jest": "^26.6.3", | ||
"klaw-sync": "^6.0.0", | ||
"prettier": "^1.14.3", | ||
"regenerator-runtime": "^0.13.2", | ||
"rimraf": "^2.6.2", | ||
"unzip-stream": "^0.3.0" | ||
"prettier": "^2.2.1", | ||
"regenerator-runtime": "^0.13.7", | ||
"rimraf": "^3.0.2", | ||
"unzip-stream": "^0.3.1" | ||
} | ||
} |
# bestzip | ||
[![Build status](https://travis-ci.org/nfriedly/node-bestzip.svg?branch=master)](https://travis-ci.org/nfriedly/node-bestzip) | ||
[![npm version](https://badge.fury.io/js/bestzip.svg)](https://www.npmjs.com/package/bestzip) | ||
[![npm downloads](https://img.shields.io/npm/dm/bestzip)](https://www.npmjs.com/package/bestzip) | ||
@@ -8,7 +10,8 @@ This module provides a `bestzip` command that calls the native `zip` command if available and otherwise falls back to a | ||
The native `zip` method on macOS is significantly faster and more as efficient than the Node.js version, but Windows has no | ||
native `zip` command. This module provides the best of both worlds. | ||
The `--recurse-directories` (`-r`) option is automatically enabled. | ||
## Why? | ||
The native `zip` command on GNU/Linux and macOS is significantly faster and creates moderately smaller .zip files than the Node.js version included here, but Windows has no built-in `zip` command. This module provides the best of both worlds, and allows for easier cross-platform scripting. | ||
## Global command line usage | ||
@@ -63,6 +66,4 @@ | ||
The directory structure in the .zip is going to match your input files. To have greater or fewer levels of directories. | ||
The directory structure in the .zip is going to match your input files, but the exact details depend on how the command is called. For example: | ||
For example: | ||
`bestzip build.zip build/*` | ||
@@ -78,2 +79,4 @@ | ||
*Note: some tools, including the Archive Utility built into macOS, will automatically create a top-level folder to group everything together when extracting a .zip archive that contains multiple top-level files.* | ||
When using the programmatic API, the same effect may be achieved by passing in the `cwd` option. | ||
@@ -83,3 +86,3 @@ | ||
Wildcards ('*') ignore dotfiles. | ||
Wildcards (`*`) ignore dotfiles. | ||
@@ -86,0 +89,0 @@ * To include a dotfile, either include the directory it's in (`folder/`) or include it by name (`folder/.dotfile)` |
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
11103
11
92
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedarchiver@5.3.2(transitive)
+ Addedarchiver-utils@3.0.4(transitive)
+ Addedbrace-expansion@2.0.1(transitive)
+ Addedcliui@7.0.4(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedcompress-commons@4.1.2(transitive)
+ Addedcrc-32@1.2.2(transitive)
+ Addedcrc32-stream@4.0.3(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedminimatch@5.1.6(transitive)
+ Addedreaddir-glob@1.1.3(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedwhich@2.0.2(transitive)
+ Addedwrap-ansi@7.0.0(transitive)
+ Addedy18n@5.0.8(transitive)
+ Addedyargs@16.2.0(transitive)
+ Addedyargs-parser@20.2.9(transitive)
+ Addedzip-stream@4.1.1(transitive)
- Removedansi-regex@4.1.1(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedarchiver@4.0.2(transitive)
- Removedcamelcase@5.3.1(transitive)
- Removedcliui@5.0.0(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedcompress-commons@3.0.0(transitive)
- Removedcrc@3.8.0(transitive)
- Removedcrc32-stream@3.0.1(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removedemoji-regex@7.0.3(transitive)
- Removedfind-up@3.0.0(transitive)
- Removedis-fullwidth-code-point@2.0.0(transitive)
- Removedlocate-path@3.0.0(transitive)
- Removedp-limit@2.3.0(transitive)
- Removedp-locate@3.0.0(transitive)
- Removedp-try@2.2.0(transitive)
- Removedpath-exists@3.0.0(transitive)
- Removedrequire-main-filename@2.0.0(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedstring-width@3.1.0(transitive)
- Removedstrip-ansi@5.2.0(transitive)
- Removedwhich@1.3.1(transitive)
- Removedwhich-module@2.0.1(transitive)
- Removedwrap-ansi@5.1.0(transitive)
- Removedy18n@4.0.3(transitive)
- Removedyargs@13.3.2(transitive)
- Removedyargs-parser@13.1.2(transitive)
- Removedzip-stream@3.0.1(transitive)
Updatedarchiver@^5.3.0
Updatedglob@^7.1.6
Updatedwhich@^2.0.2
Updatedyargs@^16.2.0