Skip to content

Commit cba244c

Browse files
author
Max
committed
fix: update preLaunchTask to use build instead of watch and revise development instructions
1 parent c83c1fe commit cba244c

5 files changed

Lines changed: 37 additions & 75 deletions

File tree

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"outFiles": [
1212
"${workspaceFolder}/dist/**/*.js"
1313
],
14-
"preLaunchTask": "watch"
14+
"preLaunchTask": "build"
1515
}
1616
]
1717
}

.vscode/tasks.json

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,15 @@
22
"version": "2.0.0",
33
"tasks": [
44
{
5-
"label": "watch",
5+
"label": "build",
66
"type": "shell",
7-
"command": "bun build.ts --watch",
8-
"isBackground": true,
9-
"presentation": {
10-
"reveal": "silent"
11-
},
7+
"command": "bun build.ts",
128
"group": {
139
"kind": "build",
1410
"isDefault": true
1511
},
16-
"problemMatcher": {
17-
"pattern": {
18-
"regexp": "^(.*):(\\d+):(\\d+):\\s+(error|warning):\\s+(.*)$",
19-
"file": 1,
20-
"line": 2,
21-
"column": 3,
22-
"severity": 4,
23-
"message": 5
24-
},
25-
"background": {
26-
"activeOnStart": true,
27-
"beginsPattern": "rebuilding",
28-
"endsPattern": "Build succeeded"
29-
}
12+
"presentation": {
13+
"reveal": "silent"
3014
}
3115
}
3216
]

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,8 @@ Press `Cmd+Shift+P` (Mac) or `Ctrl+Shift+P` (Windows/Linux) and type "Git Palett
6969
## 🛠️ Development
7070

7171
1. Open this project in VS Code
72-
2. Press `F5` to launch the Extension Development Host (this starts the watch task automatically)
73-
3. Edit code → save → the watch task rebuilds `dist/` automatically
74-
4. Reload the dev host window to pick up changes:
75-
- Press `Cmd+Shift+P` → "Developer: Reload Window"
76-
- Or click the green restart button in the debug toolbar
77-
78-
> **Note:** VS Code extensions don't hot-reload. A window reload is always required after code changes.
72+
2. Press `F5` to build and launch the Extension Development Host
73+
3. Edit code → save → press `F5` again to rebuild and relaunch
7974

8075
## 🤝 Contributing
8176

build.ts

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,19 @@
1-
import { watch } from "fs";
2-
import { join } from "path";
3-
4-
const isWatch = process.argv.includes("--watch");
5-
6-
async function build() {
7-
const result = await Bun.build({
8-
entrypoints: ['./src/extension.ts'],
9-
outdir: './dist',
10-
minify: !isWatch,
11-
format: 'cjs',
12-
sourcemap: 'linked',
13-
external: ['vscode'],
14-
target: 'node',
15-
});
16-
1+
const result = Bun.build({
2+
entrypoints: ['./src/extension.ts'],
3+
outdir: './dist',
4+
minify: true,
5+
format: 'cjs',
6+
sourcemap: 'linked',
7+
external: ['vscode'],
8+
target: 'node',
9+
}).then((result) => {
1710
if (!result.success) {
1811
console.error("Build failed:");
1912
for (const log of result.logs) {
2013
console.error(log);
2114
}
15+
process.exit(1);
2216
} else {
2317
console.log("Build succeeded");
2418
}
25-
}
26-
27-
await build();
28-
29-
if (isWatch) {
30-
console.log("Watching src/ for changes...");
31-
watch(join(import.meta.dir, "src"), { recursive: true }, async (event, filename) => {
32-
console.log(`\n[${event}] ${filename} — rebuilding...`);
33-
await build();
34-
});
35-
}
19+
});

package.json

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,32 @@
1010
"type": "git",
1111
"url": "https://github.com/yourusername/git-palette"
1212
},
13+
"main": "./dist/extension.js",
1314
"engines": {
1415
"vscode": "^1.125.0"
1516
},
1617
"categories": [
1718
"SCM Providers",
1819
"Other"
1920
],
20-
"main": "./dist/extension.js",
21+
"scripts": {
22+
"vscode:prepublish": "bun run build",
23+
"build": "tsc --noEmit && bun build.ts",
24+
"package": "bunx @vscode/vsce package",
25+
"publish": "bunx @vscode/vsce publish",
26+
"clean": "rm -rf dist *.vsix",
27+
"type-check": "tsc --noEmit"
28+
},
29+
"dependencies": {
30+
"fuzzysort": "^3.1.0"
31+
},
32+
"devDependencies": {
33+
"@types/bun": "^1.3.14",
34+
"@types/node": "^26.1.1",
35+
"@types/vscode": "^1.125.0",
36+
"@vscode/vsce": "^3.9.2",
37+
"typescript": "^7.0.2"
38+
},
2139
"contributes": {
2240
"configuration": {
2341
"title": "Git Palette",
@@ -125,24 +143,5 @@
125143
}
126144
]
127145
}
128-
},
129-
"scripts": {
130-
"vscode:prepublish": "bun run build",
131-
"build": "tsc --noEmit && bun build.ts",
132-
"watch": "bun build.ts --watch",
133-
"package": "bunx @vscode/vsce package",
134-
"publish": "bunx @vscode/vsce publish",
135-
"clean": "rm -rf dist *.vsix",
136-
"type-check": "tsc --noEmit"
137-
},
138-
"dependencies": {
139-
"fuzzysort": "^3.1.0"
140-
},
141-
"devDependencies": {
142-
"@types/bun": "^1.3.14",
143-
"@types/node": "^26.1.1",
144-
"@types/vscode": "^1.125.0",
145-
"@vscode/vsce": "^3.9.2",
146-
"typescript": "^7.0.2"
147146
}
148147
}

0 commit comments

Comments
 (0)