diff --git a/CHANGELOG.md b/CHANGELOG.md
index 35d8d9e71..a4bce90bb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
# Change Log
+## v0.24.1 [(2019-02-11)](https://github.com/nodegit/nodegit/releases/tag/v0.24.1)
+
+[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.24.0...v0.24.1)
+
+#### Summary of changes
+- Fix Electron 4 builds
+
## v0.24.0 [(2019-01-16)](https://github.com/nodegit/nodegit/releases/tag/v0.24.0)
[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.23.0...v0.24.0)
diff --git a/appveyor.yml b/appveyor.yml
index 34f73e23d..368e911e8 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -58,5 +58,6 @@ build: off
branches:
only:
+ - /backport\/.*/
- master
- v0.3
diff --git a/generate/templates/templates/binding.gyp b/generate/templates/templates/binding.gyp
index dc0e203e7..ac9de517f 100644
--- a/generate/templates/templates/binding.gyp
+++ b/generate/templates/templates/binding.gyp
@@ -1,21 +1,13 @@
{
- "conditions": [
- ["(OS=='win' and node_root_dir.split('\\\\')[-1].startswith('iojs')) or (OS=='mac' and node_root_dir.split('/')[-1].startswith('iojs'))", {
- "variables": {
- "is_electron%": "1",
- }
- }, {
- "variables": {
- "is_electron%": "0",
- }
- }]
- ],
+ "variables": {
+ "is_electron%": "=0.5 0",
- "rimraf": "2"
- }
- },
"function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
@@ -3230,10 +3219,19 @@
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
},
"json5": {
- "version": "0.5.1",
- "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz",
- "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=",
- "dev": true
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.0.tgz",
+ "integrity": "sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ==",
+ "requires": {
+ "minimist": "^1.2.0"
+ },
+ "dependencies": {
+ "minimist": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
+ }
+ }
},
"jsonfile": {
"version": "2.4.0",
@@ -3619,11 +3617,10 @@
}
},
"node-gyp": {
- "version": "3.8.0",
- "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz",
- "integrity": "sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA==",
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-4.0.0.tgz",
+ "integrity": "sha512-2XiryJ8sICNo6ej8d0idXDEMKfVfFK7kekGCtJAuelGsYHQxhj13KTf95swTCN2dZ/4lTfZ84Fu31jqJEEgjWA==",
"requires": {
- "fstream": "^1.0.0",
"glob": "^7.0.3",
"graceful-fs": "^4.1.2",
"mkdirp": "^0.5.0",
@@ -5093,13 +5090,32 @@
"dev": true
},
"tar": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz",
- "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=",
- "requires": {
- "block-stream": "*",
- "fstream": "^1.0.2",
- "inherits": "2"
+ "version": "4.4.8",
+ "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.8.tgz",
+ "integrity": "sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ==",
+ "requires": {
+ "chownr": "^1.1.1",
+ "fs-minipass": "^1.2.5",
+ "minipass": "^2.3.4",
+ "minizlib": "^1.1.1",
+ "mkdirp": "^0.5.0",
+ "safe-buffer": "^5.1.2",
+ "yallist": "^3.0.2"
+ },
+ "dependencies": {
+ "minizlib": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz",
+ "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==",
+ "requires": {
+ "minipass": "^2.2.1"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
+ }
}
},
"tar-fs": {
diff --git a/package.json b/package.json
index 8fc88751b..84190bc07 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "nodegit",
"description": "Node.js libgit2 asynchronous native bindings",
- "version": "0.24.0",
+ "version": "0.24.3",
"homepage": "http://nodegit.org",
"keywords": [
"libgit2",
@@ -39,9 +39,10 @@
},
"dependencies": {
"fs-extra": "^7.0.0",
+ "json5": "^2.1.0",
"lodash": "^4.17.11",
"nan": "^2.11.1",
- "node-gyp": "^3.8.0",
+ "node-gyp": "^4.0.0",
"node-pre-gyp": "^0.11.0",
"promisify-node": "~0.3.0",
"ramda": "^0.25.0",
diff --git a/utils/isBuildingForElectron.js b/utils/isBuildingForElectron.js
new file mode 100644
index 000000000..295f6ab1f
--- /dev/null
+++ b/utils/isBuildingForElectron.js
@@ -0,0 +1,30 @@
+const fs = require("fs")
+const JSON5 = require("json5");
+const path = require("path");
+
+if (process.argv.length < 3) {
+ process.exit(1);
+}
+
+const last = arr => arr[arr.length - 1];
+const [, , nodeRootDir] = process.argv;
+
+let isElectron = last(nodeRootDir.split(path.sep)).startsWith("iojs");
+
+if (!isElectron) {
+ try {
+ // Not ideal, would love it if there were a full featured gyp package to do this operation instead.
+ const { variables: { built_with_electron } } = JSON5.parse(
+ fs.readFileSync(
+ path.resolve(nodeRootDir, "include", "node", "config.gypi"),
+ "utf8"
+ )
+ );
+
+ if (built_with_electron) {
+ isElectron = true;
+ }
+ } catch (e) {}
+}
+
+process.stdout.write(isElectron ? "1" : "0");
diff --git a/vendor/libgit2.gyp b/vendor/libgit2.gyp
index 11904835e..835a73c71 100644
--- a/vendor/libgit2.gyp
+++ b/vendor/libgit2.gyp
@@ -7,6 +7,7 @@
"library%": "static_library",
"openssl_enable_asm%": 0, # only supported with the Visual Studio 2012 (VC11) toolchain.
"gcc_version%": 0,
+ "is_electron%": "