diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2022-06-28 23:09:24 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2022-06-28 23:09:50 -0300 |
commit | dcc3a7d96dbe93efb5da4c921e22c29019b456dd (patch) | |
tree | 9f194afe8145cc88753af697845362d18dfc7596 /src/upd8.js | |
parent | 79ca74f92e5ed361f86b392a6ec0dc56f0aec0f3 (diff) |
show status while computing writes
Diffstat (limited to 'src/upd8.js')
-rwxr-xr-x | src/upd8.js | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/upd8.js b/src/upd8.js index b2d5846c..99d55374 100755 --- a/src/upd8.js +++ b/src/upd8.js @@ -108,6 +108,7 @@ import { logInfo, logError, parseOptions, + progressCallAll, progressPromiseAll, } from './util/cli.js'; @@ -2150,27 +2151,21 @@ async function main() { // return; - writes = buildStepsWithTargets.flatMap(({flag, pageSpec, targets}) => { - const writes = targets.flatMap( - (target) => pageSpec.write(target, {wikiData})?.slice() || [] - ); - - if (!validateWrites(writes, flag + '.write')) { - return []; - } + writes = progressCallAll('Computing page & data writes.', buildStepsWithTargets.flatMap(({flag, pageSpec, targets}) => { + const writesFns = targets.map(target => () => { + const writes = pageSpec.write(target, {wikiData})?.slice() || []; + return validateWrites(writes, flag + '.write') ? writes : []; + }); if (pageSpec.writeTargetless) { - const writes2 = pageSpec.writeTargetless({wikiData}); - - if (!validateWrites(writes2, flag + '.writeTargetless')) { - return []; - } - - writes.push(...writes2); + writesFns.push(() => { + const writes = pageSpec.writeTargetless({wikiData}); + return validateWrites(writes, flag + '.writeTargetless') ? writes : []; + }); } - return writes; - }); + return writesFns; + })).flat(); if (error) { return; |