Skip to content

Commit

Permalink
Friendly compiler option to set the file header (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
elsassph committed Jul 10, 2019
1 parent f67a7c4 commit 0d903ca
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,2 +1,3 @@
/test/index.js
test/index.js
test/index.d.ts
test/out
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -21,6 +21,12 @@ Just compile your Haxe library to a JS module and use it in TypeScript in a perf

Just add `-lib hxtsdgen` to compiler arguments and it'll do the rest.

Options:

- Generate concrete enums file (see below): `-D hxtsdgen_enums_ts`
- Custom file header:
`--macro hxtsdgen.Generator.setHeader('/* tslint:disable */')`

## Supported Haxe features

Certain Haxe features are compiler abstractions and thus may not be possible to translate
Expand Down
4 changes: 4 additions & 0 deletions src/hxtsdgen/Generator.hx
Expand Up @@ -26,6 +26,10 @@ class Generator {
Context.onGenerate(new Generator().onGenerate);
}

static function setHeader(header:String) {
HEADER = header;
}

var outName:String;
var outDTS:String;
var outETS:String;
Expand Down
2 changes: 2 additions & 0 deletions test.hxml
@@ -1,4 +1,6 @@
-cp test
-main Main
-lib hxnodejs
-lib hxtsdgen
--macro hxtsdgen.Generator.setHeader('/* tslint:disable */')
-js test/index.js
3 changes: 2 additions & 1 deletion test/Main.hx
Expand Up @@ -4,8 +4,9 @@ import sys.FileSystem;
import sys.io.File;
using StringTools;

@:expose
class Main {
static function main() {
static public function main() {
var programDir = haxe.io.Path.directory(Sys.programPath());
var total = 0, failed = 0;

Expand Down

0 comments on commit 0d903ca

Please sign in to comment.