import { expandGlob } from "https://deno.land/std@0.100.0/fs/mod.ts";

export async function convert() {
  for await (const file of expandGlob('**/*.ts')) {
    const code = await Deno.readTextFile(file.path);
    await Deno.writeTextFile(
      file.path,
      //code.replaceAll(`/// <reference path="`, `/// <reference path="./`)
      code.replace(/\/\/\/\s*<reference\s*path="([^"]+)"\s*\/>/g, '/// <reference path="./$1" />\n// @deno-types="./$1"')
    );
  }
}