continue-custom/.vscode/tasks.json
Ray Strode 9660c7ed08 vscode: Ensure extension.js is rebuilt when deleted
Right now, the vscode-extension:continue-ui:build task
deletes extension.js as part of its prepackage.js script.

This wouldn't normally be a problem, because extension.js
is generated by the vscode-extension:esbuild, and
vscode-extension:continue-ui:build is a dependency of
vscode-extension:esbuild, implying it should always get run
first.

But, vscode-extension:esbuild is a background task, that stays
running after it's been started once. Future calls to run that
task become no-ops, because it's already active. This means running

vscode-extension:esbuild ->
  vscode-extension:continue-ui:build ->
    vscode-extension:esbuild

will lead to the last vscode-extension:esbuild not regenerating
extension.js.

In order to resolve that problem, this commit adds a new foreground
task into the build pipeline:

  vscode-extension:esbuild-notify

that tickles the watching background task to wake up and regenerate
extension.js
2024-12-10 08:56:48 -05:00

191 lines
5 KiB
JSON

{
"version": "2.0.0",
"tasks": [
{
"label": "tsc:watch",
"type": "npm",
"script": "tsc:watch",
"isBackground": true,
"problemMatcher": {
"base": "$tsc-watch",
"background": {
"activeOnStart": true,
"beginsPattern": "Starting compilation in watch mode...",
"endsPattern": "Found 0 errors"
}
},
"presentation": {
"revealProblems": "onProblem"
}
},
// Compile and bundle the extension
{
"label": "vscode-extension:build",
"dependsOn": [
// TSC type checking
"tsc:watch",
// To build the React app that is used in the extension
"vscode-extension:continue-ui:build",
// // To bundle the code the same way we do for publishing
"vscode-extension:esbuild",
// To ensure extension.js is regenerated even if
// vscode-extension:esbuild was already running in background
"vscode-extension:esbuild-notify",
// Start the React app that is used in the extension
"gui:dev"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "vscode-extension:esbuild-notify",
"dependsOn": ["vscode-extension:esbuild"],
"type": "npm",
"script": "esbuild-notify",
"path": "extensions/vscode"
},
{
"label": "vscode-extension:esbuild",
"dependsOn": ["vscode-extension:continue-ui:build"],
"type": "npm",
"script": "esbuild-watch",
"path": "extensions/vscode",
"isBackground": true,
"problemMatcher": [
{
"pattern": [
{
"regexp": "> (.*?):([0-9]+):([0-9]+): (warning|error): (.+)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
],
"background": {
"activeOnStart": true,
"beginsPattern": ">",
"endsPattern": "VS Code Extension esbuild complete"
}
}
]
},
// Build the React app. It gets bundled into the extension as a file resource and has a seprate build step
{
"label": "vscode-extension:continue-ui:build",
"type": "shell",
"command": "node",
"args": ["${workspaceFolder}/extensions/vscode/scripts/prepackage.js"],
"problemMatcher": ["$tsc"],
"presentation": {
"revealProblems": "onProblem",
"clear": true
},
"options": {
"cwd": "${workspaceFolder}/extensions/vscode"
}
},
//
// Compile and bundle tests
{
"label": "vscode-extension:tests:build",
"dependsOn": [
// Build the extension
"vscode-extension:build",
// To detect compile errors - this type checks both the extension and the tests
"tsc:watch",
"vscode-extension:tests:esbuild"
]
},
{
"label": "vscode-extension:tests:esbuild",
"type": "npm",
"script": "build-test",
"path": "extensions/vscode",
"problemMatcher": [
{
"pattern": [
{
"regexp": "> (.*?):([0-9]+):([0-9]+): (warning|error): (.+)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
]
}
]
},
//
// Install or update all dependencies for all projects in the monrepo
{
"label": "install-all-dependencies",
"type": "shell",
"windows": { "command": "./scripts/install-dependencies.ps1" },
"command": "./scripts/install-dependencies.sh",
"problemMatcher": [] // Empty so users are not prompted to select progress reporting
},
//
// Start the React App for debugging with Vite
{
"label": "gui:dev",
"type": "shell",
"command": "npm",
"options": {
"cwd": "${workspaceFolder}/gui"
},
"args": ["run", "dev"],
"isBackground": true,
"problemMatcher": [
{
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": "."
}
}
]
},
//
// esbuild for the core binary
{
"label": "binary:esbuild",
"type": "shell",
"command": "npm",
"args": ["run", "esbuild"],
"problemMatcher": [],
"options": {
"cwd": "binary"
}
},
{
"label": "docs:start",
"type": "shell",
"command": "npm",
"args": ["run", "start", "--", "--no-open"],
"problemMatcher": [],
"options": {
"cwd": "docs"
}
},
{
"label": "clean",
"type": "shell",
"command": "node",
"args": ["${workspaceFolder}/scripts/uninstall.js"],
"problemMatcher": []
}
]
}