mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-01-24 12:09:06 +00:00
e883463aa6
* Parse events for multiple contracts in the generated code * Use contract wise artifacts in the generated indexer methods * Update codegen docs to use config file to generate a watcher * Add watcher generation config to eden-watcher
27 lines
826 B
TypeScript
27 lines
826 B
TypeScript
//
|
|
// 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);
|
|
}
|