VS Code Cheat Sheet
Build Tasks
Add an npm script to package.json, then define a task in .vscode/tasks.json that references it. To bind a keyboard shortcut, add an entry to your keybindings.json using workbench.action.tasks.runTask with the task label as the args value.
In package.json, add the script:
"scripts": {
"deploy": "bun scripts/cart.ts"
}
In .vscode/tasks.json, define the task:
{
"label": "Deploy",
"type": "npm",
"script": "deploy",
"presentation": {
"reveal": "silent"
},
"problemMatcher": []
}
In keybindings.json (open with "Preferences: Open Keyboard Shortcuts (JSON)"), bind the shortcut:
{
"key": "shift+cmd+d",
"command": "workbench.action.tasks.runTask",
"args": "Deploy"
}
The args value must match the task's label exactly. Set reveal to "silent" to keep the terminal from stealing focus, or "always" if you want to watch the output.