2021-04-13 17:47:41 +00:00
|
|
|
import fs from "fs";
|
|
|
|
import mkdirp from "mkdirp";
|
|
|
|
|
|
|
|
const protocols = fs.readdirSync("./protocols");
|
|
|
|
|
2021-04-27 16:04:57 +00:00
|
|
|
const protocolInfo = protocols.map((protocol) => fs.readFileSync(`./protocols/${protocol}/index.json`, "utf8"));
|
2021-04-13 17:47:41 +00:00
|
|
|
|
|
|
|
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";
|
2021-04-27 16:04:57 +00:00
|
|
|
export {
|
|
|
|
Protocol
|
|
|
|
}
|
2021-04-16 23:09:56 +00:00
|
|
|
|
|
|
|
export default [${protocolInfo.toString()}] as Protocol[];
|
2021-04-27 16:04:57 +00:00
|
|
|
`,
|
2021-04-13 17:47:41 +00:00
|
|
|
);
|