[build] up haxe version
This commit is contained in:
@@ -7,6 +7,7 @@ const tar = require('tar');
|
||||
const ProgressBar = require('progress');
|
||||
const colors = require('ansi-colors');
|
||||
const log = require('fancy-log');
|
||||
const mkdirp = require('mkdirp');
|
||||
|
||||
|
||||
class System {
|
||||
@@ -79,13 +80,14 @@ class Sdk {
|
||||
if (this.prepared) {
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
mkdirp(this.path);
|
||||
const bar = new ProgressBar(`${this.tag} [:bar] :percent :etas`, {width: 40, total: 1000, clear: true});
|
||||
let stream = got.stream(this.link);
|
||||
stream = stream.on('downloadProgress', (p) => bar.update(p.percent));
|
||||
if (this.link.endsWith('.zip')) {
|
||||
stream = stream.pipe(unzip.Extract({path: this.path}));
|
||||
} else if (this.link.endsWith('tar.gz')) {
|
||||
stream = stream.pipe(tar.x({C: this.path}));
|
||||
stream = stream.pipe(tar.x({C: this.path, strip: 1}));
|
||||
} else {
|
||||
stream = stream.pipe(fs.createWriteStream(this.path));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user