MyCrypto/webpack_config/buildElectron.js
William O'Beirne 182eaa4329 Electron App (#854)
* Basic webpack build started.

* Get build working with electron-packager. Not fully satisfied, might investigate electron-builder.

* Custom title bar

* Rewrite all webpack configs to use common function. Organize webpack utils. Split into multiple dist folders.

* Replace electron build with electron-builder. Leave around packager for a bit.

* Check in progress on updater.

* Update modal flow.

* Fix tscheck.

* Adjust publish info.

* Arbitrary version bump.

* Bump version again.

* 5.0.2 bump fix autodownload.

* 5.0.2 bump again, readd dmg

* 5.0.3 bump

* Turn auto update back off. Log errors. Revert versions.

* Add os-specific builds. Improve update failure.

* Open external links in browser in electron.

* Remove custom title bar temporarily.

* Add info about the update download to the modal.

* Turn off development changes.

* Take the postBuild sorting script and move it into a webpack config.

* Initial conversion to typescript and electron-webpack.

* Switch from electron-webpack back to custom config, clean up unused code, typify electron bridge.

* Better typing for bridge.

* Remove unnecessary file.

* Reminify.

* Add shared folder resolving to jest config.

* Add enum to electron events
2018-01-22 17:38:06 -06:00

69 lines
1.9 KiB
JavaScript

'use strict';
const path = require('path');
const fs = require('fs');
const rimraf = require('rimraf');
const builder = require('electron-builder');
const config = require('./config');
function shouldBuildOs(os) {
return !process.env.ELECTRON_OS || process.env.ELECTRON_OS === os;
}
async function build() {
console.log('Beginning Electron build process...');
const jsBuildDir = path.join(config.path.output, 'electron-js');
const electronBuildsDir = path.join(config.path.output, 'electron-builds');
const compression = 'store';
console.log('Clearing out old builds...');
rimraf.sync(electronBuildsDir);
// Builder requires package.json be in the app directory, so copy it in
fs.copyFileSync(
path.join(config.path.root, 'package.json'),
path.join(jsBuildDir, 'package.json')
);
console.log('Building...');
await builder.build({
mac: shouldBuildOs('mac') ? ['zip', 'dmg'] : undefined,
win: shouldBuildOs('windows') ? ['nsis'] : undefined,
linux: shouldBuildOs('linux') ? ['AppImage'] : undefined,
x64: true,
ia32: true,
config: {
appId: 'com.github.myetherwallet.myetherwallet',
productName: 'MyEtherWallet',
directories: {
app: jsBuildDir,
output: electronBuildsDir,
},
mac: {
category: 'public.app-category.finance',
icon: path.join(config.path.electron, 'icons/icon.icns'),
compression
},
win: {
icon: path.join(config.path.electron, 'icons/icon.ico'),
compression
},
linux: {
category: 'Finance',
compression
},
publish: {
provider: 'github',
owner: 'MyEtherWallet',
repo: 'MyEtherWallet',
vPrefixedTagName: false
},
// IMPORTANT: Prevents extending configs in node_modules
extends: null
}
});
console.info(`Electron builds are finished! Available at ${electronBuildsDir}`);
}
build();