mirror of
https://github.com/cline/cline.git
synced 2026-09-19 10:13:34 +08:00
* Move all vscode related files to /apps/vscode * Fix launch and biome * Ignore generated files * Remove unused icons * fix tsconfig * Update workflows (#10962) * Add default branch * Move files to the right dir * fix: add vscode publish README placeholder --------- Co-authored-by: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com>
28 lines
739 B
JavaScript
28 lines
739 B
JavaScript
import * as fs from "fs/promises"
|
|
import * as path from "path"
|
|
/**
|
|
* Write `contents` to `filePath`, creating any necessary directories in `filePath`.
|
|
*/
|
|
export async function writeFileWithMkdirs(filePath, content) {
|
|
await fs.mkdir(path.dirname(filePath), { recursive: true })
|
|
await fs.writeFile(filePath, content)
|
|
}
|
|
|
|
export async function rmrf(path) {
|
|
await fs.rm(path, { force: true, recursive: true })
|
|
}
|
|
|
|
/**
|
|
* Remove an empty dir, do nothing if the directory doesn't exist or is not empty.
|
|
*/
|
|
export async function rmdir(path) {
|
|
try {
|
|
await fs.rmdir(path)
|
|
} catch (error) {
|
|
if (error.code !== "ENOTEMPTY" && error.code !== "ENOENT") {
|
|
// Only re-throw if it's not "not empty" or "doesn't exist"
|
|
throw error
|
|
}
|
|
}
|
|
}
|