| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -222,7 +222,7 @@ module.exports = function generateJson() { | |
| _.merge(enumerable, _.omit(override, ["values"])); | ||
|
|
||
| output.push(enumerable); | ||
| }).value(); | ||
| }); | ||
|
Comment thread
Copy link
Copy Markdown
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Qualitydon't we need the .value to make lodash actually do the operation? I thought they were lazy about that as of v4? Edit: Maybe that was a change going in to v3, and now thats not there in v4?
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityCorrect. We needed it in v3 but in v4 a forEach just executes.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityPRAISE BE TO LODASH, FOR THEY ARE IMPROVE
Sorry, something went wrong.
All reactions
|
||
|
|
||
| output = _.sortBy(output, "typeName"); | ||
|
|
||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| const promisify = require("promisify-node"); | ||
| const fse = require("fs-extra"); | ||
|
|
||
| const fs = require("fs"); | ||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,187 +1,62 @@ | ||
| var path = require("path"); | ||
| var fs = require("fs"); | ||
| var cp = require("child_process"); | ||
| var prepareForBuild = require("./prepareForBuild"); | ||
| var exec = require("../utils/execPromise"); | ||
| var buildFlags = require("../utils/buildFlags"); | ||
| var spawn = require("child_process").spawn; | ||
|
|
||
| module.exports = function install() { | ||
| var fromRegistry; | ||
| console.log("[nodegit] Running install script"); | ||
|
|
||
| try { | ||
| fs.statSync(path.join(__dirname, "..", "include")); | ||
| fs.statSync(path.join(__dirname, "..", "src")); | ||
| fs.statSync(path.join(__dirname, "..", "dist")); | ||
| fromRegistry = true; | ||
| } | ||
| catch(e) { | ||
| fromRegistry = false; | ||
| } | ||
| var nodePreGyp = "node-pre-gyp"; | ||
|
|
||
| if (!fromRegistry) { | ||
| console.info("[nodegit] Local install, no fetching allowed."); | ||
| return prepareAndBuild(); | ||
| } | ||
| if (process.env.BUILD_DEBUG) { | ||
| console.info("[nodegit] Doing a debug build, no fetching allowed."); | ||
| return prepareAndBuild(); | ||
| } | ||
| if (process.env.BUILD_ONLY) { | ||
| console.info("[nodegit] BUILD_ONLY is set to true, no fetching allowed."); | ||
| return prepareAndBuild(); | ||
| if (process.platform === "win32") { | ||
| nodePreGyp += ".cmd"; | ||
| } | ||
|
|
||
| return installPrebuilt(); | ||
| var args = ["install"]; | ||
|
|
||
| function installPrebuilt() { | ||
| console.info("[nodegit] Fetching binary from S3."); | ||
| var npg = pathForTool("node-pre-gyp"); | ||
| return exec("\""+ npg + "\" install --fallback-to-build=false") | ||
| .then( | ||
| function() { | ||
| console.info("[nodegit] Completed installation successfully."); | ||
| }, | ||
| function(err) { | ||
| console.info("[nodegit] Failed to install prebuilt binary:"); | ||
| console.error(err); | ||
| console.info("[nodegit] Building manually. (You'll be here a while.)"); | ||
| return prepareAndBuild(); | ||
| } | ||
| if (buildFlags.mustBuild) { | ||
| console.info( | ||
| "[nodegit] Pre-built download disabled, building from source." | ||
| ); | ||
| } | ||
| args.push("--build-from-source"); | ||
|
|
||
| function pathForTool(name) { | ||
| var toolPath = path.resolve(".", "node_modules", ".bin", name); | ||
| if (process.platform == "win32") { | ||
| toolPath += ".cmd"; | ||
| if (buildFlags.debugBuild) { | ||
| console.info("[nodegit] Building debug version."); | ||
| args.push("--debug"); | ||
| } | ||
| return toolPath; | ||
| } | ||
|
|
||
| function prepareAndBuild() { | ||
| console.info("[nodegit] Regenerating and configuring code"); | ||
| return prepareForBuild() | ||
| .then(function() { | ||
| return build(); | ||
| }) | ||
| .then(function() { | ||
| return transpileJavascript(); | ||
| }); | ||
| else { | ||
| args.push("--fallback-to-build"); | ||
| } | ||
|
|
||
| function transpileJavascript() { | ||
| var cmd = pathForTool("babel"); | ||
| var args = [ | ||
| "--presets", | ||
| "es2015", | ||
| "-d", | ||
| "./dist", | ||
| "./lib" | ||
| ]; | ||
| var opts = { | ||
| cwd: ".", | ||
| maxBuffer: Number.MAX_VALUE, | ||
| env: process.env, | ||
| stdio: "inherit" | ||
| }; | ||
| var home = process.platform == "win32" ? | ||
| process.env.USERPROFILE : process.env.HOME; | ||
| return new Promise(function(resolve, reject) { | ||
| var spawnedNodePreGyp = spawn(nodePreGyp, args); | ||
|
|
||
| opts.env.HOME = path.join(home, ".nodegit-gyp"); | ||
|
|
||
| return new Promise(function(resolve, reject) { | ||
| var child = cp.spawn(cmd, args, opts); | ||
| child.on("close", function(code) { | ||
| if (code) { | ||
| reject(code); | ||
| process.exitCode = 13; | ||
| } | ||
| else { | ||
| resolve(); | ||
| } | ||
| }); | ||
| spawnedNodePreGyp.stdout.on("data", function(data) { | ||
| console.info(data.toString().trim()); | ||
| }); | ||
| } | ||
|
|
||
| function build() { | ||
| console.info("[nodegit] Everything is ready to go, attempting compilation"); | ||
|
|
||
| var electronVersion = process.env.ELECTRON_VERSION; | ||
| var nwjsVersion = process.env.NWJS_VERSION; | ||
| var opts = { | ||
| cwd: ".", | ||
| maxBuffer: Number.MAX_VALUE, | ||
| env: process.env, | ||
| stdio: "inherit" | ||
| }; | ||
|
|
||
| var builder = "node-gyp"; | ||
| var debug = (process.env.BUILD_DEBUG ? "--debug" : ""); | ||
| var target = ""; | ||
| var arch = (process.env.TARGET_ARCH ? | ||
| "--arch=" + process.env.TARGET_ARCH : ""); | ||
| var distUrl = ""; | ||
| var runtime = ""; | ||
|
|
||
| process.argv.forEach(function(arg) { | ||
| if (~arg.indexOf("electronVersion")) { | ||
| electronVersion = arg.split("=")[1].trim(); | ||
| } | ||
| else if (~arg.indexOf("nsjwVersion")) { | ||
| nwjsVersion = arg.split("=")[1].trim(); | ||
| } | ||
| }); | ||
| spawnedNodePreGyp.stderr.on("data", function(data) { | ||
| console.error(data.toString().trim()); | ||
| }); | ||
|
|
||
| if (electronVersion) { | ||
| target = "--target=" + electronVersion; | ||
| distUrl = "--dist-url=https://atom.io/download/atom-shell"; | ||
| runtime = "--runtime=electron"; | ||
| spawnedNodePreGyp.on("close", function(code) { | ||
| if (!code) { | ||
| resolve(); | ||
| } else { | ||
| reject(code); | ||
| } | ||
| else if (nwjsVersion) { | ||
| builder = "nw-gyp"; | ||
| target = "--target=" + nwjsVersion; | ||
| runtime = "--runtime=node-webkit"; | ||
| } | ||
|
|
||
| var home = process.platform == "win32" ? | ||
| process.env.USERPROFILE : process.env.HOME; | ||
|
|
||
| opts.env.HOME = path.join(home, ".nodegit-gyp"); | ||
|
|
||
| var cmd = pathForTool(builder); | ||
| var args = [ | ||
| "rebuild", | ||
| debug, | ||
| target, | ||
| arch, | ||
| distUrl, | ||
| runtime | ||
| ] | ||
| .filter(function(arg) { | ||
| return arg; | ||
| }); | ||
|
|
||
| return new Promise(function(resolve, reject) { | ||
| var child = cp.spawn(cmd, args, opts); | ||
| child.on("close", function(code) { | ||
| console.log(code); | ||
| if (code) { | ||
| reject(code); | ||
| process.exitCode = 13; | ||
| } | ||
| else { | ||
| resolve(); | ||
| } | ||
| }); | ||
| }); | ||
| } | ||
| }); | ||
| }) | ||
| .then(function() { | ||
| console.info("[nodegit] Completed installation successfully."); | ||
| }); | ||
| }; | ||
|
|
||
| // Called on the command line | ||
| if (require.main === module) { | ||
| module | ||
| .exports() | ||
| .catch(function(err) { | ||
| console.error(err); | ||
| return -1; | ||
| 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); | ||
| }); | ||
| } |
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityWhy ignore lib? all of our js is in there?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Qualitylib should already be 100% built and in dist.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThat makes complete and total sense and I should have realized that, but sometimes I am do the forget.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.