Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

717 B
Raw Blame
import { copyFile, readFile, writeFile } from "node:fs/promises";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";

const packageDir = dirname(dirname(fileURLToPath(import.meta.url)));
const repoRoot = resolve(packageDir, "../..");
const typesDir = resolve(packageDir, "lib/types");
const indexPath = resolve(typesDir, "index.d.ts");

await copyFile(
  resolve(repoRoot, "@types/css-tree.d.ts"),
  resolve(typesDir, "css-tree.d.ts")
);

const cssTreeImport = 'import type {} from "./css-tree";\n';
const indexContent = await readFile(indexPath, "utf8");

if (indexContent.startsWith(cssTreeImport) === false) {
  await writeFile(indexPath, `${cssTreeImport}${indexContent}`);
}