Fixed #1 - Fixed the whatsnew-** script for loading release notes into builds

Added test to ensure that release notes are parsed properly
Updated to latest dependencies to fix security vulnerability
Updated GH Actions Workflow to run test before updating tag
Updated README.md to reflect proper whatsnew documentation.
This commit is contained in:
Drew Heavner
2020-01-30 11:14:51 -05:00
parent b6496ac4e3
commit bdde081050
2660 changed files with 251487 additions and 213182 deletions

95
node_modules/yargs-parser/index.js generated vendored
View File

@@ -9,9 +9,10 @@ function parse (args, opts) {
// allow a string argument to be passed in rather
// than an argv array.
args = tokenizeArgString(args)
// aliases might have transitive relationships, normalize this.
var aliases = combineAliases(opts.alias || {})
var configuration = assign({
var configuration = Object.assign({
'short-option-groups': true,
'camel-case-expansion': true,
'dot-notation': true,
@@ -23,7 +24,9 @@ function parse (args, opts) {
'populate--': false,
'combine-arrays': false,
'set-placeholder-key': false,
'halt-at-non-option': false
'halt-at-non-option': false,
'strip-aliased': false,
'strip-dashed': false
}, opts.configuration)
var defaults = opts.default || {}
var configObjects = opts.configObjects || []
@@ -32,9 +35,7 @@ function parse (args, opts) {
var notFlagsArgv = notFlagsOption ? '--' : '_'
var newAliases = {}
// allow a i18n handler to be passed in, default to a fake one (util.format).
var __ = opts.__ || function (str) {
return util.format.apply(util, Array.prototype.slice.call(arguments))
}
var __ = opts.__ || util.format
var error = null
var flags = {
aliases: {},
@@ -176,7 +177,7 @@ function parse (args, opts) {
// -- seperated by space.
} else if (arg.match(/^--.+/) || (
!configuration['short-option-groups'] && arg.match(/^-.+/)
!configuration['short-option-groups'] && arg.match(/^-[^-]+/)
)) {
key = arg.match(/^--?(.+)/)[1]
@@ -187,7 +188,7 @@ function parse (args, opts) {
} else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) {
i = eatArray(i, key, args)
} else {
next = args[i + 1]
next = flags.nargs[key] === 0 ? undefined : args[i + 1]
if (next !== undefined && (!next.match(/^-/) ||
next.match(negative)) &&
@@ -199,7 +200,7 @@ function parse (args, opts) {
setArg(key, next)
i++
} else {
setArg(key, defaultForType(guessType(key, flags)))
setArg(key, defaultValue(key))
}
}
@@ -219,7 +220,7 @@ function parse (args, opts) {
setArg(key, next)
i++
} else {
setArg(key, defaultForType(guessType(key, flags)))
setArg(key, defaultValue(key))
}
} else if (arg.match(/^-[^-]+/) && !arg.match(negative)) {
letters = arg.slice(1, -1).split('')
@@ -266,7 +267,7 @@ function parse (args, opts) {
broken = true
break
} else {
setArg(letters[j], defaultForType(guessType(letters[j], flags)))
setArg(letters[j], defaultValue(letters[j]))
}
}
@@ -292,7 +293,7 @@ function parse (args, opts) {
setArg(key, next)
i++
} else {
setArg(key, defaultForType(guessType(key, flags)))
setArg(key, defaultValue(key))
}
}
}
@@ -332,6 +333,23 @@ function parse (args, opts) {
argv[notFlagsArgv].push(key)
})
if (configuration['camel-case-expansion'] && configuration['strip-dashed']) {
Object.keys(argv).filter(key => key !== '--' && key.includes('-')).forEach(key => {
delete argv[key]
})
}
if (configuration['strip-aliased']) {
// XXX Switch to [].concat(...Object.values(aliases)) once node.js 6 is dropped
;[].concat(...Object.keys(aliases).map(k => aliases[k])).forEach(alias => {
if (configuration['camel-case-expansion']) {
delete argv[alias.split('.').map(prop => camelCase(prop)).join('.')]
}
delete argv[alias]
})
}
// how many arguments should we consume, based
// on the nargs option?
function eatNargs (i, key, args) {
@@ -450,6 +468,14 @@ function parse (args, opts) {
}
function processValue (key, val) {
// strings may be quoted, clean this up as we assign values.
if (typeof val === 'string' &&
(val[0] === "'" || val[0] === '"') &&
val[val.length - 1] === val[0]
) {
val = val.substring(1, val.length - 1)
}
// handle parsing boolean arguments --foo=true --bar false.
if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) {
if (typeof val === 'string') val = val === 'true'
@@ -658,6 +684,14 @@ function parse (args, opts) {
var isValueArray = Array.isArray(value)
var duplicate = configuration['duplicate-arguments-array']
// nargs has higher priority than duplicate
if (!duplicate && checkAllAliases(key, flags.nargs)) {
duplicate = true
if ((!isUndefined(o[key]) && flags.nargs[key] === 1) || (Array.isArray(o[key]) && o[key].length === flags.nargs[key])) {
o[key] = undefined
}
}
if (value === increment) {
o[key] = increment(o[key])
} else if (Array.isArray(o[key])) {
@@ -678,8 +712,8 @@ function parse (args, opts) {
}
// extend the aliases list with inferred aliases.
function extendAliases () {
Array.prototype.slice.call(arguments).forEach(function (obj) {
function extendAliases (...args) {
args.forEach(function (obj) {
Object.keys(obj || {}).forEach(function (key) {
// short-circuit if we've already added a key
// to the aliases array, for example it might
@@ -740,6 +774,18 @@ function parse (args, opts) {
})
}
// make a best effor to pick a default value
// for an option based on name and type.
function defaultValue (key) {
if (!checkAllAliases(key, flags.bools) &&
!checkAllAliases(key, flags.counts) &&
`${key}` in defaults) {
return defaults[key]
} else {
return defaultForType(guessType(key))
}
}
// return a default value, given the type of a flag.,
// e.g., key of type 'string' will default to '', rather than 'true'.
function defaultForType (type) {
@@ -754,7 +800,7 @@ function parse (args, opts) {
}
// given a flag, enforce a default type.
function guessType (key, flags) {
function guessType (key) {
var type = 'boolean'
if (checkAllAliases(key, flags.strings)) type = 'string'
@@ -765,9 +811,14 @@ function parse (args, opts) {
}
function isNumber (x) {
if (x === null || x === undefined) return false
// if loaded from config, may already be a number.
if (typeof x === 'number') return true
// hexadecimal.
if (/^0x[0-9a-f]+$/i.test(x)) return true
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x)
// don't treat 0123 as a number; as it drops the leading '0'.
if (x.length > 1 && x[0] === '0') return false
return /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x)
}
function isUndefined (num) {
@@ -830,20 +881,6 @@ function combineAliases (aliases) {
return combined
}
function assign (defaults, configuration) {
var o = {}
configuration = configuration || {}
Object.keys(defaults).forEach(function (k) {
o[k] = defaults[k]
})
Object.keys(configuration).forEach(function (k) {
o[k] = configuration[k]
})
return o
}
// this function should only be called when a count is given as an arg
// it is NOT called to set a default value
// thus we can start the count at 1 instead of 0