Changed file watching development setup.
No longer launches browser. Added watch server task for API work. watch_all.py only displays server output and client error output.
This commit is contained in:
@@ -1,29 +1,31 @@
|
||||
import os
|
||||
import asyncio
|
||||
import sys
|
||||
|
||||
SERVER_CSPROJ_DIR = "server"
|
||||
CLIENT_PACKAGE_DIR = "client"
|
||||
|
||||
|
||||
async def exec(cmd, path):
|
||||
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)
|
||||
print("Executing \"{0}\" in \"{1}\".".format(cmd, path))
|
||||
proc = await asyncio.create_subprocess_shell(
|
||||
cmd,
|
||||
stdout=sys.stdout,
|
||||
stderr=sys.stderr,
|
||||
)
|
||||
proc = None
|
||||
if (not silent):
|
||||
proc = await asyncio.create_subprocess_shell(cmd)
|
||||
else:
|
||||
print("Executing in silent mode.")
|
||||
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))
|
||||
exec("npm run serve", CLIENT_PACKAGE_DIR, silent=True))
|
||||
|
||||
asyncio.run(main())
|
||||
|
Reference in New Issue
Block a user