From 4ba9f26237d03e688dd267c5eed2f065dd2f9107 Mon Sep 17 00:00:00 2001 From: RobinsonBeato Date: Mon, 22 Dec 2025 07:14:58 -0300 Subject: [PATCH] Make copy-spec cross-platform for Lit renderer --- renderers/lit/package.json | 2 +- renderers/lit/scripts/copy-spec.mjs | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 renderers/lit/scripts/copy-spec.mjs diff --git a/renderers/lit/package.json b/renderers/lit/package.json index 6cc360cb..0568cc35 100644 --- a/renderers/lit/package.json +++ b/renderers/lit/package.json @@ -30,7 +30,7 @@ }, "wireit": { "copy-spec": { - "command": "mkdir -p src/0.8/schemas && cp ../../specification/0.8/json/*.json src/0.8/schemas", + "command": "node scripts/copy-spec.mjs", "files": [ "../../specification/0.8/json/*.json" ], diff --git a/renderers/lit/scripts/copy-spec.mjs b/renderers/lit/scripts/copy-spec.mjs new file mode 100644 index 00000000..6f423b9c --- /dev/null +++ b/renderers/lit/scripts/copy-spec.mjs @@ -0,0 +1,19 @@ +import { mkdir, readdir, copyFile } from "node:fs/promises"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const rootDir = path.resolve(__dirname, ".."); +const sourceDir = path.resolve(rootDir, "..", "..", "specification", "0.8", "json"); +const destDir = path.resolve(rootDir, "src", "0.8", "schemas"); + +await mkdir(destDir, { recursive: true }); + +const entries = await readdir(sourceDir, { withFileTypes: true }); +const jsonFiles = entries.filter((entry) => entry.isFile() && entry.name.endsWith(".json")); + +for (const file of jsonFiles) { + const sourcePath = path.join(sourceDir, file.name); + const destPath = path.join(destDir, file.name); + await copyFile(sourcePath, destPath); +}