2023-02-05 16:51:47 +00:00
|
|
|
const execCommand = require('./execCommand');
|
2019-03-03 00:51:54 +00:00
|
|
|
|
2023-07-13 10:29:15 +00:00
|
|
|
const isArm64 = () => {
|
|
|
|
return process.platform === 'arm64';
|
|
|
|
};
|
|
|
|
|
2019-03-03 00:51:54 +00:00
|
|
|
const isWindows = () => {
|
|
|
|
return process && process.platform === 'win32';
|
2019-07-30 07:35:42 +00:00
|
|
|
};
|
2019-03-03 00:51:54 +00:00
|
|
|
|
|
|
|
async function main() {
|
|
|
|
// electron-rebuild --arch ia32 && electron-rebuild --arch x64
|
|
|
|
|
2020-11-10 15:59:30 +00:00
|
|
|
// console.warn('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
|
|
|
|
// console.warn('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!ELECTRON REBUILD IS DISABLED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
|
|
|
|
// console.warn('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
|
2020-11-05 16:58:23 +00:00
|
|
|
// return;
|
|
|
|
|
2021-12-20 15:08:43 +00:00
|
|
|
// let exePath = `${__dirname}/../node_modules/.bin/electron-rebuild`;
|
|
|
|
// if (isWindows()) exePath += '.cmd';
|
2019-03-03 00:51:54 +00:00
|
|
|
|
2020-03-30 17:03:02 +00:00
|
|
|
process.chdir(`${__dirname}/..`);
|
|
|
|
|
2021-10-01 18:35:27 +00:00
|
|
|
// We need to force the ABI because Electron Builder or node-abi picks the
|
|
|
|
// wrong one. However it means it will have to be manually upgraded for each
|
|
|
|
// new Electron release. Some ABI map there:
|
|
|
|
// https://github.com/electron/node-abi/tree/master/test
|
2023-07-12 15:00:30 +00:00
|
|
|
const forceAbiArgs = '--force-abi 116';
|
2021-10-01 18:35:27 +00:00
|
|
|
|
2019-03-03 00:51:54 +00:00
|
|
|
if (isWindows()) {
|
2020-11-10 15:59:30 +00:00
|
|
|
// Cannot run this in parallel, or the 64-bit version might end up
|
|
|
|
// with 32-bit files and vice-versa
|
2021-12-20 15:08:43 +00:00
|
|
|
console.info(await execCommand(['yarn', 'run', 'electron-rebuild', forceAbiArgs, '--arch ia32'].join(' ')));
|
|
|
|
console.info(await execCommand(['yarn', 'run', 'electron-rebuild', forceAbiArgs, '--arch x64'].join(' ')));
|
2023-07-13 10:29:15 +00:00
|
|
|
} else if (isArm64()) {
|
|
|
|
// Keytar needs it's own electron-rebuild or else it will not fetch the
|
|
|
|
// existing prebuilt binary, this will cause cross-compilation to fail.
|
|
|
|
// E.g. for MacOS arm64 it will download:
|
|
|
|
// https://github.com/atom/node-keytar/releases/download/v7.9.0/keytar-v7.9.0-napi-v3-darwin-arm64.tar.gz
|
|
|
|
console.info(await execCommand(['yarn', 'run', 'electron-rebuild', forceAbiArgs, '--arch=arm64', '--only=keytar'].join(' ')));
|
|
|
|
console.info(await execCommand(['yarn', 'run', 'electron-rebuild', forceAbiArgs].join(' ')));
|
2019-03-03 00:51:54 +00:00
|
|
|
} else {
|
2021-12-20 15:08:43 +00:00
|
|
|
console.info(await execCommand(['yarn', 'run', 'electron-rebuild', forceAbiArgs].join(' ')));
|
2019-07-30 07:35:42 +00:00
|
|
|
}
|
2019-03-03 00:51:54 +00:00
|
|
|
}
|
|
|
|
|
2020-02-20 22:59:18 +00:00
|
|
|
module.exports = main;
|