-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: e pr download-dist <number> (#679)
* feat: e pr download-dist <number> * update docs * Update src/e-pr.js Co-authored-by: Will Anderson <[email protected]> * use correct executable names per platform * fix guess target * set e pr open as default command * allow specifying output directory * fix wording * download to temporary directory * Update src/e Co-authored-by: David Sanders <[email protected]> * download and extract in-memory * add confirmation prompt * download progress * success color * skip confirmation in CI * refactor: use extract-zip to extract symlinks properly * chore: remove adm-zip * fix: lockfile changes * default download choice to no/false * dedupe temp file cleanup * add closed pr warning * include short commit hash in artifact dir name * win32 => win * ehh maybe dont mix - and _ * fix: remove tmp directory in case it exists * build: fixup yarn.lock --------- Co-authored-by: Will Anderson <[email protected]> Co-authored-by: David Sanders <[email protected]>
- Loading branch information
1 parent
d1a9f7e
commit 4103930
Showing
9 changed files
with
351 additions
and
41 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,5 @@ | ||
.nyc_output/ | ||
artifacts | ||
configs | ||
coverage | ||
node_modules | ||
|
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
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
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,26 @@ | ||
const stream = require('stream'); | ||
const ProgressBar = require('progress'); | ||
|
||
const MB_BYTES = 1024 * 1024; | ||
|
||
const progressStream = function (total, tokens) { | ||
var pt = new stream.PassThrough(); | ||
|
||
pt.on('pipe', function (_stream) { | ||
const bar = new ProgressBar(tokens, { total: Math.round(total) }); | ||
|
||
pt.on('data', function (chunk) { | ||
const elapsed = new Date() - bar.start; | ||
const rate = bar.curr / (elapsed / 1000); | ||
bar.tick(chunk.length, { | ||
mbRate: (rate / MB_BYTES).toFixed(2), | ||
}); | ||
}); | ||
}); | ||
|
||
return pt; | ||
}; | ||
|
||
module.exports = { | ||
progressStream, | ||
}; |
Oops, something went wrong.