Pass output directory throuh to consts and call a cleanup function
[ldk-java] / typescript_strings.py
index 29ccc3e45933e5819b3a4a61cbb1c29b24e6c351..9441a2ac8bdad224c55d8b0f73fb298e0d5a514a 100644 (file)
@@ -11,8 +11,8 @@ class Target(Enum):
     BROWSER = 2
 
 class Consts:
-    def __init__(self, DEBUG: bool, target: Target, **kwargs):
-
+    def __init__(self, DEBUG: bool, target: Target, outdir: str, **kwargs):
+        self.outdir = outdir
         self.c_type_map = dict(
             uint8_t = ['number', 'Uint8Array'],
             uint16_t = ['number', 'Uint16Array'],
@@ -282,11 +282,11 @@ void __attribute__((visibility("default"))) TS_free(uint32_t ptr) {
 
         self.hu_struct_file_prefix = f"""
 import CommonBase from './CommonBase';
-import * as bindings from '../bindings' // TODO: figure out location
+import * as bindings from '../bindings.mjs'
 
 """
         self.c_fn_ty_pfx = ""
-        self.file_ext = ".ts"
+        self.file_ext = ".mts"
         self.ptr_c_ty = "uint32_t"
         self.ptr_native_ty = "number"
         self.result_c_ty = "uint32_t"
@@ -1160,3 +1160,6 @@ const decodeString = (stringPointer, free = true) => {
             out_java_struct += ("\t}\n\n")
 
         return (out_java, out_c, out_java_struct)
+
+    def cleanup(self):
+        pass