mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 08:23:34 +00:00
Add missing FS methods needed by isomorphic-git
This commit is contained in:
4 files changed
+26
-4
No files matched your search
@@ -45,6 +45,8 @@ export function ChatPane({ projectId, projectName }: ChatPaneProps) {
|
||||
};
|
||||
|
||||
const runBuild = async () => {
|
||||
console.log('Running build for project:', projectId);
|
||||
|
||||
// Copy project files to runtime filesystem
|
||||
const projectPath = `/projects/${projectId}`;
|
||||
try {
|
||||
|
||||
@@ -45,6 +45,8 @@ export interface JSRuntimeFS {
|
||||
unlink(path: string): Promise<void>;
|
||||
rmdir(path: string): Promise<void>;
|
||||
rename(oldPath: string, newPath: string): Promise<void>;
|
||||
readlink(path: string): Promise<string>;
|
||||
symlink(target: string, path: string): Promise<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,8 +35,8 @@ export class LightningFSAdapter implements JSRuntimeFS {
|
||||
const stat = await this.lightningFS.stat(itemPath);
|
||||
entries.push({
|
||||
name: item,
|
||||
isDirectory: stat.isDirectory.bind(stat),
|
||||
isFile: stat.isFile.bind(stat),
|
||||
isDirectory: () => stat.isDirectory(),
|
||||
isFile: () => stat.isFile(),
|
||||
});
|
||||
} catch {
|
||||
// If stat fails, assume it's a file
|
||||
@@ -102,4 +102,12 @@ export class LightningFSAdapter implements JSRuntimeFS {
|
||||
async rename(oldPath: string, newPath: string): Promise<void> {
|
||||
return this.lightningFS.rename(oldPath, newPath);
|
||||
}
|
||||
|
||||
async readlink(path: string): Promise<string> {
|
||||
return this.lightningFS.readlink(path);
|
||||
}
|
||||
|
||||
async symlink(target: string, path: string): Promise<void> {
|
||||
return this.lightningFS.symlink(target, path);
|
||||
}
|
||||
}
|
||||
@@ -77,9 +77,9 @@ class WebContainerFSAdapter implements JSRuntimeFS {
|
||||
async readdir(path: string, options?: { withFileTypes?: boolean }): Promise<string[] | DirectoryEntry[]>;
|
||||
async readdir(path: string, options?: { withFileTypes?: boolean }): Promise<string[] | DirectoryEntry[]> {
|
||||
if (options?.withFileTypes) {
|
||||
return this.webcontainer.fs.readdir(path, { withFileTypes: true }) as Promise<DirectoryEntry[]>;
|
||||
return this.webcontainer.fs.readdir(path, { withFileTypes: true });
|
||||
} else {
|
||||
return this.webcontainer.fs.readdir(path) as Promise<string[]>;
|
||||
return this.webcontainer.fs.readdir(path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,4 +156,14 @@ class WebContainerFSAdapter implements JSRuntimeFS {
|
||||
// Note: We can't delete the old file since WebContainer doesn't expose unlink
|
||||
console.warn('WebContainer rename: copied file but could not delete original');
|
||||
}
|
||||
|
||||
async readlink(_path: string): Promise<string> {
|
||||
// WebContainer doesn't support symlinks, so we'll throw an error
|
||||
throw new Error('readlink operation not supported in WebContainer');
|
||||
}
|
||||
|
||||
async symlink(_target: string, _path: string): Promise<void> {
|
||||
// WebContainer doesn't support symlinks, so we'll throw an error
|
||||
throw new Error('symlink operation not supported in WebContainer');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user