From 14f4a7aa39725b4d90139c3b6658296600c5d712 Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Mon, 15 Aug 2016 10:15:47 -0700 Subject: [PATCH 1/2] Don't run postbuild when we detect electron install Since we can't require it from node if it's compiled for electron, we should just assume success for now --- lifecycleScripts/postinstall.js | 5 +++++ utils/buildFlags.js | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lifecycleScripts/postinstall.js b/lifecycleScripts/postinstall.js index a2af2089c..b6937f259 100755 --- a/lifecycleScripts/postinstall.js +++ b/lifecycleScripts/postinstall.js @@ -24,6 +24,11 @@ module.exports = function install() { // cleaning up return Promise.resolve(); } + if (buildFlags.isElectron) { + // If we're building for electron, we're unable to require things so we should + // just assume success, unfortunately. + return Promise.resolve(); + } return exec("node " + path.join(rootPath, "dist/nodegit.js")) .catch(function(e) { diff --git a/utils/buildFlags.js b/utils/buildFlags.js index 7b41cae83..d650c6fa8 100644 --- a/utils/buildFlags.js +++ b/utils/buildFlags.js @@ -11,7 +11,8 @@ try { } module.exports = { - debugBuild: process.env.BUILD_DEBUG, + debugBuild: !!process.env.BUILD_DEBUG, + isElectron: process.env.npm_config_runtime === "electron", isGitRepo: isGitRepo, - mustBuild: isGitRepo || process.env.BUILD_DEBUG || process.env.BUILD_ONLY, + mustBuild: !!(isGitRepo || process.env.BUILD_DEBUG || process.env.BUILD_ONLY) }; From cfe280c16ccdc0b3e3e2043d8f0123ad5f4efafc Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Wed, 17 Aug 2016 22:04:54 -0700 Subject: [PATCH 2/2] fix linter and add nwjs equivalent --- lifecycleScripts/postinstall.js | 6 +++--- utils/buildFlags.js | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lifecycleScripts/postinstall.js b/lifecycleScripts/postinstall.js index b6937f259..91e7c2a3c 100755 --- a/lifecycleScripts/postinstall.js +++ b/lifecycleScripts/postinstall.js @@ -24,9 +24,9 @@ module.exports = function install() { // cleaning up return Promise.resolve(); } - if (buildFlags.isElectron) { - // If we're building for electron, we're unable to require things so we should - // just assume success, unfortunately. + if (buildFlags.isElectron || buildFlags.isNWjs) { + // If we're building for electron or NWjs, we're unable to require the + // built library so we have to just assume success, unfortunately. return Promise.resolve(); } diff --git a/utils/buildFlags.js b/utils/buildFlags.js index d650c6fa8..3c3d9d9b2 100644 --- a/utils/buildFlags.js +++ b/utils/buildFlags.js @@ -14,5 +14,6 @@ module.exports = { debugBuild: !!process.env.BUILD_DEBUG, isElectron: process.env.npm_config_runtime === "electron", isGitRepo: isGitRepo, + isNwjs: process.env.npm_config_runtime === "node-webkit", mustBuild: !!(isGitRepo || process.env.BUILD_DEBUG || process.env.BUILD_ONLY) };