Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit e4fc4c9

Browse files
committed
Update script to make webpack xml
1 parent 1c9774f commit e4fc4c9

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

scripts/dist2xml.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,22 @@
22
from json2xml import json2xml
33
from json2xml.utils import readfromstring
44
import sys
5+
import os
6+
7+
if "COMPDIR" in os.environ:
8+
data_path = os.path.join(os.environ["COMPDIR"], "runestone/dist")
9+
else:
10+
data_path = ""
11+
12+
data = json.loads(
13+
open(os.path.join(data_path, "webpack_static_imports.json")).read())
14+
15+
if sys.argv[1] == "test":
16+
data['cdn-url'] = sys.argv[2] if len(sys.argv) > 2 else "_static/"
17+
else:
18+
data['cdn-url'] = "https://runestone.academy/cdn/runestone/"
519

6-
data = json.loads(open("runestone/dist/webpack_static_imports.json").read())
720
data['version'] = sys.argv[1]
8-
#data = readfromstring()
9-
print(json2xml.Json2xml(data).to_xml())
21+
22+
with open(os.path.join(data_path, "webpack_static_imports.xml"), "w") as f:
23+
f.write(json2xml.Json2xml(data).to_xml())

0 commit comments

Comments
 (0)