Skip to content

Commit 1967b99

Browse files
committed
Merge pull request #783 from atom/use-node-pre-gyp
Allow node-pre-gyp for Electron and node-webkit
2 parents 804dec4 + 8b6abe6 commit 1967b99

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

lifecycleScripts/install.js

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ return whichNativeNodish("..")
1919
asVersion = results.asVersion;
2020
})
2121
.then(function() {
22-
if (nwVersion) {
23-
console.info("[nodegit] Must build for node-webkit/nw.js");
24-
return prepareAndBuild();
25-
}
26-
else if (asVersion) {
27-
console.info("[nodegit] Must build for atom-shell");
28-
return prepareAndBuild();
29-
}
3022
if (fs.existsSync(local("../.didntcomefromthenpmregistry"))) {
3123
return prepareAndBuild();
3224
}
@@ -38,21 +30,34 @@ return whichNativeNodish("..")
3830
console.info("[nodegit] BUILD_ONLY is set to true, no fetching allowed.");
3931
return prepareAndBuild();
4032
}
41-
console.info("[nodegit] Fetching binary from S3.");
42-
return exec("node-pre-gyp install")
43-
.then(
44-
function() {
45-
console.info("[nodegit] Completed installation successfully.");
46-
},
47-
function(err) {
48-
console.info("[nodegit] Failed to install prebuilt binary, " +
49-
"building manually.");
50-
console.error(err);
51-
return prepareAndBuild();
52-
}
53-
);
33+
var args = [];
34+
if (asVersion) {
35+
args.push("--runtime=electron");
36+
args.push("--target=" + asVersion);
37+
} else if (nwVersion) {
38+
args.push("--runtime=node-webkit");
39+
args.push("--target=" + nwVersion);
40+
}
41+
return installPrebuilt(args);
5442
});
5543

44+
function installPrebuilt(args) {
45+
console.info("[nodegit] Fetching binary from S3.");
46+
var installArguments = args.join(" ");
47+
return exec("node-pre-gyp install " + installArguments)
48+
.then(
49+
function() {
50+
console.info("[nodegit] Completed installation successfully.");
51+
},
52+
function(err) {
53+
console.info("[nodegit] Failed to install prebuilt binary, " +
54+
"building manually.");
55+
console.error(err);
56+
return prepareAndBuild();
57+
}
58+
);
59+
}
60+
5661

5762
function prepareAndBuild() {
5863
console.info("[nodegit] Regenerating and configuring code");

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
],
3939
"dependencies": {
4040
"fs-extra": "^0.24.0",
41-
"node-pre-gyp": "^0.6.10",
41+
"node-pre-gyp": "^0.6.15",
4242
"nodegit-promise": "^3.0.3",
4343
"npm": "^3.3.3",
4444
"promisify-node": "^0.2.1",

0 commit comments

Comments
 (0)