-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- added support to confix.txt file, and added default file - added "press enter to continue..." - added release script - updated readme - added generate release zip script
- Loading branch information
Showing
8 changed files
with
537 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
subreddit=r/talesfromtechsupport | ||
max_pages=10 | ||
kindle_from_email=user@mail.com | ||
kindle_to_email=user@kindle.com | ||
kindle_to_email=user@kindle.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
.idea | ||
.git | ||
.env | ||
config.txt | ||
node_modules | ||
output | ||
cover/cover.jpg | ||
cover/cover.jpg | ||
reddit2ebook-linux | ||
reddit2ebook-win.exe | ||
reddit2ebook-macos | ||
releases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
subreddit=r/talesfromtechsupport | ||
max_pages=10 | ||
kindle_from_email=user@mail.com | ||
kindle_to_email=user@kindle.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const fs = require('fs'); | ||
var pjson = require('./package.json'); | ||
const archiver = require('archiver'); | ||
|
||
// create releases folder if not exist | ||
if (!fs.existsSync('releases')) { | ||
fs.mkdirSync('releases'); | ||
} | ||
|
||
|
||
//async to generate 3 zip files at same time | ||
async function generateRelease(release) { | ||
// create a file to stream archive data to. | ||
const output = fs.createWriteStream(__dirname + '/releases/reddit2ebook-' + pjson.version + "-" + release + '.zip'); | ||
const archive = archiver('zip', { | ||
zlib: { level: 9 } // Sets the compression level. | ||
}); | ||
|
||
output.on('close', function() { | ||
console.log("Release: " + release + ". Total size: " + formatBytes(archive.pointer())); | ||
}); | ||
|
||
archive.on('error', function(err) { | ||
throw err; | ||
}); | ||
|
||
|
||
archive.pipe(output); | ||
|
||
//add executable | ||
const executable = release === 'win' ? 'win.exe' : release; | ||
archive.append(fs.createReadStream('reddit2ebook-' + executable), { name: 'reddit2ebook-' + executable }); | ||
|
||
//add default config file | ||
archive.append(fs.createReadStream('config.default.txt'), { name: 'config.txt' }); | ||
|
||
//add default cover file | ||
archive.append(fs.createReadStream('./cover/Reddit2Ebook.jpg'), { name: 'cover/Reddit2Ebook.jpg' }); | ||
|
||
|
||
// finalize the archive (ie we are done appending files but streams have to finish yet) | ||
archive.finalize(); | ||
} | ||
|
||
// Quick formatting function from https://stackoverflow.com/a/18650828 | ||
function formatBytes(a,b){if(0==a)return"0 Bytes";var c=1024,d=b||2,e=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],f=Math.floor(Math.log(a)/Math.log(c));return parseFloat((a/Math.pow(c,f)).toFixed(d))+" "+e[f]} | ||
|
||
|
||
generateRelease('win'); | ||
generateRelease('linux'); | ||
generateRelease('macos'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.