Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
back2dos committed May 1, 2020
1 parent 9062489 commit 013f836
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions extraParams.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--macro travix.Macro.setup()
3 changes: 2 additions & 1 deletion haxe_libraries/travix.hxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
-cp src
-lib tink_cli
-lib hx3compat
-D travix
-D travix
extraParams.hxml
7 changes: 6 additions & 1 deletion src/travix/Macro.hx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ class Macro {
File.saveContent(out, '#!/usr/bin/env node\n\n' + File.getContent(out));
});
}

public static function loadFile(name:String) {
return MacroStringTools.formatString(File.getContent(Context.getPosInfos((macro null).pos).file.directory() + '/$name'), Context.currentPos());
}

static function setup() {
if (Context.defined('js') && !Context.defined('nodejs'))
Compiler.addGlobalMetadata("js.Boot.HaxeError", '@:expose("HaxeError")');
}
#end
}

2 changes: 1 addition & 1 deletion src/travix/commands/JsCommand.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class JsCommand extends Command {
}

public function buildAndRun(rest:Rest<String>) {
build('js', ['-js', 'bin/js/tests.js', '--macro', 'addGlobalMetadata("js.Boot.HaxeError", "@:expose(\'HaxeError\')")'].concat(rest), function () {
build('js', ['-js', 'bin/js/tests.js'].concat(rest), function () {
var index = 'bin/js/run.html';
if(!index.exists()) index.saveContent(defaultIndexHtml());
var run = 'bin/js/run.js';
Expand Down

0 comments on commit 013f836

Please sign in to comment.