[build] up haxe dependencies

This commit is contained in:
2018-01-28 14:20:41 +03:00
parent 6a00ee83d7
commit 24373aa85a
6 changed files with 34 additions and 17 deletions

View File

@@ -76,6 +76,11 @@ class Haxe extends Sdk {
return this.haxelib(args);
};
if (!Array.isArray(packages)) {
packages = Object.entries(packages).map(([k, v]) => ({name: k, version: v}));
}
console.log('packages', packages);
for (let pack of packages) {
const args = [];
let version = null;
@@ -83,6 +88,11 @@ class Haxe extends Sdk {
args.push('install', pack);
} else if (typeof pack === 'object') {
version = pack.version;
console.log('z', version.substr(0, 3));
if (version.substr(0, 3) === 'git') {
pack.git = version;
version = null;
}
if (pack.git) {
args.push('git', pack.name, pack.git);
if (pack.branch) args.push(pack.branch);
@@ -93,7 +103,12 @@ class Haxe extends Sdk {
args.push('--always');
}
let path = `${this.path}/lib/${args[1]}`;
if (version) path += `/${version.replace(/\./g, ',')}`;
if (version) {
path += `/${version.replace(/\./g, ',')}`;
} else if (pack.git) {
path += '/git';
}
console.log('p', path);
if (!fs.existsSync(path)) {
promise = promise.then(next(args));
}