Skip to content

Commit 3ac61cd

Browse files
committed
Migrate bun
1 parent 601ce42 commit 3ac61cd

6 files changed

Lines changed: 24 additions & 16 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
22
out/
33
*.vsix
4+
coverage

.vscodeignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
.gitignore
55
bun.lock
66
eslint.config.mjs
7-
out/test/**
7+
out/**/*.map
88
src/**
99
test/**
1010
tsconfig.json

AGENTS.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ activate() → ComponentLensAnalyzer.analyzeDocument()
6262
- **Linter**: oxlint (not ESLint) — run `bun run lint:fix`
6363
- **Package manager**: bun (but npm-compatible)
6464
- **Test runner**: Node.js built-in `node:test` — run `bun run test`
65-
- **Build**: Plain `tsc` (no bundler) — output to `out/`
66-
- **Publish**: `@vscode/vsce` — manual `vsce publish`
65+
- **Build**: `bun build` bundles `src/extension.ts` → single `out/extension.js` (CJS, externals: vscode + typescript)
66+
- **Type check**: `tsc` with `noEmit` — run `bun run typecheck`
67+
- **Publish**: `@vscode/vsce` — manual `vsce publish` (prepublish runs minified production build)
6768
- **Pre-commit hook**: Husky runs lint automatically
6869
- **TypeScript**: Strict mode with `noUnusedLocals` + `noUnusedParameters`
6970
- **Import style**: `node:` prefix for Node builtins, type-only imports where possible
@@ -86,11 +87,13 @@ activate() → ComponentLensAnalyzer.analyzeDocument()
8687
## COMMANDS
8788

8889
```bash
89-
bun run build # Compile TS → out/
90-
bun run watch # Watch mode
90+
bun run build # Bundle src/extension.ts → out/extension.js
91+
bun run build:production # Minified bundle, no sourcemap
92+
bun run watch # Watch mode with sourcemaps
93+
bun run typecheck # tsc type checking (no emit)
9194
bun run lint # oxlint check
9295
bun run lint:fix # oxlint auto-fix
93-
bun run test # Build + run Node.js tests
96+
bun run test # Run tests directly from TS source
9497
```
9598

9699
## NOTES

bunfig.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[test]
2+
coverage = true
3+
coverageSkipTestFiles = true
4+
# coverageThreshold = 1
5+
coverageReporter = ["text", "lcov"]

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"license": "MIT",
88
"repository": {
99
"type": "git",
10-
"url": "./"
10+
"url": "https://github.com/dev-five-git/react-component-lens"
1111
},
1212
"categories": [
1313
"Other"
@@ -26,7 +26,7 @@
2626
"onLanguage:typescriptreact",
2727
"onLanguage:javascriptreact"
2828
],
29-
"main": "./out/src/extension.js",
29+
"main": "./out/extension.js",
3030
"contributes": {
3131
"commands": [
3232
{
@@ -76,13 +76,14 @@
7676
}
7777
},
7878
"scripts": {
79-
"build": "tsc -p ./tsconfig.json",
80-
"compile": "bun run build",
81-
"watch": "tsc -watch -p ./tsconfig.json",
79+
"build": "bun build ./src/extension.ts --outdir ./out --format cjs --target node --external vscode --external typescript --sourcemap=linked",
80+
"build:production": "bun build ./src/extension.ts --outdir ./out --format cjs --target node --external vscode --external typescript --minify",
81+
"watch": "bun build ./src/extension.ts --outdir ./out --format cjs --target node --external vscode --external typescript --sourcemap=linked --watch",
82+
"typecheck": "tsc -p ./tsconfig.json",
8283
"lint": "oxlint .",
8384
"lint:fix": "oxlint . --fix",
84-
"test": "bun run build && node --test out/test/analyzer.test.js",
85-
"vscode:prepublish": "bun run build",
85+
"test": "bun test",
86+
"vscode:prepublish": "bun run build:production",
8687
"prepare": "husky"
8788
},
8889
"dependencies": {

tsconfig.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
"lib": [
77
"ES2022"
88
],
9-
"outDir": "out",
10-
"rootDir": ".",
11-
"sourceMap": true,
9+
"noEmit": true,
1210
"strict": true,
1311
"noImplicitOverride": true,
1412
"noUnusedLocals": true,

0 commit comments

Comments
 (0)