Skip to content

Commit

Permalink
i dunno what I'm doing
Browse files Browse the repository at this point in the history
  • Loading branch information
llimllib committed May 22, 2024
1 parent baaa912 commit 5b9560c
Showing 1 changed file with 12 additions and 44 deletions.
56 changes: 12 additions & 44 deletions lifecycleScripts/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,66 +5,34 @@ var path = require("path");
module.exports = function install() {
console.log("[nodegit] Running install script");

var nodePreGyp = "node-pre-gyp";

if (process.platform === "win32") {
nodePreGyp += ".cmd";
}

var args = ["install"];

if (buildFlags.mustBuild) {
console.info(
"[nodegit] Pre-built download disabled, building from source."
"[nodegit] Pre-built download disabled, building from source.",
);
args.push("--build-from-source");

if (buildFlags.debugBuild) {
console.info("[nodegit] Building debug version.");
args.push("--debug");
}
}
else {
} else {
args.push("--fallback-to-build");
}

return new Promise(function(resolve, reject) {
const gypPath = path.join(__dirname, "..", "node_modules", "node-gyp", "bin", "node-gyp.js");
var spawnedNodePreGyp = spawn(nodePreGyp, args, {
env: {
...process.env,
npm_config_node_gyp: gypPath
},
shell: process.platform === "win32"
});

spawnedNodePreGyp.stdout.on("data", function(data) {
console.info(data.toString().trim());
});

spawnedNodePreGyp.stderr.on("data", function(data) {
console.error(data.toString().trim());
});

spawnedNodePreGyp.on("close", function(code) {
if (!code) {
resolve();
} else {
reject(code);
}
});
})
.then(function() {
console.info("[nodegit] Completed installation successfully.");
});
return new Promise(function (resolve, reject) {
resolve();
}).then(function () {
console.info("[nodegit] Completed installation successfully.");
});
};

// Called on the command line
if (require.main === module) {
module.exports()
.catch(function(e) {
console.error("[nodegit] ERROR - Could not finish install");
console.error("[nodegit] ERROR - finished with error code: " + e);
process.exit(e);
});
module.exports().catch(function (e) {
console.error("[nodegit] ERROR - Could not finish install");
console.error("[nodegit] ERROR - finished with error code: " + e);
process.exit(e);
});
}

0 comments on commit 5b9560c

Please sign in to comment.