#!/usr/bin/env node /** Sync portable characterSheet module into dnd_player (meta_builder). */ import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const src = path.resolve(__dirname, '../app/shared'); const dest = path.resolve(__dirname, '../../dnd_player/app/shared/characterSheet'); fs.mkdirSync(dest, { recursive: true }); for (const file of fs.readdirSync(src)) { if (!file.endsWith('.ts')) continue; let text = fs.readFileSync(path.join(src, file), 'utf8'); text = text.replace(/from '\.\/([^']+)\.ts'/g, "from './$1'"); fs.writeFileSync(path.join(dest, file), text); console.log('synced', file); }