proposal-29-update-ipfs/scripts/calculateIpfsV1Cids.ts

22 lines
835 B
TypeScript

import fs from "fs";
import path from "path";
import CID from "cids";
import { DeclCalculator } from "./utils";
const classicUiIPFSHash = "QmX2mqjsZYaZGoLHCBFX9QpV38jFtU5eNDUR3M7a7fzRY9";
const novaUiIPFSHash = "QmVS4SPsH44oJPCffUZZUGTXqCpSx3eK8UJ8YmZsSDygop";
const relayersUiIPFSHash = "QmSUG2SNSPc6UUc6tgTZJWQKExhUGqjxHQPcJNZuU5FcxW";
const docsIPFSHash = "QmNvimy7WNYG3H8cYmANLZjfvKeDFLUHDVvLMLiKj5AWsC";
const convertCIDToV1 = (cidV0: string) => `"${new CID(cidV0).toV1().toString()}"`;
const { calculateDecl } = new DeclCalculator("const", "", convertCIDToV1);
const typescriptCode =
calculateDecl({ classicUiIPFSHash }) +
calculateDecl({ novaUiIPFSHash }) +
calculateDecl({ relayersUiIPFSHash }) +
calculateDecl({ docsIPFSHash });
fs.writeFileSync(path.join(".", "data", "ipfsV1CIDs.txt"), typescriptCode);