| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -62,6 +62,7 @@ npm.load({ | |||
| 62 | 62 | ||
| 63 | 63 | var modulesToPrune = [ | |
| 64 | 64 | "for-node-webkit", | |
| 65 | + "which-native-nodish", | ||
| 65 | 66 | "fs-extra", | |
| 66 | 67 | "node-pre-gyp", | |
| 67 | 68 | "npm" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,21 +6,28 @@ var fs = require("fs"); | |||
| 6 | 6 | var local = path.join.bind(path, __dirname); | |
| 7 | 7 | ||
| 8 | 8 | var checkPrepared = require(local("checkPrepared")); | |
| 9 | - var forNodeWebkit = require("for-node-webkit"); | ||
| 9 | + var whichNativeNodish = require("which-native-nodish"); | ||
| 10 | 10 | var prepareForBuild = require(local("prepareForBuild")); | |
| 11 | 11 | ||
| 12 | 12 | var exec = promisify(function(command, opts, callback) { | |
| 13 | 13 | return require("child_process").exec(command, opts, callback); | |
| 14 | 14 | }); | |
| 15 | + var nwVersion = null; | ||
| 16 | + var asVersion = null; | ||
| 15 | 17 | ||
| 16 | - return forNodeWebkit(local("..")) | ||
| 18 | + return whichNativeNodish(local("..")) | ||
| 17 | 19 | .then(function(results) { | |
| 18 | - return results.nwVersion; | ||
| 20 | + nwVersion = results.nwVersion; | ||
| 21 | + asVersion = results.asVersion; | ||
| 19 | 22 | }) | |
| 20 | - .then(function(nodeWebkitVersion) { | ||
| 21 | - if (nodeWebkitVersion) { | ||
| 22 | - console.info("[nodegit] Must build for node-webkit"); | ||
| 23 | - return checkAndBuild(nodeWebkitVersion); | ||
| 23 | + .then(function() { | ||
| 24 | + if (nwVersion) { | ||
| 25 | + console.info("[nodegit] Must build for node-webkit/nw.js"); | ||
| 26 | + return checkAndBuild(); | ||
| 27 | + } | ||
| 28 | + else if (asVersion) { | ||
| 29 | + console.info("[nodegit] Must build for atom-shell"); | ||
| 30 | + return checkAndBuild(); | ||
| 24 | 31 | } | |
| 25 | 32 | if (fs.existsSync(local("../.didntcomefromthenpmregistry"))) { | |
| 26 | 33 | return checkAndBuild(); | |
@@ -48,7 +55,7 @@ return forNodeWebkit(local("..")) | |||
| 48 | 55 | }); | |
| 49 | 56 | ||
| 50 | 57 | ||
| 51 | - function checkAndBuild(nwVersion) { | ||
| 58 | + function checkAndBuild() { | ||
| 52 | 59 | console.info("[nodegit] Making sure dependencies are available and native " + | |
| 53 | 60 | "code is generated"); | |
| 54 | 61 | ||
@@ -82,14 +89,28 @@ function build(nwVersion) { | |||
| 82 | 89 | maxBuffer: Number.MAX_VALUE | |
| 83 | 90 | }; | |
| 84 | 91 | ||
| 85 | - var builder = nwVersion ? "nw-gyp" : "node-gyp"; | ||
| 86 | - var target = (nwVersion ? "--target=\"" + nwVersion + "\"": ""); | ||
| 92 | + var prefix = ""; | ||
| 93 | + var target = ""; | ||
| 87 | 94 | var debug = (process.env.BUILD_DEBUG ? " --debug" : ""); | |
| 88 | - var cmd = path.resolve(".", "node_modules", ".bin", builder) + | ||
| 89 | - " clean configure" + | ||
| 90 | - debug + | ||
| 91 | - target + | ||
| 92 | - " build"; | ||
| 95 | + var builder = "node-gyp"; | ||
| 96 | + var dist-url = ""; | ||
| 97 | + | ||
| 98 | + if (asVersion) { | ||
| 99 | + prefix = process.platform == 'win32' | ||
| 100 | + ? 'SET HOME="~/.atom-shell-gyp" &&s' | ||
| 101 | + : 'HOME=~/.atom-shell-gyp'; | ||
| 102 | + | ||
| 103 | + target = "--target=" + asVersion; | ||
| 104 | + | ||
| 105 | + dist-url = "--dist-url=https://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist"; | ||
| 106 | + } | ||
| 107 | + else if (nwVersion) { | ||
| 108 | + builder = "nw-gyp"; | ||
| 109 | + target = "--target=" + nwVersion; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + builder = path.resolve(".", "node_modules", ".bin", builder); | ||
| 113 | + var cmd = [prefix, builder, "rebuild", target, disturl].join(" ").trim(); | ||
| 93 | 114 | ||
| 94 | 115 | return exec(cmd, opts) | |
| 95 | 116 | .then(function() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54,12 +54,12 @@ | |||
| 54 | 54 | "node-pre-gyp" | |
| 55 | 55 | ], | |
| 56 | 56 | "dependencies": { | |
| 57 | - "for-node-webkit": "0.0.2", | ||
| 58 | 57 | "fs-extra": "~0.15.0", | |
| 59 | 58 | "node-pre-gyp": "~0.6.1", | |
| 60 | 59 | "nodegit-promise": "~1.0.0", | |
| 61 | 60 | "npm": "^2.1.18", | |
| 62 | - "promisify-node": "~0.1.2" | ||
| 61 | + "promisify-node": "~0.1.2", | ||
| 62 | + "which-native-nodish": "^1.0.0" | ||
| 63 | 63 | }, | |
| 64 | 64 | "devDependencies": { | |
| 65 | 65 | "mocha": "~2.1.0", | |
| Back | FazBrowse Home | New Git URL |
0 commit comments