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

18 lines
628 B
TypeScript
Raw Normal View History

import fs from "fs";
import path from "path";
import CID from "cids";
import { DeclCalculator } from "./utils";
2023-08-30 22:05:46 +03:00
import { classicUiIpfsCid, novaUiIpfsCid, relayersUiIpfsCid, docsIpfsCid } from "./constants";
const convertCIDToV1 = (cidV0: string) => `"${new CID(cidV0).toV1().toString()}"`;
const { calculateDecl } = new DeclCalculator("const", "", convertCIDToV1);
const typescriptCode =
2023-08-30 22:05:46 +03:00
calculateDecl({ classicUiIpfsCid }) +
calculateDecl({ novaUiIpfsCid }) +
calculateDecl({ relayersUiIpfsCid }) +
calculateDecl({ docsIpfsCid });
fs.writeFileSync(path.join(".", "data", "ipfsV1CIDs.txt"), typescriptCode);