mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-01-24 12:09:06 +00:00
408a3927c0
* Add a table for entites in frothy region and update it in a subscriber * Accommodate changes to other watchers and codegen
22 lines
743 B
TypeScript
22 lines
743 B
TypeScript
//
|
|
// Copyright 2022 Vulcanize, Inc.
|
|
//
|
|
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
import Handlebars from 'handlebars';
|
|
import { Writable } from 'stream';
|
|
|
|
const SUBSCRIBER_TEMPLATE_FILE = './templates/subscriber-template.handlebars';
|
|
|
|
/**
|
|
* Writes the subscriber file generated from template to a stream.
|
|
* @param outStream A writable output stream to write the subscriber file to.
|
|
*/
|
|
export function exportSubscriber (subscriberOutStream: Writable): void {
|
|
const subscriberTemplateString = fs.readFileSync(path.resolve(__dirname, SUBSCRIBER_TEMPLATE_FILE)).toString();
|
|
const subscriberTemplate = Handlebars.compile(subscriberTemplateString);
|
|
const subscriber = subscriberTemplate({});
|
|
subscriberOutStream.write(subscriber);
|
|
}
|