mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 08:37:22 +00:00
baseline style v2
This commit is contained in:
1 parent
03109e63b5
commit
f58bc266d6
7 files changed
+799
-163
No files matched your search
@@ -179,6 +179,37 @@ export class ProjectsManager {
|
||||
}
|
||||
}
|
||||
|
||||
async deleteProject(projectId: string): Promise<void> {
|
||||
const projectPath = `${this.dir}/${projectId}`;
|
||||
|
||||
// Recursively delete the project directory
|
||||
await this.deleteDirectory(projectPath);
|
||||
}
|
||||
|
||||
private async deleteDirectory(dirPath: string): Promise<void> {
|
||||
try {
|
||||
const files = await this.fs.readdir(dirPath);
|
||||
|
||||
for (const file of files) {
|
||||
const fullPath = `${dirPath}/${file}`;
|
||||
const stat = await this.fs.stat(fullPath);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
await this.deleteDirectory(fullPath);
|
||||
} else {
|
||||
await this.fs.unlink(fullPath);
|
||||
}
|
||||
}
|
||||
|
||||
await this.fs.rmdir(dirPath);
|
||||
} catch (error) {
|
||||
const fsError = error as NodeJS.ErrnoException;
|
||||
if (fsError.code !== 'ENOENT') {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private generateProjectId(name: string): string {
|
||||
const timestamp = Date.now().toString(36);
|
||||
const slug = name
|
||||
|
||||
Reference in new issue
Block a user