-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdev.py
59 lines (45 loc) · 1.3 KB
/
dev.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import asyncio
import shutil
from pathlib import Path
import re
import os
_dir = Path(__file__).parent
def asset():
docs_src_dir = _dir.joinpath('docs-src')
for path in docs_src_dir.glob('**/*'):
path = str(path.relative_to(docs_src_dir))
if re.search('.*\.(webm|jpg|svg|png|ttf|xml)$', path):
src = docs_src_dir.joinpath(path)
dest = _dir.joinpath('docs/', path)
try:
os.makedirs(dest.parent)
except FileExistsError:
pass
shutil.copy(src, dest)
async def engrave():
server = '0.0.0.0:8000'
cmd = f"engrave dev docs-src docs --server={server}"
print(cmd)
proc = await asyncio.create_subprocess_shell(cmd)
await proc.communicate()
async def docs():
cmd = "npx parcel watch --no-cache --target docs " +\
"'docs-src/**/*.(scss|js|ts)' "
print(cmd)
proc = await asyncio.create_subprocess_shell(cmd)
await proc.communicate()
async def gadjet_module():
cmd = 'npx tsc -w -p src/'
print(cmd)
proc = await asyncio.create_subprocess_shell(cmd)
await proc.communicate()
async def main():
# lib()
asset()
await asyncio.gather(
gadjet_module(),
docs(),
engrave(),
)
if __name__ == "__main__":
asyncio.run(main())