Make CI run cross-platform (#295)

This commit is contained in:
Will Chen
2025-06-03 13:04:16 -07:00
committed by GitHub
parent 83eb721323
commit 7235eab227
16 changed files with 149 additions and 59 deletions

View File

@@ -39,13 +39,19 @@ export async function copyDirectoryRecursive(
) {
await fsPromises.mkdir(destination, { recursive: true });
const entries = await fsPromises.readdir(source, { withFileTypes: true });
// Why do we sort? This ensures stable ordering of files across platforms
// which is helpful for tests (and has no practical downsides).
entries.sort();
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);
// Exclude node_modules directories
if (entry.name !== "node_modules") {
await copyDirectoryRecursive(srcPath, destPath);
}
} else {
await fsPromises.copyFile(srcPath, destPath);
}