Skip to content

Commit e70a28b

Browse files
committed
Use bun instead of npm for auto-update
OpenCode uses bun to manage plugin dependencies in its cache directory, so the auto-update should use bun as well. This also removes the unnecessary lock file deletion code that was added as a workaround for npm issues.
1 parent ed30f46 commit e70a28b

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

lib/version-checker.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,11 @@ export async function performUpdate(targetVersion: string, logger?: { info: (com
5858

5959
logger?.info("version", "Starting auto-update", { targetVersion, cacheDir })
6060

61-
try {
62-
const { rmSync, existsSync } = await import('fs')
63-
const lockFile = join(cacheDir, 'node_modules', '.package-lock.json')
64-
if (existsSync(lockFile)) {
65-
rmSync(lockFile, { force: true })
66-
logger?.info("version", "Removed package-lock.json to force fresh resolution")
67-
}
68-
} catch (err) {
69-
logger?.info("version", "Could not remove lock file", { error: (err as Error).message })
70-
}
71-
7261
return new Promise((resolve) => {
7362
let resolved = false
7463

75-
const proc = spawn('npm', ['install', '--legacy-peer-deps', packageSpec], {
64+
// Use bun since opencode uses bun to manage its plugin dependencies
65+
const proc = spawn('bun', ['add', packageSpec], {
7666
cwd: cacheDir,
7767
stdio: 'pipe'
7868
})

0 commit comments

Comments
 (0)