mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 08:37:22 +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 () => {
|
const runBuild = async () => {
|
||||||
|
console.log('Running build for project:', projectId);
|
||||||
|
|
||||||
// Copy project files to runtime filesystem
|
// Copy project files to runtime filesystem
|
||||||
const projectPath = `/projects/${projectId}`;
|
const projectPath = `/projects/${projectId}`;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ export interface JSRuntimeFS {
|
|||||||
unlink(path: string): Promise<void>;
|
unlink(path: string): Promise<void>;
|
||||||
rmdir(path: string): Promise<void>;
|
rmdir(path: string): Promise<void>;
|
||||||
rename(oldPath: string, newPath: 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);
|
const stat = await this.lightningFS.stat(itemPath);
|
||||||
entries.push({
|
entries.push({
|
||||||
name: item,
|
name: item,
|
||||||
isDirectory: stat.isDirectory.bind(stat),
|
isDirectory: () => stat.isDirectory(),
|
||||||
isFile: stat.isFile.bind(stat),
|
isFile: () => stat.isFile(),
|
||||||
});
|
});
|
||||||
} catch {
|
} catch {
|
||||||
// If stat fails, assume it's a file
|
// 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> {
|
async rename(oldPath: string, newPath: string): Promise<void> {
|
||||||
return this.lightningFS.rename(oldPath, newPath);
|
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[]>;
|
||||||
async readdir(path: string, options?: { withFileTypes?: boolean }): Promise<string[] | DirectoryEntry[]> {
|
async readdir(path: string, options?: { withFileTypes?: boolean }): Promise<string[] | DirectoryEntry[]> {
|
||||||
if (options?.withFileTypes) {
|
if (options?.withFileTypes) {
|
||||||
return this.webcontainer.fs.readdir(path, { withFileTypes: true }) as Promise<DirectoryEntry[]>;
|
return this.webcontainer.fs.readdir(path, { withFileTypes: true });
|
||||||
} else {
|
} 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
|
// 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');
|
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