3This script builds and deploys the app to my web server, which means:
51. Compiling everything into a single HTML file
62. Uploading that HTML file to my web server
10from pathlib import Path
14if __name__ == "__main__":
15 out_dir = Path("dist")
16 out_dir.mkdir(exist_ok=True)
18 html = Path("index.html").read_text()
20 '<script src="static/app.js"></script>',
21 '<script id="app">' + Path("static/app.js").read_text() + "</script>",
24 '<script src="static/jszip.min.js"></script>',
25 '<script id="jsmin">' + Path("static/jszip.min.js").read_text() + "</script>",
27 assert "<script src" not in html
29 (out_dir / "index.html").write_text(html)
32 out_dir / "index.html",
34 / "repos/alexwlchan.net/src/my-tools/add-cover-to-ao3-epubs/index.html",