Robust app folder rename (#200)

Fixes #89
This commit is contained in:
Will Chen
2025-05-19 14:59:55 -07:00
committed by GitHub
parent cbfe26bac1
commit 68cb6b3d7d
2 changed files with 35 additions and 29 deletions

View File

@@ -1,6 +1,5 @@
import fs from "node:fs";
import path from "node:path";
import { promises as fsPromises } from "node:fs";
/**
* Recursively gets all files in a directory, excluding node_modules and .git
@@ -32,22 +31,3 @@ export function getFilesRecursively(dir: string, baseDir: string): string[] {
return files;
}
export async function copyDirectoryRecursive(
source: string,
destination: string,
) {
await fsPromises.mkdir(destination, { recursive: true });
const entries = await fsPromises.readdir(source, { withFileTypes: true });
for (const entry of entries) {
const srcPath = path.join(source, entry.name);
const destPath = path.join(destination, entry.name);
if (entry.isDirectory()) {
await copyDirectoryRecursive(srcPath, destPath);
} else {
await fsPromises.copyFile(srcPath, destPath);
}
}
}