Comparing version 2.1.5 to 2.1.6
@@ -85,2 +85,14 @@ // creates a zip file using either the native `zip` command if available, | ||
function walkDir(fullPath) { | ||
const files = fs.readdirSync(fullPath).map(f => { | ||
const filePath = path.join(fullPath, f); | ||
const stats = fs.statSync(filePath); | ||
if (stats.isDirectory()) { | ||
return walkDir(filePath); | ||
} | ||
return filePath; | ||
}); | ||
return files.reduce((acc, cur) => acc.concat(cur), []); | ||
} | ||
function addSource(source, next) { | ||
@@ -94,3 +106,10 @@ const fullPath = path.resolve(cwd, source); | ||
if (stats.isDirectory()) { | ||
archive.directory(fullPath, destPath); | ||
// Walk directory. Works on directories and directory symlinks. | ||
const files = walkDir(fullPath); | ||
files.forEach(f => { | ||
const subPath = f.substring(fullPath.length); | ||
archive.file(f, { | ||
name: destPath + subPath | ||
}); | ||
}); | ||
} else if (stats.isFile()) { | ||
@@ -97,0 +116,0 @@ archive.file(fullPath, { stats: stats, name: destPath }); |
{ | ||
"name": "bestzip", | ||
"version": "2.1.5", | ||
"version": "2.1.6", | ||
"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.", | ||
@@ -24,3 +24,3 @@ "main": "lib/bestzip.js", | ||
"dependencies": { | ||
"archiver": "^3.0.0", | ||
"archiver": "^4.0.2", | ||
"async": "^2.6.1", | ||
@@ -27,0 +27,0 @@ "glob": "^7.1.3", |
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
10235
172
+ Addedarchiver@4.0.2(transitive)
+ Addedasync@3.2.6(transitive)
+ Addedcompress-commons@3.0.0(transitive)
+ Addedzip-stream@3.0.1(transitive)
- Removedarchiver@3.1.1(transitive)
- Removedcompress-commons@2.1.1(transitive)
- Removedzip-stream@2.1.3(transitive)
Updatedarchiver@^4.0.2