mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-11-11 00:54:09 +00:00
* Generate default derived state for Mapping type variables * Update IPLDBlock in storage methods instead of using a private class variable * Default state flag for indexer storage methods * Helper functions to update state objects * Add checkpoint flag in Contract table and corresponding changes in existing watchers * Update codegen docs * Add examples to generated docs * Turn default state off by default * Make state parameter to indexer storage methods default to none * Add method to get prev. state in indexer |
||
|---|---|---|
| .. | ||
| data/entities | ||
| templates | ||
| types/common | ||
| utils | ||
| artifacts.ts | ||
| checkpoint.ts | ||
| client.ts | ||
| config.ts | ||
| database.ts | ||
| entity.ts | ||
| events.ts | ||
| fill.ts | ||
| generate-code.ts | ||
| hooks.ts | ||
| indexer.ts | ||
| job-runner.ts | ||
| lint.ts | ||
| package.ts | ||
| readme.ts | ||
| resolvers.ts | ||
| schema.ts | ||
| server.ts | ||
| tsconfig.ts | ||
| visitor.ts | ||
| watch-contract.ts | ||
//
// 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 contractName Input contract name given as title of the README.
* @param outStream A writable output stream to write the README.md file to.
*/
export function exportReadme (folderName: string, contractName: string, outStream: Writable): void {
const templateString = fs.readFileSync(path.resolve(__dirname, TEMPLATE_FILE)).toString();
const template = Handlebars.compile(templateString);
const readmeString = template({
folderName,
contractName
});
outStream.write(readmeString);
}