Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/bombshell-dev/playground.
Something went wrong. Try again.
682 B · 16 lines
TypeScript
1234567891011121314151617import { readdir, readFile, writeFile } from 'node:fs/promises';// oxlint-disable-next-line no-restricted-imports -- path module needed for path resolutionimport { join } from 'node:path';
async function rewrite(directory: string): Promise<void> { for (const entry of await readdir(directory, { withFileTypes: true })) { const path = join(directory, entry.name); if (entry.isDirectory()) await rewrite(path); else if (entry.name.endsWith('.d.ts')) { const source = await readFile(path, 'utf8'); await writeFile(path, source.replace(/(from\s+["'][.]{1,2}\/[^"']+)\.ts(["'])/g, '$1.js$2')); } }}
await rewrite(new URL('../dist/types', import.meta.url).pathname);