| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,13 @@ | |||
| 1 | - require("./scripts/generateJson"); | ||
| 2 | - require("./scripts/generateNativeCode"); | ||
| 3 | - require("./scripts/generateMissingTests"); | ||
| 1 | + var generateJson = require("./scripts/generateJson"); | ||
| 2 | + var generateNativeCode = require("./scripts/generateNativeCode"); | ||
| 3 | + var generateMissingTests = require("./scripts/generateMissingTests"); | ||
| 4 | + | ||
| 5 | + module.exports = function generate() { | ||
| 6 | + generateJson(); | ||
| 7 | + generateNativeCode(); | ||
| 8 | + generateMissingTests(); | ||
| 9 | + } | ||
| 10 | + | ||
| 11 | + if (require.main === module) { | ||
| 12 | + module.exports(); | ||
| 13 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,15 +1,17 @@ | |||
| 1 | 1 | const fs = require("fs"); | |
| 2 | 2 | const path = require("path"); | |
| 3 | - const helpers = require("./helpers"); | ||
| 4 | 3 | const utils = require("./utils"); | |
| 5 | - const _ = require("lodash"); | ||
| 4 | + var _; | ||
| 6 | 5 | ||
| 7 | 6 | var version = require("../../package.json").libgit2.version; | |
| 8 | 7 | var libgit2 = require("../input/v" + version + ".json"); | |
| 9 | 8 | var descriptor = require("../input/descriptor.json"); | |
| 10 | - var supplement = require("../input/libgit2-supplement.json"); | ||
| 9 | + var supplement = require("../input/libgit2-supplement.json"); | ||
| 10 | + | ||
| 11 | + module.exports = function generateJson() { | ||
| 12 | + var helpers = require("./helpers"); | ||
| 13 | + _ = require("lodash"); | ||
| 11 | 14 | ||
| 12 | - module.exports = (function generateJson() { | ||
| 13 | 15 | libgit2.types.forEach(function(type) { | |
| 14 | 16 | if (supplement.types[type[0]]){ | |
| 15 | 17 | _.merge(type[1], supplement.types[type[0]]); | |
@@ -219,4 +221,8 @@ module.exports = (function generateJson() { | |||
| 219 | 221 | ||
| 220 | 222 | utils.writeFile("output/idefs.json", output); | |
| 221 | 223 | ||
| 222 | - }()); | ||
| 224 | + }; | ||
| 225 | + | ||
| 226 | + if (require.main === module) { | ||
| 227 | + module.exports(); | ||
| 228 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,10 +5,9 @@ const fse = promisify(require("fs-extra")); | |||
| 5 | 5 | const utils = require("./utils"); | |
| 6 | 6 | ||
| 7 | 7 | const testFilesPath = "../test/tests"; | |
| 8 | - const idefs = require("../output/idefs"); | ||
| 9 | 8 | const missingFileIgnores = require("../input/ignored-missing-tests"); | |
| 10 | 9 | ||
| 11 | - module.exports = (function generateMissingTests() { | ||
| 10 | + module.exports = function generateMissingTests() { | ||
| 12 | 11 | var output = {}; | |
| 13 | 12 | ||
| 14 | 13 | function findMissingTest(idef) { | |
@@ -55,20 +54,22 @@ module.exports = (function generateMissingTests() { | |||
| 55 | 54 | }); | |
| 56 | 55 | }; | |
| 57 | 56 | ||
| 58 | - var promises = []; | ||
| 59 | - | ||
| 60 | - idefs.forEach(function(idef) { | ||
| 61 | - promises.push(findMissingTest(idef)); | ||
| 57 | + const idefs = require("../output/idefs"); | ||
| 58 | + var promises = idefs.map(function(idef) { | ||
| 59 | + return findMissingTest(idef); | ||
| 62 | 60 | }); | |
| 63 | 61 | ||
| 64 | 62 | Promise.all(promises).then( | |
| 65 | 63 | function() { | |
| 66 | 64 | utils.writeFile("output/missing-tests.json", output); | |
| 67 | 65 | }, | |
| 68 | 66 | function(fail) { | |
| 69 | - console.log(fail); | ||
| 67 | + console.error(fail); | ||
| 70 | 68 | } | |
| 71 | 69 | ); | |
| 72 | 70 | ||
| 73 | - }()); | ||
| 71 | + }; | ||
| 74 | 72 | ||
| 73 | + if (require.main === module) { | ||
| 74 | + module.exports(); | ||
| 75 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,26 +1,25 @@ | |||
| 1 | 1 | const path = require("path"); | |
| 2 | - const combyne = require("combyne"); | ||
| 3 | 2 | const promisify = require("promisify-node"); | |
| 4 | 3 | const fse = promisify(require("fs-extra")); | |
| 5 | - const js_beautify = require("js-beautify").js_beautify; | ||
| 6 | - const beautify = function (input) { | ||
| 7 | - return js_beautify(input, { | ||
| 8 | - "brace_style": "end-expand", | ||
| 9 | - "max_preserve_newlines": 2, | ||
| 10 | - "preserve_newlines": true, | ||
| 11 | - "indent_size": 2, | ||
| 12 | - "indent_char": " " | ||
| 13 | - }); | ||
| 14 | - } | ||
| 15 | 4 | const exec = promisify(function(command, opts, callback) { | |
| 16 | 5 | return require("child_process").exec(command, opts, callback); | |
| 17 | 6 | }); | |
| 18 | 7 | ||
| 19 | - | ||
| 20 | 8 | const utils = require("./utils"); | |
| 21 | - const idefs = require("../output/idefs"); | ||
| 22 | 9 | ||
| 23 | - module.exports = (function generateNativeCode() { | ||
| 10 | + module.exports = function generateNativeCode() { | ||
| 11 | + const combyne = require("combyne"); | ||
| 12 | + const js_beautify = require("js-beautify").js_beautify; | ||
| 13 | + const beautify = function (input) { | ||
| 14 | + return js_beautify(input, { | ||
| 15 | + "brace_style": "end-expand", | ||
| 16 | + "max_preserve_newlines": 2, | ||
| 17 | + "preserve_newlines": true, | ||
| 18 | + "indent_size": 2, | ||
| 19 | + "indent_char": " " | ||
| 20 | + }); | ||
| 21 | + }; | ||
| 22 | + | ||
| 24 | 23 | // Customize the delimiters so as to not process `{{{` or `}}}`. | |
| 25 | 24 | combyne.settings.delimiters = { | |
| 26 | 25 | START_RAW: "{{=", | |
@@ -91,6 +90,7 @@ module.exports = (function generateNativeCode() { | |||
| 91 | 90 | ||
| 92 | 91 | // Determine which definitions to actually include in the source code. | |
| 93 | 92 | // This might not be needed anymore but to be frank I'm not totally positive | |
| 93 | + const idefs = require("../output/idefs"); | ||
| 94 | 94 | var enabled = idefs.filter(function(idef) { | |
| 95 | 95 | return !idef.ignore; | |
| 96 | 96 | }); | |
@@ -119,7 +119,7 @@ module.exports = (function generateNativeCode() { | |||
| 119 | 119 | } | |
| 120 | 120 | catch (e) { | |
| 121 | 121 | if (process.env.BUILD_ONLY) { | |
| 122 | - console.log(e); | ||
| 122 | + console.error(e); | ||
| 123 | 123 | } | |
| 124 | 124 | } | |
| 125 | 125 | }); | |
@@ -143,4 +143,8 @@ module.exports = (function generateNativeCode() { | |||
| 143 | 143 | }) | |
| 144 | 144 | }); | |
| 145 | 145 | ||
| 146 | - }()); | ||
| 146 | + }; | ||
| 147 | + | ||
| 148 | + if (require.main === module) { | ||
| 149 | + module.exports(); | ||
| 150 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments