added readme and example

This commit is contained in:
2018-04-25 22:04:09 +03:00
parent 373ee7703d
commit cb405efd26
10 changed files with 261 additions and 5 deletions

View File

@@ -28,6 +28,7 @@ class Config {
this.assets = [];
this.libs = [];
this.macros = [];
this.icon = null;
this.meta = {
title: null,
filename: null,
@@ -45,13 +46,14 @@ class Config {
update(params) {
this._params.push(params);
if (params.name !== undefined) this.name = params.name;
if (params.name !== undefined) this.main = params.main;
if (params.main !== undefined) this.main = params.main;
const cwd = process.cwd();
if (params.sources !== undefined) this.sources = this.sources.concat(params.sources.map(item => path.resolve(cwd, item)));
if (params.assets !== undefined) this.assets = this.assets.concat(params.assets.map(item => path.resolve(cwd, item)));
if (params.libs !== undefined) this.libs = this.libs.concat(Array.isArray(params.libs) ? params.libs : Object.entries(params.libs).map(([k, v]) => ({name: k, version: v})));
if (params.macros !== undefined) this.macros = this.macros.concat(params.macros);
if (params.meta !== undefined) this.meta = {...this.meta, ...params.meta};
if (this.meta.icon) this.icon = path.resolve(cwd, this.meta.icon)
}
branch(params) {

View File

@@ -22,7 +22,9 @@ class Haxe extends Sdk {
return `${this.binPath}/${name}.exe`;
} else if (Sdk.System.isLinux) {
const binPath = `${this.binPath}/${name}`;
fs.chmodSync(binPath, 0o755);
if (fs.existsSync(binPath)) {
fs.chmodSync(binPath, 0o755);
}
return binPath;
}
throw `Unsupported OS: ${os.type()}`;