'Start VScode with named terminals and command ready to start

Everytime I open my vsCode project with multiple projects inside, I need to open multiple terminals and use the command "yarn <project_name>:start". I also rename them with the project name because they all have the name name by default (powershell in my case, then node when the command is launched).

I have 2 questions:

  1. Is there a way to open a predefined list of terminals with a predefined name for each project.
  2. Is there a way to input the command in each terminal with or without lauching the command.

Thank you for your help!



Solution 1:[1]

Using vscode tasks, I was able to add 2 tasks and call them together in another tasks that activates automatically on everytime I open the workspace.

{
    "label": "Start Dev",
    "runOptions": {
        "runOn": "folderOpen"
    },
    "dependsOn": ["Common", "Hub"]
},
{
    "label": "Common",
    "type": "shell",
    "command": "yarn dev:common",
    "windows": {
        "command": "yarn dev:common"
    },
    "group": "none",
    "presentation": {
        "reveal": "always",
        "panel": "new"
    }
},
{
    "label": "Hub",
    "type": "shell",
    "command": "yarn dev:hub",
    "windows": {
        "command": "yarn dev:hub"
    },
    "group": "none",
    "presentation": {
        "reveal": "always",
        "panel": "new"
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 pikalex