ren worker folder adding orig, mv new one into root

This commit is contained in:
2026-09-25 10:34:29 -04:00
parent 10f0668e32
commit 5b010039d7
1308 changed files with 44597 additions and 1511 deletions

View File

@@ -0,0 +1,43 @@
/**
* Recursive copy for scripts that must not call `cpSync`: it fails EACCES
* against a macOS docker bind mount, where the toolkit's job dirs live.
*/
import {
chmodSync,
copyFileSync,
lstatSync,
mkdirSync,
readdirSync,
readlinkSync,
rmSync,
statSync,
symlinkSync,
} from 'fs';
import { join } from 'path';
/** Copy one entry — symlink, directory or file — preserving its mode. */
export function copyPath(src: string, dest: string) {
const st = lstatSync(src);
if (st.isSymbolicLink()) {
rmSync(dest, { force: true });
symlinkSync(readlinkSync(src), dest);
return;
}
if (st.isDirectory()) {
copyTree(src, dest);
return;
}
// Unlink first: copyFileSync onto an existing file keeps that file's mode.
rmSync(dest, { force: true });
copyFileSync(src, dest);
chmodSync(dest, statSync(src).mode & 0o777);
}
/** Copy `src`'s contents into `dest`, creating `dest` if it doesn't exist. */
export function copyTree(src: string, dest: string) {
mkdirSync(dest, { recursive: true });
for (const entry of readdirSync(src, { withFileTypes: true })) {
copyPath(join(src, entry.name), join(dest, entry.name));
}
}