diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2022-06-26 12:12:24 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2022-06-26 12:12:24 -0300 |
commit | 1e64dcf379fbc45eab7da9bdd16cd03dc93bf50b (patch) | |
tree | 00a95f9a486dc7400bbbef91fc210c25b5163bb6 /src/wiki-checks.js | |
parent | 6f1efb7e7cbb2db6344aeba6ea935eb29d2a5068 (diff) |
experimental cache & checks code cache-and-checks
This is actually from a while ago, it's just been sitting around in my working directory for ages because I am bad at git.
Diffstat (limited to 'src/wiki-checks.js')
-rw-r--r-- | src/wiki-checks.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/wiki-checks.js b/src/wiki-checks.js new file mode 100644 index 0000000..af8a270 --- /dev/null +++ b/src/wiki-checks.js @@ -0,0 +1,56 @@ +import { quickLoadAllFromYAML } from './data/yaml.js'; +import { logError, parseOptions } from './util/cli.js'; +import { isMain } from './util/node-utils.js'; +import { showAggregate } from './util/sugar.js'; + +export default async function performAllChecks({ + dataPath, + mediaPath, +}) { + const wikiData = await quickLoadAllFromYAML(dataPath); + + console.log(wikiData); +} + +if (isMain(import.meta.url)) { + (async function() { + const miscOptions = await parseOptions(process.argv.slice(2), { + 'data-path': { + type: 'value' + }, + + 'media-path': { + type: 'value' + }, + + 'show-traces': { + type: 'flag' + }, + }); + + const dataPath = miscOptions['data-path'] || process.env.HSMUSIC_DATA; + const mediaPath = miscOptions['media-path'] || process.env.HSMUSIC_MEDIA; + + if (!dataPath) { + logError`Expected --data-path option or HSMUSIC_DATA to be set`; + return; + } + + const niceShowAggregate = (error, ...opts) => { + showAggregate(error, { + showTraces: showAggregateTraces, + pathToFile: f => path.relative(__dirname, f), + ...opts + }); + }; + + await performAllChecks({ + dataPath, + mediaPath, + + showAggregate: niceShowAggregate, + }); + })().catch(err => { + console.error(err); + }); +} |