2019-03-03 02:51:54 +02:00
|
|
|
const execCommand = function(command) {
|
2019-07-30 09:35:42 +02:00
|
|
|
const exec = require('child_process').exec;
|
2019-03-03 02:51:54 +02:00
|
|
|
|
2019-09-19 23:51:18 +02:00
|
|
|
console.info(`Running: ${command}`);
|
2019-03-03 02:51:54 +02:00
|
|
|
|
|
|
|
return new Promise((resolve, reject) => {
|
2019-09-13 00:16:42 +02:00
|
|
|
exec(command, (error, stdout) => {
|
2019-03-03 02:51:54 +02:00
|
|
|
if (error) {
|
|
|
|
if (error.signal == 'SIGTERM') {
|
|
|
|
resolve('Process was killed');
|
|
|
|
} else {
|
|
|
|
reject(error);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
resolve(stdout.trim());
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2019-07-30 09:35:42 +02:00
|
|
|
};
|
2019-03-03 02:51:54 +02:00
|
|
|
|
|
|
|
const isWindows = () => {
|
|
|
|
return process && process.platform === 'win32';
|
2019-07-30 09:35:42 +02:00
|
|
|
};
|
2019-03-03 02:51:54 +02:00
|
|
|
|
|
|
|
async function main() {
|
|
|
|
// electron-rebuild --arch ia32 && electron-rebuild --arch x64
|
|
|
|
|
2020-02-21 00:59:18 +02:00
|
|
|
let exePath = `${__dirname}/../node_modules/.bin/electron-rebuild`;
|
2019-03-03 02:51:54 +02:00
|
|
|
if (isWindows()) exePath += '.cmd';
|
|
|
|
|
2020-03-30 19:03:02 +02:00
|
|
|
process.chdir(`${__dirname}/..`);
|
|
|
|
|
2019-03-03 02:51:54 +02:00
|
|
|
if (isWindows()) {
|
2019-09-19 23:51:18 +02:00
|
|
|
console.info(await execCommand([`"${exePath}"`, '--arch ia32'].join(' ')));
|
|
|
|
console.info(await execCommand([`"${exePath}"`, '--arch x64'].join(' ')));
|
2019-03-03 02:51:54 +02:00
|
|
|
} else {
|
2019-09-19 23:51:18 +02:00
|
|
|
console.info(await execCommand([`"${exePath}"`].join(' ')));
|
2019-07-30 09:35:42 +02:00
|
|
|
}
|
2019-03-03 02:51:54 +02:00
|
|
|
}
|
|
|
|
|
2020-02-21 00:59:18 +02:00
|
|
|
module.exports = main;
|