[build] up haxe version

This commit is contained in:
2018-03-07 17:17:02 +03:00
parent 0d4ac4e3e5
commit e9212a889d
3 changed files with 8 additions and 4 deletions

View File

@@ -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));
}