Skip to content

Instantly share code, notes, and snippets.

@JaimeStill
Created December 3, 2021 16:29
Show Gist options
  • Save JaimeStill/fbf27a9862e516596e3520857694453f to your computer and use it in GitHub Desktop.
Save JaimeStill/fbf27a9862e516596e3520857694453f to your computer and use it in GitHub Desktop.
Run server and all Angular apps in one VS Code Task

Run Platform Via Task

Overview

This setup assumes a monorepo configuration similar to what would be generated from this offline-platform schematic. It assumes that you want to execute the following:

  1. Start the .NET server and build the Angular library simultaneously.
  2. Once the Angular library build completes, start all of the Angular apps that are included in the monorepo.

Command Configuration

The commands configured in tasks.json are defined in the root package.json of the monorepo. For the tasks defined in this gist, the associated scripts defined in the scripts section would look as follows:

"script": {
  "build": "ng build core --configuration development",
  "start:server": "dotnet run --project ./server/Project.Web",
  "start:app-a": "ng serve app-a --configuration development",
  "start:app-b": "ng serve app-b --configuration development"
}

Running Tasks

  1. Press Ctrl + P to open the search bar
  2. Type task dev then press Enter
  3. Select Continue without scanning the task output and press Enter
    • If you are sure you will never want to scan task output, you can optionally select Never scan the task output for this task
{
"version": "2.0.0",
"tasks": [
{
"label": "dev",
"dependsOrder": "parallel",
"dependsOn": [
"server",
"clients"
]
},
{
"label": "server",
"type": "shell",
"command": "yarn watch:server",
"presentation": {
"panel": "dedicated"
}
},
{
"label": "clients",
"dependsOn": [
"core",
"apps"
],
"dependsOrder": "sequence"
},
{
"label": "core",
"type": "shell",
"command": "yarn build",
"presentation": {
"panel": "dedicated"
}
},
{
"label": "apps",
"dependsOn": [
"app-a",
"app-b"
],
"dependsOrder": "parallel"
},
{
"label": "app-a",
"type": "shell",
"command": "yarn start:app-a",
"presentation": {
"panel": "dedicated"
}
},
{
"label": "app-b",
"type": "shell",
"command": "yarn start:app-b",
"presentation": {
"panel": "dedicated"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment