chore(sandbox): sandbox cleanup (#797)

Co-authored-by: Christian Pillsbury <cpillsbury@mux.com>
This commit is contained in:
Sam Potts
2026-03-11 14:02:12 +11:00
committed by GitHub
co-authored by Christian Pillsbury
parent f168256848
commit 6d044e3c0f
70 changed files with 383 additions and 278 deletions
+27
View File
@@ -0,0 +1,27 @@
import { copyFileSync, existsSync, mkdirSync, readdirSync, statSync } from 'node:fs';
import { resolve } from 'node:path';
const root = resolve(import.meta.dirname, '..');
const templatesDir = resolve(root, 'templates');
const srcDir = resolve(root, 'src');
/** Recursively copy template files into `src/`, preserving relative paths. */
function mirror(dir: string) {
for (const entry of readdirSync(dir)) {
const templatePath = resolve(dir, entry);
const targetPath = resolve(srcDir, templatePath.slice(templatesDir.length + 1));
if (statSync(templatePath).isDirectory()) {
mkdirSync(targetPath, { recursive: true });
mirror(templatePath);
continue;
}
if (!existsSync(targetPath)) {
copyFileSync(templatePath, targetPath);
console.log(`Created ${targetPath.slice(root.length + 1)}`);
}
}
}
mirror(templatesDir);