diff --git a/MultiShop/.vscode/tasks.json b/MultiShop/.vscode/tasks.json index cfe9a5f..93cb400 100644 --- a/MultiShop/.vscode/tasks.json +++ b/MultiShop/.vscode/tasks.json @@ -2,7 +2,7 @@ "version": "2.0.0", "tasks": [ { - "label": "build", + "label": "build app", "command": "dotnet", "type": "process", "args": [ @@ -14,7 +14,7 @@ "problemMatcher": "$msCompile" }, { - "label": "publish", + "label": "publish app", "command": "dotnet", "type": "process", "args": [ @@ -30,9 +30,21 @@ "command": "py", "type": "process", "args": [ - "scripts/watch_all.py" + "${workspaceFolder}/scripts/watch_all.py" ], "problemMatcher": ["$msCompile", "$node-sass", "$jshint"], }, + { + "label": "watch server", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "-p", + "${workspaceFolder}/server/MultiShop.csproj", + "run" + ], + "problemMatcher": ["$msCompile"] + } ] } \ No newline at end of file diff --git a/MultiShop/scripts/watch_all.py b/MultiShop/scripts/watch_all.py index b56da2e..9449ac4 100644 --- a/MultiShop/scripts/watch_all.py +++ b/MultiShop/scripts/watch_all.py @@ -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()) diff --git a/MultiShop/server/Properties/launchSettings.json b/MultiShop/server/Properties/launchSettings.json index cf48059..3c5e3bc 100644 --- a/MultiShop/server/Properties/launchSettings.json +++ b/MultiShop/server/Properties/launchSettings.json @@ -17,7 +17,7 @@ }, "MultiShop": { "commandName": "Project", - "launchBrowser": true, + "launchBrowser": false, "applicationUrl": "http://localhost:5000;https://localhost:5001", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development"