[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

@@ -28,7 +28,8 @@
"tmp-file": "^2.0.1",
"unzip-stream": "^0.2.1",
"vinyl-fs": "^3.0.1",
"yargs": "^10.0.3"
"yargs": "^10.0.3",
"mkdirp": "latest"
},
"haxeDependencies": {
"lime": "6.0.1",

View File

@@ -28,7 +28,7 @@ class Haxe extends Sdk {
}
get binPath() {
return `${this.path}/haxe-${this.version}`;
return `${this.path}`;
}
get haxeBin() {
@@ -294,7 +294,8 @@ Haxe.ID = 'haxe';
Haxe.VERSION_3_4_0 = '3.4.0';
Haxe.VERSION_3_4_2 = '3.4.2';
Haxe.VERSION_3_4_3 = '3.4.3';
Haxe.VERSION_3 = Haxe.VERSION_3_4_2;
Haxe.VERSION_3_4_7 = '3.4.7';
Haxe.VERSION_3 = Haxe.VERSION_3_4_7;
Haxe.VERSION = Haxe.VERSION_3;
module.exports = Haxe;

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