The tasks.json-file defines a build task for the famous text-editor Visual Studio Code. It's goal is to transcript the TypeScript-file (.ts) you are currently editing to a JavaScript-file (.js) and to run that outcoming js-file with node.js in your default shell (the shell you defined as default in Visual Studio Code)
To run this build task you have to install on your system this applications:
-
node.js
-
npm
Then open your favorite shell and use this command to install the TypeScript-transcriptor:
npm install -g typescript
If that command doesn't work on your favorite Linux-distro, you may have to run it with sudo.
To run the build task you have to take a few simple steps first:
-
Download the tasks.json-file or clone the whole repository.
-
Move the tasks.json-file into the .vscode-directory of your VSCode-workspace.
-
Open your VSCode and create a new TypeScript-file (new file with file-extension .ts) and type there some random TypeScript-code. You can use this snippet, for example:
var msg:string = "Hello World!" console.log(msg)
We only need that file to configure and test the build task, so the code doesn't have to be very complex.
-
Then open in your VSCode the tab "Terminal" and goto "Configure Default Build Task...". There you have to choose the option "node_runner_task(ts)".
-
At the end you have to run the configured Build Task. To do so, open "Terminal" > "Run Build Task" or just hit
STRG
+SHIFT
+B
-
The build task opens now two new shells. In the first one there is working the transcriptor. The second one runs the succesfully transcipted js-file with node.js. It's outcome is "Hello World!". Congratulations!