Prechádzať zdrojové kódy

refactor: replace Bun.write with Filesystem.write in config files

Dax Raad 5 mesiacov pred
rodič
commit
dad248832d

+ 3 - 1
packages/opencode/src/config/config.ts

@@ -1240,7 +1240,7 @@ export namespace Config {
       if (!parsed.data.$schema && isFile) {
         parsed.data.$schema = "https://opencode.ai/config.json"
         const updated = original.replace(/^\s*\{/, '{\n  "$schema": "https://opencode.ai/config.json",')
-        await Bun.write(options.path, updated).catch(() => {})
+        await Filesystem.write(options.path, updated).catch(() => {})
       }
       const data = parsed.data
       if (data.plugin && isFile) {
@@ -1401,3 +1401,5 @@ export namespace Config {
     return state().then((x) => x.directories)
   }
 }
+Filesystem.write
+Filesystem.write

+ 3 - 3
packages/opencode/src/config/migrate-tui-config.ts

@@ -70,7 +70,7 @@ export async function migrateTuiConfig(input: MigrateInput) {
     if (extracted.keybinds !== undefined) payload.keybinds = extracted.keybinds
     if (tui) Object.assign(payload, tui)
 
-    const wrote = await Bun.write(target, JSON.stringify(payload, null, 2))
+    const wrote = await Filesystem.write(target, JSON.stringify(payload, null, 2))
       .then(() => true)
       .catch((error) => {
         log.warn("failed to write tui migration target", { from: file, to: target, error })
@@ -104,7 +104,7 @@ async function backupAndStripLegacy(file: string, source: string) {
   const hasBackup = await Filesystem.exists(backup)
   const backed = hasBackup
     ? true
-    : await Bun.write(backup, source)
+    : await Filesystem.write(backup, source)
         .then(() => true)
         .catch((error) => {
           log.warn("failed to backup source config during tui migration", { path: file, backup, error })
@@ -123,7 +123,7 @@ async function backupAndStripLegacy(file: string, source: string) {
     return applyEdits(acc, edits)
   }, source)
 
-  return Bun.write(file, text)
+  return Filesystem.write(file, text)
     .then(() => {
       log.info("stripped tui keys from server config", { path: file, backup })
       return true