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:
		
							
								
								
									
										18
									
								
								MultiShop/.vscode/tasks.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								MultiShop/.vscode/tasks.json
									
									
									
									
										vendored
									
									
								
							| @@ -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"] | ||||
|         } | ||||
|     ] | ||||
| } | ||||
| @@ -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()) | ||||
|   | ||||
| @@ -17,7 +17,7 @@ | ||||
|     }, | ||||
|     "MultiShop": { | ||||
|       "commandName": "Project", | ||||
|       "launchBrowser": true, | ||||
|       "launchBrowser": false, | ||||
|       "applicationUrl": "http://localhost:5000;https://localhost:5001", | ||||
|       "environmentVariables": { | ||||
|         "ASPNETCORE_ENVIRONMENT": "Development" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user