c3469b3648
* Rollback `keytar-prebuild` and `electron` to compatible versions. * Check if the targeted build platform is different from the platform that is building the app. If that's the case, download the appropriate daemon.
29 lines
1.1 KiB
JavaScript
29 lines
1.1 KiB
JavaScript
/* eslint-disable no-console,import/no-extraneous-dependencies,import/no-commonjs */
|
|
|
|
/**
|
|
* This script is necessary for checking that the daemon that has been downloaded during the
|
|
* yarn installing process is the one for the building target. For example, on Travis the
|
|
* Windows package is built on Linux, thus yarn will download the daemon for Linux instead of
|
|
* Windows. The script will test that and then download the right daemon for the targeted platform.
|
|
*/
|
|
const os = require('os');
|
|
const downloadDaemon = require('./downloadDaemon');
|
|
|
|
module.exports = context => {
|
|
|
|
let currentPlatform = os.platform();
|
|
if (currentPlatform === 'darwin') currentPlatform = 'macoss';
|
|
if (currentPlatform === 'win32') currentPlatform = 'windows';
|
|
|
|
let buildingPlatformTarget = context.platform.toString();
|
|
if (buildingPlatformTarget === 'mac') buildingPlatformTarget = 'macos';
|
|
|
|
if (buildingPlatformTarget !== currentPlatform) {
|
|
console.log(
|
|
"\x1b[34minfo\x1b[0m Daemon platform doesn't match target platform. Redownloading the daemon."
|
|
);
|
|
|
|
return downloadDaemon(buildingPlatformTarget);
|
|
}
|
|
return Promise.resolve();
|
|
};
|