GeezerVison is showing github.com — refactor: migrate src/storage/db.ts from Bun.file() to statSync (#14124) · widomin/opencode@a8347c3
File tree
Expand file treeCollapse file tree
Open diff view settings
.opencode/skill/bun-file-io packages/opencode/src/storage
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: .opencode/skill/bun-file-io/SKILL.md -42Lines changed: 0 additions & 42 deletions Collapse file
Copy file name to clipboardExpand all lines: packages/opencode/src/storage/db.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -10,7 +10,7 @@ import { Log } from "../util/log" |
10 | 10 | import { NamedError } from "@opencode-ai/util/error" |
11 | 11 | import z from "zod" |
12 | 12 | import path from "path" |
13 | | -import { readFileSync, readdirSync } from "fs" |
| 13 | +import { readFileSync, readdirSync, existsSync } from "fs" |
14 | 14 | import * as schema from "./schema" |
15 | 15 |
|
16 | 16 | declare const OPENCODE_MIGRATIONS: { sql: string; timestamp: number }[] | undefined |
@@ -54,7 +54,7 @@ export namespace Database { |
54 | 54 | const sql = dirs |
55 | 55 | .map((name) => { |
56 | 56 | const file = path.join(dir, name, "migration.sql") |
57 | | - if (!Bun.file(file).size) return |
| 57 | + if (!existsSync(file)) return |
58 | 58 | return { |
59 | 59 | sql: readFileSync(file, "utf-8"), |
60 | 60 | timestamp: time(name), |
|