16 lines
523 B
TypeScript
16 lines
523 B
TypeScript
import fs from "fs";
|
|
import path from "path";
|
|
import CID from "cids";
|
|
|
|
import { DeclCalculator } from "./utils";
|
|
import { ipfsCids } from "./constants";
|
|
|
|
const convertCIDToV1 = (cidV0: string) => `"${new CID(cidV0).toV1().toString()}"`;
|
|
|
|
const { calculateDecl } = new DeclCalculator("const", "", convertCIDToV1, (name: string) => name + "IpfsCid");
|
|
const typescriptCode = Object.entries(ipfsCids)
|
|
.map((e) => calculateDecl(e))
|
|
.join("");
|
|
|
|
fs.writeFileSync(path.join(".", "data", "ipfsV1CIDs.txt"), typescriptCode);
|