proposal-30-decentralize-so.../scripts/calculateIpfsV1Cids.ts

18 lines
628 B
TypeScript

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