Implement RPC contract validation baseline

This commit is contained in:
2026-05-14 15:41:51 -04:00
parent 379c07b50c
commit df367756d0
60 changed files with 10704 additions and 47 deletions

38
scripts/copy-packages.mjs Executable file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env node
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url));
const rootDir = join(__dirname, "..");
// Package configs to copy and transform
const packages = [
{ name: "contracts", src: "packages/contracts/package.json" },
{ name: "shared", src: "packages/shared/package.json" },
];
for (const pkg of packages) {
const srcPath = join(rootDir, pkg.src);
const destDir = join(rootDir, "dist-electron", "packages", pkg.name);
const destPath = join(destDir, "package.json");
mkdirSync(destDir, { recursive: true });
const pkgJson = JSON.parse(readFileSync(srcPath, "utf-8"));
// Transform exports to use .js instead of .ts for import
if (pkgJson.exports) {
for (const [key, value] of Object.entries(pkgJson.exports)) {
if (value?.import && typeof value.import === "string") {
value.import = value.import.replace(/\.ts$/, ".js");
}
}
}
writeFileSync(destPath, JSON.stringify(pkgJson, null, 2));
console.log(`[copy-packages] Copied and transformed ${pkg.name}/package.json`);
}
console.log("[copy-packages] Done!");