Skip to content

Instantly share code, notes, and snippets.

@hyunbinseo
Created August 18, 2022 09:37
Show Gist options
  • Save hyunbinseo/31dbe9c02ec91d97077826fc9ba90b42 to your computer and use it in GitHub Desktop.
Save hyunbinseo/31dbe9c02ec91d97077826fc9ba90b42 to your computer and use it in GitHub Desktop.
Run currently opened .ts file in VS Code
{
// Steps
// 1. Open workspace in the Visual Studio Code
// 2. Install 'esno' (https://www.npmjs.com/package/esno)
// 3. Create a '.vscode/tasks.json' file
// 4. Open a TypeScript file
// 5. Press 'Ctrl + Shift + B' (run build task)
"version": "2.0.0",
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"tasks": [
{
"label": "npx: esno", // Name shown in the 'Run Task' list
"group": "build", // (Optional) Set as Build Task
// If "group": "build" is removed, run as following
// 1-4: Identical as above
// 5: Command Palette / Task: Run Task / npx: esno
"type": "shell",
// Basically runs 'npx esno path-to-current-file'
"command": "npx esno ${relativeFile}"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment