Completely updated React, fixed #11, (hopefully)

This commit is contained in:
2018-03-04 19:11:49 -05:00
parent 6e0afd6e2a
commit 34e5f5139a
13674 changed files with 333464 additions and 473223 deletions

View File

@@ -2,6 +2,46 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="8.0.2"></a>
## [8.0.2](https://github.com/yargs/yargs/compare/v8.0.1...v8.0.2) (2017-06-12)
<a name="8.0.1"></a>
## [8.0.1](https://github.com/yargs/yargs/compare/v8.0.0...v8.0.1) (2017-05-02)
<a name="8.0.0"></a>
# [8.0.0](https://github.com/yargs/yargs/compare/v7.1.0...v8.0.0) (2017-05-01)
### Bug Fixes
* commands are now applied in order, from left to right ([#857](https://github.com/yargs/yargs/issues/857)) ([baba863](https://github.com/yargs/yargs/commit/baba863))
* help now takes precedence over command recommendation ([#866](https://github.com/yargs/yargs/issues/866)) ([17e3567](https://github.com/yargs/yargs/commit/17e3567))
* positional arguments now work if no handler is provided to inner command ([#864](https://github.com/yargs/yargs/issues/864)) ([e28ded3](https://github.com/yargs/yargs/commit/e28ded3))
### Chores
* upgrade yargs-parser ([#867](https://github.com/yargs/yargs/issues/867)) ([8f9c6c6](https://github.com/yargs/yargs/commit/8f9c6c6))
### Features
* allow extends to inherit from a module ([#865](https://github.com/yargs/yargs/issues/865)) ([89456d9](https://github.com/yargs/yargs/commit/89456d9))
* allow strict mode to be disabled ([#840](https://github.com/yargs/yargs/issues/840)) ([6f78c05](https://github.com/yargs/yargs/commit/6f78c05))
### BREAKING CHANGES
* extends functionality now always loads the JSON provided, rather than reading from a specific key
* Node 4+ is now required; this will allow us to start updating our dependencies.
* the first argument to strict() is now used to enable/disable its functionality, rather than controlling whether or not it is global.
<a name="7.1.0"></a>
# [7.1.0](https://github.com/yargs/yargs/compare/v7.0.2...v7.1.0) (2017-04-13)

File diff suppressed because it is too large Load Diff

View File

@@ -15,22 +15,33 @@ function getPathToDefaultConfig (cwd, pathToExtend) {
return path.resolve(cwd, pathToExtend)
}
function applyExtends (config, cwd, subKey) {
function applyExtends (config, cwd) {
var defaultConfig = {}
if (config.hasOwnProperty('extends')) {
var pathToDefault = getPathToDefaultConfig(cwd, config.extends)
if (typeof config.extends !== 'string') return defaultConfig
var isPath = /\.json$/.test(config.extends)
var pathToDefault = null
if (!isPath) {
try {
pathToDefault = require.resolve(config.extends)
} catch (err) {
// most likely this simply isn't a module.
}
} else {
pathToDefault = getPathToDefaultConfig(cwd, config.extends)
}
// maybe the module uses key for some other reason,
// err on side of caution.
if (!pathToDefault && !isPath) return config
checkForCircularExtends(pathToDefault)
previouslyVisitedConfigs.push(pathToDefault)
delete config.extends
defaultConfig = JSON.parse(fs.readFileSync(pathToDefault, 'utf8'))
if (subKey) {
defaultConfig = defaultConfig[subKey] || {}
}
defaultConfig = applyExtends(defaultConfig, path.dirname(pathToDefault), subKey)
defaultConfig = isPath ? JSON.parse(fs.readFileSync(pathToDefault, 'utf8')) : require(config.extends)
delete config.extends
defaultConfig = applyExtends(defaultConfig, path.dirname(pathToDefault))
}
previouslyVisitedConfigs = []

View File

@@ -15,6 +15,8 @@ module.exports = function (yargs, usage, validation) {
var defaultCommand
self.addHandler = function (cmd, description, builder, handler) {
var aliases = []
handler = handler || function () {}
if (Array.isArray(cmd)) {
aliases = cmd.slice(1)
cmd = cmd[0]
@@ -174,7 +176,7 @@ module.exports = function (yargs, usage, validation) {
return !!defaultCommand
}
self.runCommand = function (command, yargs, parsed) {
self.runCommand = function (command, yargs, parsed, commandIndex) {
var aliases = parsed.aliases
var commandHandler = handlers[command] || handlers[aliasMap[command]] || defaultCommand
var currentContext = yargs.getContext()
@@ -199,7 +201,7 @@ module.exports = function (yargs, usage, validation) {
if (typeof yargs.getUsageInstance().getUsage() === 'undefined') {
yargs.usage('$0 ' + (parentCommands.length ? parentCommands.join(' ') + ' ' : '') + commandHandler.original)
}
innerArgv = innerYargs ? innerYargs._parseArgs(null, null, true) : yargs._parseArgs(null, null, true)
innerArgv = innerYargs ? innerYargs._parseArgs(null, null, true, commandIndex) : yargs._parseArgs(null, null, true, commandIndex)
} else {
innerArgv = yargs.parsed.argv
}
@@ -214,7 +216,7 @@ module.exports = function (yargs, usage, validation) {
Object.keys(commandHandler.builder).forEach(function (key) {
innerYargs.option(key, commandHandler.builder[key])
})
innerArgv = innerYargs._parseArgs(null, null, true)
innerArgv = innerYargs._parseArgs(null, null, true, commandIndex)
aliases = innerYargs.parsed.aliases
}

View File

@@ -1,4 +1,5 @@
const objFilter = require('./obj-filter')
const specialKeys = ['$0', '--', '_']
// validation-type-stuff, missing params,
// bad implications, custom checks.
@@ -131,7 +132,7 @@ module.exports = function (yargs, usage, y18n) {
})
Object.keys(argv).forEach(function (key) {
if (key !== '$0' && key !== '_' &&
if (specialKeys.indexOf(key) === -1 &&
!descriptions.hasOwnProperty(key) &&
!demandedOptions.hasOwnProperty(key) &&
!positionalMap.hasOwnProperty(key) &&
@@ -167,7 +168,7 @@ module.exports = function (yargs, usage, y18n) {
if (!Object.keys(options.choices).length) return
Object.keys(argv).forEach(function (key) {
if (key !== '$0' && key !== '_' &&
if (specialKeys.indexOf(key) === -1 &&
options.choices.hasOwnProperty(key)) {
[].concat(argv[key]).forEach(function (value) {
// TODO case-insensitive configurability

View File

@@ -21,9 +21,7 @@
"saveSpec": null,
"fetchSpec": "3.0.0"
},
"_requiredBy": [
"/react-scripts/yargs"
],
"_requiredBy": [],
"_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
"_spec": "3.0.0",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",

View File

@@ -22,7 +22,6 @@
"fetchSpec": "1.0.2"
},
"_requiredBy": [
"/react-scripts/yargs",
"/react-scripts/yargs/cliui"
],
"_resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",

View File

@@ -1,14 +1,14 @@
{
"_args": [
[
"yargs@7.1.0",
"yargs@8.0.2",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI"
]
],
"_from": "yargs@7.1.0",
"_id": "yargs@7.1.0",
"_from": "yargs@8.0.2",
"_id": "yargs@8.0.2",
"_inBundle": false,
"_integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=",
"_integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=",
"_location": "/react-scripts/yargs",
"_phantomChildren": {
"code-point-at": "1.1.0",
@@ -19,37 +19,34 @@
"_requested": {
"type": "version",
"registry": true,
"raw": "yargs@7.1.0",
"raw": "yargs@8.0.2",
"name": "yargs",
"escapedName": "yargs",
"rawSpec": "7.1.0",
"rawSpec": "8.0.2",
"saveSpec": null,
"fetchSpec": "7.1.0"
"fetchSpec": "8.0.2"
},
"_requiredBy": [
"/react-scripts/jest-runtime",
"/react-scripts/jest/jest-cli"
],
"_resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz",
"_spec": "7.1.0",
"_requiredBy": [],
"_resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz",
"_spec": "8.0.2",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI",
"bugs": {
"url": "https://github.com/yargs/yargs/issues"
},
"dependencies": {
"camelcase": "^3.0.0",
"camelcase": "^4.1.0",
"cliui": "^3.2.0",
"decamelize": "^1.1.1",
"get-caller-file": "^1.0.1",
"os-locale": "^1.4.0",
"read-pkg-up": "^1.0.1",
"os-locale": "^2.0.0",
"read-pkg-up": "^2.0.0",
"require-directory": "^2.1.1",
"require-main-filename": "^1.0.1",
"set-blocking": "^2.0.0",
"string-width": "^1.0.2",
"which-module": "^1.0.0",
"string-width": "^2.0.0",
"which-module": "^2.0.0",
"y18n": "^3.2.1",
"yargs-parser": "^5.0.0"
"yargs-parser": "^7.0.0"
},
"description": "yargs the modern, pirate-themed, successor to optimist.",
"devDependencies": {
@@ -61,11 +58,12 @@
"es6-promise": "^4.0.2",
"hashish": "0.0.4",
"mocha": "^3.0.1",
"nyc": "^10.0.0",
"nyc": "^10.3.0",
"rimraf": "^2.5.0",
"standard": "^8.6.0",
"standard-version": "^3.0.0",
"which": "^1.2.9"
"standard-version": "^4.2.0",
"which": "^1.2.9",
"yargs-test-extends": "^1.0.1"
},
"engine": {
"node": ">=0.10"
@@ -78,13 +76,6 @@
"completion.sh.hbs",
"LICENSE"
],
"greenkeeper": {
"ignore": [
"string-width",
"read-pkg-up",
"camelcase"
]
},
"homepage": "http://yargs.js.org/",
"keywords": [
"argument",
@@ -113,5 +104,5 @@
"**/example/**"
]
},
"version": "7.1.0"
"version": "8.0.2"
}

View File

@@ -126,7 +126,6 @@ function Yargs (processArgs, cwd, parentRequire) {
command = command ? command.reset() : Command(self, usage, validation)
if (!completion) completion = Completion(self, usage, command)
if (!strictGlobal) strict = false
completionCommand = null
output = ''
exitError = null
@@ -479,7 +478,7 @@ function Yargs (processArgs, cwd, parentRequire) {
// If an object exists in the key, add it to options.configObjects
if (obj[key] && typeof obj[key] === 'object') {
conf = applyExtends(obj[key], path || cwd, key)
conf = applyExtends(obj[key], path || cwd)
options.configObjects = (options.configObjects || []).concat(conf)
}
@@ -695,11 +694,9 @@ function Yargs (processArgs, cwd, parentRequire) {
}
var strict = false
var strictGlobal = false
self.strict = function (global) {
argsert('[boolean]', [global], arguments.length)
strict = true
strictGlobal = global !== false
self.strict = function (enabled) {
argsert('[boolean]', [enabled], arguments.length)
strict = enabled !== false
return self
}
self.getStrict = function () {
@@ -932,7 +929,7 @@ function Yargs (processArgs, cwd, parentRequire) {
enumerable: true
})
self._parseArgs = function (args, shortCircuit, _skipValidation) {
self._parseArgs = function (args, shortCircuit, _skipValidation, commandIndex) {
var skipValidation = !!_skipValidation
args = args || processArgs
@@ -983,13 +980,17 @@ function Yargs (processArgs, cwd, parentRequire) {
var handlerKeys = command.getCommands()
if (handlerKeys.length) {
var firstUnknownCommand
for (var i = 0, cmd; argv._[i] !== undefined; i++) {
for (var i = (commandIndex || 0), cmd; argv._[i] !== undefined; i++) {
cmd = String(argv._[i])
if (~handlerKeys.indexOf(cmd) && cmd !== completionCommand) {
setPlaceholderKeys(argv)
return command.runCommand(cmd, self, parsed)
// commands are executed using a recursive algorithm that executes
// the deepest command first; we keep track of the position in the
// argv._ array that is currently being executed.
return command.runCommand(cmd, self, parsed, i + 1)
} else if (!firstUnknownCommand && cmd !== completionCommand) {
firstUnknownCommand = cmd
break
}
}
@@ -1001,7 +1002,7 @@ function Yargs (processArgs, cwd, parentRequire) {
// recommend a command if recommendCommands() has
// been enabled, and no commands were found to execute
if (recommendCommands && firstUnknownCommand) {
if (recommendCommands && firstUnknownCommand && !argv[helpOpt]) {
validation.recommendCommands(firstUnknownCommand, handlerKeys)
}
}