mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 14:22:27 +00:00
refactor: migrate from Bun.Glob to npm glob package
Replace Bun.Glob usage with a new Glob utility wrapper around the npm 'glob' package. This moves us off Bun-specific APIs toward standard Node.js compatible solutions. Changes: - Add new src/util/glob.ts utility module with scan(), scanSync(), and match() - Default include option is 'file' (only returns files, not directories) - Add symlink option (default: false) to control symlink following - Migrate all 12 files using Bun.Glob to use the new Glob utility - Add comprehensive tests for the glob utility Breaking changes: - Removed support for include: 'dir' option (use include: 'all' and filter manually) - symlink now defaults to false (was true in most Bun.Glob usages) Files migrated: - src/util/log.ts - src/util/filesystem.ts - src/tool/truncation.ts - src/session/instruction.ts - src/storage/json-migration.ts - src/storage/storage.ts - src/project/project.ts - src/cli/cmd/tui/context/theme.tsx - src/config/config.ts - src/tool/registry.ts - src/skill/skill.ts - src/file/ignore.ts
This commit is contained in:
@@ -3,6 +3,7 @@ import path from "path"
|
||||
import { createEffect, createMemo, onMount } from "solid-js"
|
||||
import { useSync } from "@tui/context/sync"
|
||||
import { createSimpleContext } from "./helper"
|
||||
import { Glob } from "../../../../util/glob"
|
||||
import aura from "./theme/aura.json" with { type: "json" }
|
||||
import ayu from "./theme/ayu.json" with { type: "json" }
|
||||
import catppuccin from "./theme/catppuccin.json" with { type: "json" }
|
||||
@@ -391,7 +392,6 @@ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
|
||||
},
|
||||
})
|
||||
|
||||
const CUSTOM_THEME_GLOB = new Bun.Glob("themes/*.json")
|
||||
async function getCustomThemes() {
|
||||
const directories = [
|
||||
Global.Path.config,
|
||||
@@ -405,11 +405,10 @@ async function getCustomThemes() {
|
||||
|
||||
const result: Record<string, ThemeJson> = {}
|
||||
for (const dir of directories) {
|
||||
for await (const item of CUSTOM_THEME_GLOB.scan({
|
||||
absolute: true,
|
||||
followSymlinks: true,
|
||||
dot: true,
|
||||
for (const item of await Glob.scan("themes/*.json", {
|
||||
cwd: dir,
|
||||
absolute: true,
|
||||
dot: true,
|
||||
})) {
|
||||
const name = path.basename(item, ".json")
|
||||
result[name] = await Filesystem.readJson(item)
|
||||
|
||||
Reference in New Issue
Block a user