@crutchcorn/pack-mmip
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "@crutchcorn/pack-mmip", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "Automatic packer for MediaMonkey Extension (MMIP) files. Run npm install, and Add this folder to your system PATH, then you can run pack-mmip and pack-zip.", |
45
zip.js
@@ -0,1 +1,2 @@ | ||
#!/usr/bin/env node | ||
const path = require('path'); | ||
@@ -23,7 +24,7 @@ const fs = require('fs'); | ||
var autoAnswerYes = false, | ||
var autoAnswerYes = false, | ||
debug = false, | ||
ignoreConfig = false, | ||
nameZipInstead = false, | ||
openAfterComplete = false, | ||
openAfterComplete = false, | ||
putFileIntoBin = false, | ||
@@ -170,3 +171,3 @@ showAfterComplete = false, | ||
if (!runningConfiguration) { | ||
/* === Path-related arguments === */ | ||
@@ -215,3 +216,3 @@ | ||
let basename = path.basename(resultFilePath); | ||
dirname = path.join(dirname, 'bin'); | ||
@@ -250,6 +251,6 @@ resultFilePath = path.join(dirname, basename); | ||
if (fs.existsSync(resultFilePath) && !autoAnswerYes) { | ||
let question = '\nWarning: '.brightRed + resultFilePath + ' already exists.' + '\nOverwrite? (yes): '; | ||
rl.question(question, (overwrite) => { | ||
if (overwrite == '' || overwrite.toLowerCase().startsWith('y')) { | ||
@@ -275,6 +276,6 @@ //begin archiving process | ||
console.log(`Destination: ${resultFilePath.brightYellow}\n`); | ||
// create a file to stream archive data to. | ||
var output = fs.createWriteStream(resultFilePath); | ||
var archive = archiver('zip', { | ||
@@ -293,3 +294,3 @@ zlib: { level: -1 }, // -1: Default compression level | ||
}); | ||
output.on('error', err => { | ||
@@ -302,5 +303,5 @@ console.log('Could not write to file. Is it open in another program? (WriteStream output error)'); | ||
archive.on('warning', function (err) { | ||
console.log('archive warning: '); | ||
if (err.code === 'ENOENT') { | ||
@@ -332,9 +333,9 @@ // log warning | ||
function finish() { | ||
var fileStats = fs.statSync(resultFilePath); | ||
console.log('Double checking file size: ' + fileStats.size / 1000 + ' KiB'); | ||
if (showAfterComplete) { | ||
console.log('Opening parent folder'); | ||
//Show parent folder after complete | ||
@@ -344,3 +345,3 @@ let parentPath = path.resolve(resultFilePath, '../'); | ||
//let p1 = spawn('explorer', [parentPath]); | ||
p1.on('error', (err) => { | ||
@@ -351,9 +352,9 @@ p1.kill(); | ||
} | ||
if (openAfterComplete) { | ||
console.log('Opening file'); | ||
//Open file after complete | ||
let p2 = spawn('explorer', [resultFilePath]); | ||
p2.on('error', (err) => { | ||
@@ -364,3 +365,3 @@ p2.kill(); | ||
} | ||
//close readline interface | ||
@@ -392,3 +393,3 @@ rl.close(); | ||
var config = {}; | ||
if (fs.existsSync(configPath)) { | ||
@@ -405,3 +406,3 @@ let question = 'Configuration already exists.' + '\nOverwrite? (yes): '; | ||
} | ||
function _runConfiguration(){ | ||
@@ -440,2 +441,2 @@ //Open after complete | ||
} | ||
} | ||
} |
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
372
15815