Add build step

This commit is contained in:
sudheer 2021-06-10 18:28:04 +05:30
parent ea2229737a
commit 3c450e6301
No known key found for this signature in database
GPG Key ID: ADFACBFA5A788D12
2 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import fs from "fs";
import mkdirp from "mkdirp";
import protocolsInfo from "../protocolsInfoForScreener.json";
const protocols = fs.readdirSync("./protocols");
@ -12,8 +13,10 @@ fs.copyFileSync("./types.ts", "./dist/types.ts");
fs.writeFileSync(
"./dist/index.ts",
`
import { Protocol } from "../types";
import { Protocol, ProtocolForScreeener } from "../types";
export default [${protocolInfo.toString()}] as Protocol[];
const protocolsInfoForScreener: Record<string, ProtocolForScreeener> = ${JSON.stringify(protocolsInfo)};
export {protocolsInfoForScreener};
`,
);

View File

@ -44,4 +44,11 @@ export const ProtocolIo = t.type({
treasuryAddresses: t.union([t.array(t.string), t.undefined]),
});
export const ProtocolForScreeenerIo = t.type({
name: t.string,
treasuryAddresses: t.array(t.string),
});
export type ProtocolForScreeener = t.TypeOf<typeof ProtocolForScreeenerIo>;
export type Protocol = t.TypeOf<typeof ProtocolIo>;