VsCode - Task (tasks.json)

Location

tasks.json file in the workspace .vscode folder

Shortcut

  • Ctrl+Shift+B (Run Build Task)
  • Terminal > Configure Tasks > Create tasks.json file from templates > Others

Example

Run a command

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "echo",
            "type": "shell",
            "command": "echo Hello"
        }
    ]
}

Run a npm script

NPM - Script

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558 
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "type": "npm",
            "script": "test",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

Run Typescript

<file javascript tasks.json> {

// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
  {
    "label": "sh",
    "type": "shell",
    "command": "tsc -w -p .",
    "group": {
      "kind": "build",
      "isDefault": true
    }
  }
]

} </code>


Powered by ComboStrap