Files
watcher-ts/packages/codegen/src
nabarun e841b6a7c3 Publish package for tracing-client (#364)
* Publish tracing-client package

* Upgrade package versions
2023-04-14 15:43:15 +05:30
..
2021-10-04 11:04:06 +05:30
2022-11-28 12:01:28 +05:30
2022-11-28 12:01:28 +05:30
2022-11-28 12:01:28 +05:30
2022-11-28 12:01:28 +05:30
2022-11-28 12:01:28 +05:30

//
// Copyright 2021 Vulcanize, Inc.
//

import fs from 'fs';
import path from 'path';
import Handlebars from 'handlebars';
import { Writable } from 'stream';

const TEMPLATE_FILE = './templates/readme-template.handlebars';

/**
 * Writes the README.md file generated from a template to a stream.
 * @param folderName Watcher folder name to be passed to the template.
 * @param port Watcher server port.
 * @param outStream A writable output stream to write the README.md file to.
 */
export function exportReadme (folderName: string, port: number, outStream: Writable): void {
  const templateString = fs.readFileSync(path.resolve(__dirname, TEMPLATE_FILE)).toString();
  const template = Handlebars.compile(templateString);
  const readmeString = template({
    folderName,
    port
  });
  outStream.write(readmeString);
}