1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00
joplin/packages/app-desktop/tools/electronBuilder.js

32 lines
888 B
JavaScript
Raw Normal View History

2023-02-05 21:10:17 +02:00
// Note: this is not working because electron-builder needs access to env
// variables which are not defined in this context. To make it work, we'll need
// to somehow pass this to the execCommand call.
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;