UNPKG

genezio

Version:

Command line utility to interact with Genezio infrastructure.

30 lines (29 loc) 982 B
import { writeToFile } from "./file.js"; import { debugLogger } from "./logging.js"; /** * Replace the temporary markdowns from the SDK with actual URLs. */ export async function replaceUrlsInSdk(sdkResponse, classUrlMap) { sdkResponse.files.forEach((c) => { const classContent = classUrlMap.find((classFile) => { return classFile.name === c.className; }); if (classContent) { c.data = c.data.replace("%%%link_to_be_replace%%%", classContent.cloudUrl); } }); } /** * Write the SDK files to disk. */ export async function writeSdkToDisk(sdk, outputPath) { if (sdk.files.length == 0) { debugLogger.debug("No SDK classes found..."); return; } debugLogger.debug("Writing the SDK to files..."); await Promise.all(sdk.files.map((file) => { return writeToFile(outputPath, file.path, file.data, true); })); debugLogger.debug("The SDK was successfully written to files."); }