1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-12 08:54:00 +02:00
joplin/ElectronClient/tools/electronRebuild.js
Laurent Cozic 3407a31cf6
Tools: Improve and simplify how to build the apps (#2538)
* Improving CLI build

* Improving CLI build

* Remove requirement to build the tools

* Moved Electron app one level down

* Clean up Electron build

* Moved tools to sub-dir

* Updated root script

* update root

* update root

* update root

* update root

* update root

* update root

* Updated build

* Added doc

* Update CI config

* Should not lint index.js

* Fixing jetify

* Fixed linter errors

* Fixed pod build

* Fixed Windows build
2020-02-20 22:59:18 +00:00

40 lines
945 B
JavaScript

const execCommand = function(command) {
const exec = require('child_process').exec;
console.info(`Running: ${command}`);
return new Promise((resolve, reject) => {
exec(command, (error, stdout) => {
if (error) {
if (error.signal == 'SIGTERM') {
resolve('Process was killed');
} else {
reject(error);
}
} else {
resolve(stdout.trim());
}
});
});
};
const isWindows = () => {
return process && process.platform === 'win32';
};
async function main() {
// electron-rebuild --arch ia32 && electron-rebuild --arch x64
let exePath = `${__dirname}/../node_modules/.bin/electron-rebuild`;
if (isWindows()) exePath += '.cmd';
if (isWindows()) {
console.info(await execCommand([`"${exePath}"`, '--arch ia32'].join(' ')));
console.info(await execCommand([`"${exePath}"`, '--arch x64'].join(' ')));
} else {
console.info(await execCommand([`"${exePath}"`].join(' ')));
}
}
module.exports = main;