mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-04-23 02:44:07 +00:00
* Gracefully shutdown server * Forbid lint warnings * Avoid setting subgraph path in template contex in codegen
22 lines
649 B
TypeScript
22 lines
649 B
TypeScript
//
|
|
// Copyright 2021 Vulcanize, Inc.
|
|
//
|
|
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
import Handlebars from 'handlebars';
|
|
import { Writable } from 'stream';
|
|
|
|
const FILL_TEMPLATE_FILE = './templates/fill-template.handlebars';
|
|
|
|
/**
|
|
* Writes the fill file generated from a template to a stream.
|
|
* @param fillOutStream A writable output stream to write the fill file to.
|
|
*/
|
|
export function exportFill (fillOutStream: Writable): void {
|
|
const templateString = fs.readFileSync(path.resolve(__dirname, FILL_TEMPLATE_FILE)).toString();
|
|
const template = Handlebars.compile(templateString);
|
|
const fill = template({});
|
|
fillOutStream.write(fill);
|
|
}
|