props/MultiShop/scripts/watch_all.py
Harrison Deng e953c52092 Updated scripts and registered tasks.
reset_db.py now has the updated path.

Added reset database to tasks.

watch_all.py has improved output.
2021-07-12 03:07:58 -05:00

32 lines
855 B
Python

import os
import asyncio
SERVER_CSPROJ_DIR = "server"
CLIENT_PACKAGE_DIR = "client"
async def exec(cmd, path, silent=False):
devnull = open(os.devnull, "wb")
os.chdir(os.path.dirname(os.path.realpath(__file__)))
os.chdir(os.pardir)
os.chdir(path)
proc = None
if (not silent):
print("Executing \"{0}\" in \"{1}\".".format(cmd, path))
proc = await asyncio.create_subprocess_shell(cmd)
else:
print("Executing \"{0}\" in \"{1}\" silently.".format(cmd, path))
proc = await asyncio.create_subprocess_shell(cmd, stdout=devnull)
await proc.wait()
devnull.close()
async def main():
print("Beginning development servers.")
await asyncio.gather(
exec("dotnet watch run", SERVER_CSPROJ_DIR),
exec("npm run serve", CLIENT_PACKAGE_DIR, silent=True))
asyncio.run(main())