Files
roll20-character-sheets/BattleTech-A-Time-of-War/pre-commit-script/main.py
T
Michael Smith e946e95647 BattleTech - A Time of War - splitting out sheet worker code, adding unit tests and build process (#8670)
* BTATOW Start to split up code to allow writing unit tests.

* BTATOW Add .idea folder to .gitignore file for BTATOW sheet.

* BTATOW Fix .gitignore for .idea folder.

* BTATOW Start to split out skills code and write tests. Also fix exports from attributes file.

* Added pre-commit scripts and README with development instructions.
2021-04-08 10:18:31 -04:00

26 lines
675 B
Python

import os
from typing import List
def main():
os.system("npm --prefix ../development/ run compile")
output: List[str] = []
with open('../BattleTech-A-Time-of-War.html', 'r') as character_sheet:
for line in character_sheet:
output.append(line)
if line == '<script type="text/worker">\n':
break
with open('../development/output/sheet-worker.js') as sheet_worker:
output.append(sheet_worker.read())
output.append("\n</script>\n")
with open('../BattleTech-A-Time-of-War.html', 'w') as character_sheet:
character_sheet.write("".join(output))
if __name__ == "__main__":
main()