Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion renderers/lit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand Down
19 changes: 19 additions & 0 deletions renderers/lit/scripts/copy-spec.mjs
Original file line number Diff line number Diff line change
@@ -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);
}