jscrambler
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -109,3 +109,4 @@ /** | ||
var deferred = Q.defer(); | ||
this.zipProject(params.files); | ||
this.zipProject(params.files, params.cwd); | ||
delete params.cwd; | ||
client.post('/code.json', params, function (err, res, body) { | ||
@@ -179,3 +180,3 @@ this.cleanZipProject(); | ||
if (typeof config.filesSrc[i] === 'string') { | ||
filesSrc = filesSrc.concat(glob.sync(config.filesSrc[i])); | ||
filesSrc = filesSrc.concat(glob.sync(config.filesSrc[i], {dot: true})); | ||
} else { | ||
@@ -212,5 +213,6 @@ filesSrc.push(config.filesSrc[i]); | ||
/** | ||
* It zips all files inside the passed parameter into a single zip file. | ||
* It zips all files inside the passed parameter into a single zip file. It | ||
* accepts an optional `cwd` parameter. | ||
*/ | ||
zipProject: function (files) { | ||
zipProject: function (files, cwd) { | ||
var hasFiles = false; | ||
@@ -224,11 +226,17 @@ if (files.length === 1 && /^.*\.zip$/.test(files[0])) { | ||
var buffer, name; | ||
var path = cwd ? cwd + '/' + files[i] : files[i]; | ||
// If buffer | ||
if (files[i].contents) { | ||
name = path.relative(files[i].cwd, files[i].path); | ||
buffer = files[i].contents; | ||
} else if (!fs.statSync(files[i]).isDirectory()) { | ||
} | ||
// Else if it's a path and not a directory | ||
else if (!fs.statSync(path).isDirectory()) { | ||
name = files[i]; | ||
buffer = fs.readFileSync(files[i]); | ||
} else { | ||
zip.folder(files[i]); | ||
buffer = fs.readFileSync(path); | ||
} | ||
// Else if it's a directory path | ||
else { | ||
zip.folder(path); | ||
} | ||
if (name) { | ||
@@ -235,0 +243,0 @@ hasFiles = true; |
{ | ||
"name": "jscrambler", | ||
"description": "JScrambler API client.", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"homepage": "https://github.com/auditmark/node-jscrambler", | ||
@@ -33,3 +33,3 @@ "author": { | ||
"jszip": "^2.2.2", | ||
"glob": "^3.2.11" | ||
"glob": "^4.0.2" | ||
}, | ||
@@ -36,0 +36,0 @@ "main": "jscrambler", |
Sorry, the diff of this file is not supported yet
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
25080
453
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedglob@4.5.3(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedminimatch@2.0.10(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removedglob@3.2.11(transitive)
- Removedlru-cache@2.7.3(transitive)
- Removedminimatch@0.3.0(transitive)
- Removedsigmund@1.0.1(transitive)
Updatedglob@^4.0.2