summaryrefslogtreecommitdiff
path: root/WebInterface/wasm/webhogg/update.py
blob: aad9395f1e3a2c924b006176053c80c14cd61c06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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('game_logic.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('game_logic.js', 'w') as f:
    f.write(m1)

with open('graphics.js', 'w') as f:
    f.write(m2)