VsCode - Task (tasks.json)

Card Puncher Data Processing

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

What are npm scripts and how to use them ? The script property of Package.json

{
    // 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

{
 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>





Discover More
Card Puncher Data Processing
VsCode - Workspace (.vscode)

The workspace folder is the .vscode folder The workspace configuration apply when a workspace is opened (when a folder containing a .vscode folder is open)
What are npm scripts and how to use them ? The script property of Package.json

The scripts property in package.json are command lines that: * run in the same shell than your javascript package manager (npm, yarn, etc...) * search the command executable first in the local node...



Share this page:
Follow us:
Task Runner