mirror of
https://github.com/balena-io/etcher.git
synced 2025-11-15 21:29:26 +00:00
Change-type: major Changelog-entry: Upgrade to Electron v3 Signed-off-by: Lorenzo Alberto Maria Ambrosi <lorenzoa@balena.io>
29 lines
1.4 KiB
Diff
29 lines
1.4 KiB
Diff
--- a/node_modules/node-pre-gyp/lib/util/versioning.js
|
|
+++ b/node_modules/node-pre-gyp/lib/util/versioning.js
|
|
@@ -80,7 +80,14 @@ function get_runtime_abi(runtime, target_version) {
|
|
if (runtime === 'node-webkit') {
|
|
return get_node_webkit_abi(runtime, target_version || process.versions['node-webkit']);
|
|
} else if (runtime === 'electron') {
|
|
- return get_electron_abi(runtime, target_version || process.versions.electron);
|
|
+ var electron_version = target_version || process.versions.electron;
|
|
+ if (!electron_version) {
|
|
+ // TODO PR something to electron to pass in the version number for forks
|
|
+ // https://github.com/electron/electron/issues/9058
|
|
+ try { electron_version = require('electron/package.json').version; }
|
|
+ catch (_) { electron_version = '3.1.3'; }
|
|
+ }
|
|
+ return get_electron_abi(runtime, electron_version);
|
|
} else {
|
|
if (runtime != 'node') {
|
|
throw new Error("Unknown Runtime: '" + runtime + "'");
|
|
@@ -263,7 +270,8 @@ function get_process_runtime(versions) {
|
|
var runtime = 'node';
|
|
if (versions['node-webkit']) {
|
|
runtime = 'node-webkit';
|
|
- } else if (versions.electron) {
|
|
+ } else if (versions.electron || process.env.ELECTRON_RUN_AS_NODE) {
|
|
+ // Running in electron or a childProcess.fork of electron
|
|
runtime = 'electron';
|
|
}
|
|
return runtime;
|