mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-04 03:37:17 +00:00
core: fix dependency installation failures behind corporate proxies or in CI by disabling Bun cache when network interception is detected
This commit is contained in:
@@ -34,6 +34,8 @@ import { Account } from "@/account"
|
|||||||
import { ConfigPaths } from "./paths"
|
import { ConfigPaths } from "./paths"
|
||||||
import { Filesystem } from "@/util/filesystem"
|
import { Filesystem } from "@/util/filesystem"
|
||||||
import { Npm } from "@/npm"
|
import { Npm } from "@/npm"
|
||||||
|
import { BunProc } from "@/bun"
|
||||||
|
import { proxied } from "@/util/proxied"
|
||||||
|
|
||||||
export namespace Config {
|
export namespace Config {
|
||||||
const ModelId = z.string().meta({ $ref: "https://models.dev/model-schema.json#/$defs/Model" })
|
const ModelId = z.string().meta({ $ref: "https://models.dev/model-schema.json#/$defs/Model" })
|
||||||
@@ -287,7 +289,14 @@ export namespace Config {
|
|||||||
|
|
||||||
// Install any additional dependencies defined in the package.json
|
// Install any additional dependencies defined in the package.json
|
||||||
// This allows local plugins and custom tools to use external packages
|
// This allows local plugins and custom tools to use external packages
|
||||||
await Npm.install(dir).catch((err) => {
|
await BunProc.run(
|
||||||
|
[
|
||||||
|
"install",
|
||||||
|
// TODO: get rid of this case (see: https://github.com/oven-sh/bun/issues/19936)
|
||||||
|
...(proxied() || process.env.CI ? ["--no-cache"] : []),
|
||||||
|
],
|
||||||
|
{ cwd: dir },
|
||||||
|
).catch((err) => {
|
||||||
log.warn("failed to install dependencies", { dir, error: err })
|
log.warn("failed to install dependencies", { dir, error: err })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user