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

23 lines
721 B
TypeScript
Raw Permalink Normal View History

import fs from "fs";
import mkdirp from "mkdirp";
2021-06-10 12:58:04 +00:00
import protocolsInfo from "../protocolsInfoForScreener.json";
const protocols = fs.readdirSync("./protocols");
2021-04-22 11:12:54 +00:00
const protocolInfo = protocols
.filter((protocol) => protocol !== "__example")
.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
`
2021-06-10 12:58:04 +00:00
import { Protocol, ProtocolForScreeener } from "../types";
2021-04-16 23:09:56 +00:00
export default [${protocolInfo.toString()}] as Protocol[];
2021-06-10 12:58:04 +00:00
const protocolsInfoForScreener: Record<string, ProtocolForScreeener> = ${JSON.stringify(protocolsInfo)};
export {protocolsInfoForScreener};
2021-04-27 16:04:57 +00:00
`,
);