chore: 初始化 BlockFlow Workbench 仓库
建立前端与 Tauri 桌面端的首个版本提交,包含核心编辑器、项目文件读写、测试与构建配置。 补充 Git 忽略规则和换行规范,排除依赖、构建产物、本地运行日志与临时验证文件,方便在其他电脑继续开发。
This commit is contained in:
22
src/project/fileSystem.ts
Normal file
22
src/project/fileSystem.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export type DirectoryEntry = {
|
||||
name: string
|
||||
path: string
|
||||
type: "file" | "directory"
|
||||
}
|
||||
|
||||
export type ProjectFileSystem = {
|
||||
readText(filePath: string): Promise<string>
|
||||
writeText(filePath: string, content: string): Promise<void>
|
||||
mkdir(dirPath: string): Promise<void>
|
||||
readdir(dirPath: string): Promise<DirectoryEntry[]>
|
||||
exists(filePath: string): Promise<boolean>
|
||||
stat(filePath: string): Promise<{ type: "file" | "directory" }>
|
||||
}
|
||||
|
||||
export function requireProjectFileSystem(fs: ProjectFileSystem | undefined): ProjectFileSystem {
|
||||
if (fs === undefined) {
|
||||
throw new Error("A ProjectFileSystem adapter is required.")
|
||||
}
|
||||
|
||||
return fs
|
||||
}
|
||||
Reference in New Issue
Block a user