export async function initFabric() {
  const fabricHost = "https://meta.fabricmc.net/v2";

  const gameVersionSlug = "/versions/game";
  const loaderVersionSlug = "/versions/loader";
  const installerVersionSlug = "/versions/installer";
  const versionSlugs = [
    gameVersionSlug,
    loaderVersionSlug,
    installerVersionSlug,
  ];

  for (const slug of versionSlugs) {
    const uri = fabricHost + slug;

    const req = await fetch(uri);
    const text = await req.text();

    const path = `./fabric/${slug}.json`;

    await Deno.mkdir(path.split("/").slice(0, -1).join("/"), {
      recursive: true,
    });

    await Deno.writeTextFile(path, text, { create: true });
  }
}
