boardroom-inc-protocol-Info/scripts/build.ts

20 lines
442 B
TypeScript
Raw Normal View History

import fs from "fs";
import mkdirp from "mkdirp";
const protocols = fs.readdirSync("./protocols");
const protocolInfo = protocols.map((protocol) =>
fs.readFileSync(`./protocols/${protocol}/index.json`, "utf8")
);
mkdirp.sync("./dist");
fs.copyFileSync("./types.ts", "./dist/types.ts");
fs.writeFileSync(
"./dist/index.ts",
2021-04-16 23:09:56 +00:00
`
import { Protocol } from "../types";
export default [${protocolInfo.toString()}] as Protocol[];
`
);