mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-10-28 07:37:36 +09:00
21 lines
717 B
JavaScript
21 lines
717 B
JavaScript
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}`);
|
|
}
|