-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52309ef
commit eb46645
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// Copyright 2024 Vulcanize, Inc. | ||
// | ||
|
||
import fs from 'fs'; | ||
import path from 'path'; | ||
import Handlebars from 'handlebars'; | ||
import { Writable } from 'stream'; | ||
|
||
const TEMPLATE_FILE = './templates/backfill-events-data-template.handlebars'; | ||
|
||
/** | ||
* Writes the backfill-events-data file generated from a template to a stream. | ||
* @param outStream A writable output stream to write the backfill-events-data file to. | ||
*/ | ||
export function exportBackfillEventsData (outStream: Writable): void { | ||
const templateString = fs.readFileSync(path.resolve(__dirname, TEMPLATE_FILE)).toString(); | ||
const template = Handlebars.compile(templateString); | ||
const content = template({}); | ||
outStream.write(content); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/codegen/src/templates/backfill-events-data-template.handlebars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// Copyright 2024 Vulcanize, Inc. | ||
// | ||
|
||
import 'reflect-metadata'; | ||
import debug from 'debug'; | ||
|
||
import { BackfillEventsDataCmd } from '@cerc-io/cli'; | ||
|
||
import { Database } from '../database'; | ||
import { Event } from '../entity/Event'; | ||
|
||
const log = debug('vulcanize:backfill-events-data'); | ||
|
||
const main = async (): Promise<void> => { | ||
const backFillCmd = new BackfillEventsDataCmd(); | ||
await backFillCmd.init(Database); | ||
|
||
await backFillCmd.exec(Event); | ||
}; | ||
|
||
main().catch(err => { | ||
log(err); | ||
}).finally(() => { | ||
process.exit(0); | ||
}); |