From 0fc9972296f19c5da546861b9f3bb6d08c007d20 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 6 Dec 2022 17:02:50 -0400 Subject: quick-reload HSMusic-dedicated data tests --- src/upd8.js | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'src/upd8.js') diff --git a/src/upd8.js b/src/upd8.js index 217c985d..70297c6c 100755 --- a/src/upd8.js +++ b/src/upd8.js @@ -60,6 +60,7 @@ import find, {bindFind} from './util/find.js'; import * as html from './util/html.js'; import {getColors} from './util/colors.js'; import {findFiles} from './util/io.js'; +import {isMain} from './util/node-utils.js'; import CacheableObject from './data/things/cacheable-object.js'; @@ -1599,7 +1600,8 @@ function generateRedirectPage(title, target, {language}) { ]); } -async function processLanguageFile(file) { +// TODO: define somewhere besides upd8.js obviously +export async function processLanguageFile(file) { const contents = await readFile(file, 'utf-8'); const json = JSON.parse(contents); @@ -2608,15 +2610,17 @@ async function main() { logInfo`Written!`; } -main() - .catch((error) => { - if (error instanceof AggregateError) { - showAggregate(error); - } else { - console.error(error); - } - }) - .then(() => { - decorateTime.displayTime(); - CacheableObject.showInvalidAccesses(); - }); +if (isMain(import.meta.url)) { + main() + .catch((error) => { + if (error instanceof AggregateError) { + showAggregate(error); + } else { + console.error(error); + } + }) + .then(() => { + decorateTime.displayTime(); + CacheableObject.showInvalidAccesses(); + }); +} -- cgit 1.3.0-6-gf8a5