summaryrefslogtreecommitdiff
path: root/WebInterface/wasm/webhogg/update.py
diff options
context:
space:
mode:
Diffstat (limited to 'WebInterface/wasm/webhogg/update.py')
-rw-r--r--WebInterface/wasm/webhogg/update.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/WebInterface/wasm/webhogg/update.py b/WebInterface/wasm/webhogg/update.py
new file mode 100644
index 0000000..0a0171f
--- /dev/null
+++ b/WebInterface/wasm/webhogg/update.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+ISC = '//!IMPORTANT_STUFF'
+
+def rf(fn):
+ f = open(fn)
+ c = f.read()
+ f.close()
+ return c
+
+nc = rf('pkg/webhogg.js')
+m1 = rf('loader.js')
+m2 = rf('graphics.js')
+
+nc = nc.split('function init(module) {')[0].strip('\n')
+nc = nc.replace('export function ', 'function ')
+m1 = m1.split('//!IMPORTANT_STUFF')[-1]
+m2 = m2.split('//!IMPORTANT_STUFF')[-1]
+
+nc += '\n' * 2 + ISC
+
+m1 = nc + m1
+m2 = nc + m2
+
+with open('loader.js', 'w') as f:
+ f.write(m1)
+
+with open('graphics.js', 'w') as f:
+ f.write(m2)