1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Tools: Add repeat mechanism when electron-builder randomly fails to build

This commit is contained in:
Laurent Cozic
2023-02-05 16:51:47 +00:00
parent 1e2aa4e2b5
commit 89eb012b25
6 changed files with 56 additions and 38 deletions

View File

@@ -0,0 +1,27 @@
const execCommand = require('./execCommand');
async function main() {
process.chdir(`${__dirname}/..`);
const maxTries = 3;
for (let i = 0; i < maxTries; i++) {
try {
console.info(await execCommand(['yarn', 'run', 'electron-builder'].join(' ')));
console.info('electronBuilder: electron-builder completed successfully');
break;
} catch (error) {
console.info(error.stdout);
console.error(error);
if (error.stdout.includes('cannot resolve') && i !== maxTries - 1) {
console.info(`electronBuilder: electron-builder could not download an asset - trying again (${i + 1})`);
continue;
} else {
throw error;
}
}
}
}
module.exports = main;