Newer
Older
ServerGenerator / src / CopyCodeFile.ts
import * as fs from "fs";
import { join } from "path";

const codeFileName = join(__dirname, "..", "src", "ExampleOutput", "util.ts");
let code = fs.readFileSync(codeFileName).toString();
code = code.replace(/`/g, "\\`").replace(/\$/g, "\\$");
const utilGenerator = `export const UtilCode = \`${code}\`;\n`;
const outputFileName = join(__dirname, "..", "src", "UtilGenerator.ts");
fs.writeFileSync(outputFileName, utilGenerator);
console.log(`Generated UtilGenerator at ${outputFileName}`);