webext-schema
Advanced tools
Comparing version 1.2.8 to 1.2.10
19
index.js
@@ -8,20 +8,5 @@ /** | ||
const {logErr, throwErr} = require("./modules/common"); | ||
const {updateSchemas} = require("./modules/update"); | ||
const {version} = require("./package.json"); | ||
const commander = require("commander"); | ||
const {parseCommand} = require("./modules/update"); | ||
const process = require("process"); | ||
/* commands */ | ||
commander.exitOverride(); | ||
commander.version(version, "-v, --version"); | ||
commander.command("update").alias("u").description("update schemas") | ||
.option("-c, --channel <name>", "specify the release channel") | ||
.option("-i, --info", "console info") | ||
.action(updateSchemas); | ||
try { | ||
commander.parse(process.argv); | ||
} catch (e) { | ||
// fail through | ||
} | ||
/* process */ | ||
@@ -31,4 +16,6 @@ process.on("uncaughtException", throwErr); | ||
parseCommand(process.argv); | ||
module.exports = { | ||
Schema, | ||
}; |
@@ -10,2 +10,4 @@ /** | ||
const {createFile} = require("./file-util"); | ||
const {version} = require("../package.json"); | ||
const commander = require("commander"); | ||
const fetch = require("node-fetch"); | ||
@@ -260,4 +262,27 @@ const path = require("path"); | ||
/** | ||
* parse command | ||
* @param {Array} args - process.argv | ||
* @returns {void} | ||
*/ | ||
const parseCommand = args => { | ||
if (Array.isArray(args) && | ||
args.some(arg => /^(?:-v|--version|u(?:pdate)?)$/.test(arg))) { | ||
commander.exitOverride(); | ||
commander.version(version, "-v, --version"); | ||
commander.command("update").alias("u").description("update schemas") | ||
.option("-c, --channel <name>", "specify the release channel") | ||
.option("-i, --info", "console info") | ||
.action(updateSchemas); | ||
try { | ||
commander.parse(args); | ||
} catch (e) { | ||
// fail through | ||
} | ||
} | ||
}; | ||
module.exports = { | ||
ESR_VER, | ||
commander, | ||
createUnifiedSchema, | ||
@@ -271,4 +296,5 @@ fetchText, | ||
getSchemaData, | ||
parseCommand, | ||
saveSchemaFile, | ||
updateSchemas, | ||
}; |
@@ -38,3 +38,3 @@ { | ||
}, | ||
"version": "1.2.8" | ||
"version": "1.2.10" | ||
} |
3066193
86474