Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add fetchDatabase on mirror-box #792

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions etc/mirror-box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import chalk from "chalk";
import fetch from "cross-fetch";
import ora from "ora";
import { toSecond } from "../lib/string-utils";
import { fetchDatabase } from "./fetchers/fetch-database";

export async function mirror(name: string) {
const start = process.hrtime();
Expand All @@ -16,7 +17,25 @@ export async function mirror(name: string) {
});
}

export async function mirrorDatabase() {
const start = process.hrtime();
const spinner = ora(`${chalk.yellowBright("Mirroring Database")}`).start();
spinner.start(`${chalk.yellowBright("Fetching next data...")}`);

fetchDatabase()
zainfathoni marked this conversation as resolved.
Show resolved Hide resolved
.then(() => {
const end = `${toSecond(process.hrtime(start))} seconds`;
spinner.succeed(
`Finished mirroring Database in ${chalk.greenBright(end)}`,
);
})
.catch((err) => {
chalk.red(err);
});
}

zainfathoni marked this conversation as resolved.
Show resolved Hide resolved
(function main() {
void mirror("wbw-faq-sheets.json");
void mirror("wbw-sheets.json");
void mirrorDatabase();
})();