yargs 14.2.2 → 15.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -3
- package/README.md +4 -0
- package/lib/command.js +2 -2
- package/locales/fr.json +2 -1
- package/package.json +11 -12
- package/yargs.js +12 -17
package/CHANGELOG.md
CHANGED
|
@@ -2,18 +2,52 @@
|
|
|
2
2
|
|
|
3
3
|
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.
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### [15.0.2](https://www.github.com/yargs/yargs/compare/v15.0.1...v15.0.2) (2019-11-19)
|
|
6
|
+
|
|
6
7
|
|
|
7
8
|
### Bug Fixes
|
|
8
9
|
|
|
9
10
|
* temporary fix for libraries that call Object.freeze() ([#1483](https://www.github.com/yargs/yargs/issues/1483)) ([99c2dc8](https://www.github.com/yargs/yargs/commit/99c2dc850e67c606644f8b0c0bca1a59c87dcbcd))
|
|
10
11
|
|
|
11
|
-
### [
|
|
12
|
+
### [15.0.1](https://www.github.com/yargs/yargs/compare/v15.0.0...v15.0.1) (2019-11-16)
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
### Bug Fixes
|
|
15
16
|
|
|
16
|
-
*
|
|
17
|
+
* **deps:** cliui, find-up, and string-width, all drop Node 6 support ([#1479](https://www.github.com/yargs/yargs/issues/1479)) ([6a9ebe2](https://www.github.com/yargs/yargs/commit/6a9ebe2d955e3e979e76c07ffbb1c17fef64cb49))
|
|
18
|
+
|
|
19
|
+
## [15.0.0](https://www.github.com/yargs/yargs/compare/v14.2.0...v15.0.0) (2019-11-10)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### ⚠ BREAKING CHANGES
|
|
23
|
+
|
|
24
|
+
* **deps:** yargs-parser now throws on invalid combinations of config (#1470)
|
|
25
|
+
* yargs-parser@16.0.0 drops support for Node 6
|
|
26
|
+
* drop Node 6 support (#1461)
|
|
27
|
+
* remove package.json-based parserConfiguration (#1460)
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* **deps:** yargs-parser now throws on invalid combinations of config ([#1470](https://www.github.com/yargs/yargs/issues/1470)) ([c10c38c](https://www.github.com/yargs/yargs/commit/c10c38cca04298f96b55a7e374a9a134abefffa7))
|
|
32
|
+
* expose `Parser` from `require('yargs/yargs')` ([#1477](https://www.github.com/yargs/yargs/issues/1477)) ([1840ba2](https://www.github.com/yargs/yargs/commit/1840ba22f1a24c0ece8e32bbd31db4134a080aee))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* **docs:** TypeScript import to prevent a future major release warning ([#1441](https://www.github.com/yargs/yargs/issues/1441)) ([b1b156a](https://www.github.com/yargs/yargs/commit/b1b156a3eb4ddd6803fbbd56c611a77919293000))
|
|
38
|
+
* stop-parse was not being respected by commands ([#1459](https://www.github.com/yargs/yargs/issues/1459)) ([12c82e6](https://www.github.com/yargs/yargs/commit/12c82e62663e928148a7ee2f51629aa26a0f9bb2))
|
|
39
|
+
* update to yargs-parser with fix for array default values ([#1463](https://www.github.com/yargs/yargs/issues/1463)) ([ebee59d](https://www.github.com/yargs/yargs/commit/ebee59d9022da538410e69a5c025019ed46d13d2))
|
|
40
|
+
* **docs:** update boolean description and examples in docs ([#1474](https://www.github.com/yargs/yargs/issues/1474)) ([afd5b48](https://www.github.com/yargs/yargs/commit/afd5b4871bfeb90d58351ac56c5c44a83ef033e6))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Miscellaneous Chores
|
|
44
|
+
|
|
45
|
+
* drop Node 6 support ([#1461](https://www.github.com/yargs/yargs/issues/1461)) ([2ba8ce0](https://www.github.com/yargs/yargs/commit/2ba8ce05e8fefbeffc6cb7488d9ebf6e86cceb1d))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Code Refactoring
|
|
49
|
+
|
|
50
|
+
* remove package.json-based parserConfiguration ([#1460](https://www.github.com/yargs/yargs/issues/1460)) ([0d3642b](https://www.github.com/yargs/yargs/commit/0d3642b6f829b637938774c0c6ce5f6bfe1afa51))
|
|
17
51
|
|
|
18
52
|
## [14.2.0](https://github.com/yargs/yargs/compare/v14.1.0...v14.2.0) (2019-10-07)
|
|
19
53
|
|
package/README.md
CHANGED
|
@@ -98,6 +98,10 @@ npm i @types/yargs --save-dev
|
|
|
98
98
|
|
|
99
99
|
See usage examples in [docs](/docs/typescript.md).
|
|
100
100
|
|
|
101
|
+
## Webpack
|
|
102
|
+
|
|
103
|
+
See usage examples of yargs with webpack in [docs](/docs/webpack.md).
|
|
104
|
+
|
|
101
105
|
## Community :
|
|
102
106
|
|
|
103
107
|
Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com).
|
package/lib/command.js
CHANGED
|
@@ -79,7 +79,7 @@ module.exports = function command (yargs, usage, validation, globalMiddleware) {
|
|
|
79
79
|
description: description,
|
|
80
80
|
handler,
|
|
81
81
|
builder: builder || {},
|
|
82
|
-
middlewares
|
|
82
|
+
middlewares,
|
|
83
83
|
demanded: parsedCommand.demanded,
|
|
84
84
|
optional: parsedCommand.optional
|
|
85
85
|
}
|
|
@@ -218,7 +218,7 @@ module.exports = function command (yargs, usage, validation, globalMiddleware) {
|
|
|
218
218
|
positionalMap = populatePositionals(commandHandler, innerArgv, currentContext, yargs)
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
const middlewares = globalMiddleware.slice(0).concat(commandHandler.middlewares
|
|
221
|
+
const middlewares = globalMiddleware.slice(0).concat(commandHandler.middlewares)
|
|
222
222
|
applyMiddleware(innerArgv, yargs, middlewares, true)
|
|
223
223
|
|
|
224
224
|
// we apply validation post-hoc, so that custom
|
package/locales/fr.json
CHANGED
|
@@ -33,5 +33,6 @@
|
|
|
33
33
|
"Invalid JSON config file: %s": "Fichier de configuration JSON invalide: %s",
|
|
34
34
|
"Path to JSON config file": "Chemin du fichier de configuration JSON",
|
|
35
35
|
"Show help": "Affiche de l'aide",
|
|
36
|
-
"Show version number": "Affiche le numéro de version"
|
|
36
|
+
"Show version number": "Affiche le numéro de version",
|
|
37
|
+
"Arguments %s and %s are mutually exclusive" : "Les arguments %s et %s sont mutuellement exclusifs"
|
|
37
38
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yargs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.2",
|
|
4
4
|
"description": "yargs the modern, pirate-themed, successor to optimist.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"contributors": [
|
|
@@ -19,19 +19,20 @@
|
|
|
19
19
|
"LICENSE"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"cliui": "^
|
|
22
|
+
"cliui": "^6.0.0",
|
|
23
23
|
"decamelize": "^1.2.0",
|
|
24
|
-
"find-up": "^
|
|
24
|
+
"find-up": "^4.1.0",
|
|
25
25
|
"get-caller-file": "^2.0.1",
|
|
26
26
|
"require-directory": "^2.1.1",
|
|
27
27
|
"require-main-filename": "^2.0.0",
|
|
28
28
|
"set-blocking": "^2.0.0",
|
|
29
|
-
"string-width": "^
|
|
29
|
+
"string-width": "^4.2.0",
|
|
30
30
|
"which-module": "^2.0.0",
|
|
31
31
|
"y18n": "^4.0.0",
|
|
32
|
-
"yargs-parser": "^
|
|
32
|
+
"yargs-parser": "^16.1.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
+
"c8": "^6.0.1",
|
|
35
36
|
"chai": "^4.2.0",
|
|
36
37
|
"chalk": "^2.4.2",
|
|
37
38
|
"coveralls": "^3.0.3",
|
|
@@ -40,18 +41,16 @@
|
|
|
40
41
|
"es6-promise": "^4.2.5",
|
|
41
42
|
"hashish": "0.0.4",
|
|
42
43
|
"mocha": "^5.2.0",
|
|
43
|
-
"nyc": "^14.1.0",
|
|
44
44
|
"rimraf": "^2.6.3",
|
|
45
45
|
"standard": "^12.0.1",
|
|
46
|
-
"standard-version": "^7.0.0",
|
|
47
46
|
"which": "^1.3.1",
|
|
48
47
|
"yargs-test-extends": "^1.0.1"
|
|
49
48
|
},
|
|
50
49
|
"scripts": {
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
50
|
+
"fix": "standard --fix",
|
|
51
|
+
"posttest": "standard",
|
|
52
|
+
"test": "c8 --reporter=html --reporter=text mocha --require ./test/before.js --timeout=12000 --check-leaks",
|
|
53
|
+
"coverage": "c8 report --reporter=text-lcov | coveralls"
|
|
55
54
|
},
|
|
56
55
|
"repository": {
|
|
57
56
|
"type": "git",
|
|
@@ -74,6 +73,6 @@
|
|
|
74
73
|
],
|
|
75
74
|
"license": "MIT",
|
|
76
75
|
"engine": {
|
|
77
|
-
"node": ">=
|
|
76
|
+
"node": ">=8"
|
|
78
77
|
}
|
|
79
78
|
}
|
package/yargs.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
+
|
|
3
|
+
// an async function fails early in Node.js versions prior to 8.
|
|
4
|
+
async function requiresNode8OrGreater () {}
|
|
5
|
+
requiresNode8OrGreater()
|
|
6
|
+
|
|
2
7
|
const argsert = require('./lib/argsert')
|
|
3
8
|
const fs = require('fs')
|
|
4
9
|
const Command = require('./lib/command')
|
|
@@ -603,7 +608,7 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
603
608
|
|
|
604
609
|
const demand = opt.demand || opt.required || opt.require
|
|
605
610
|
|
|
606
|
-
//
|
|
611
|
+
// A required option can be specified via "demand: true".
|
|
607
612
|
if (demand) {
|
|
608
613
|
self.demand(key, demand)
|
|
609
614
|
}
|
|
@@ -1031,12 +1036,6 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
1031
1036
|
|
|
1032
1037
|
options.__ = y18n.__
|
|
1033
1038
|
options.configuration = self.getParserConfiguration()
|
|
1034
|
-
// Deprecated
|
|
1035
|
-
let pkgConfig = pkgUp()['yargs']
|
|
1036
|
-
if (pkgConfig) {
|
|
1037
|
-
console.warn('Configuring yargs through package.json is deprecated and will be removed in a future major release, please use the JS API instead.')
|
|
1038
|
-
options.configuration = Object.assign({}, pkgConfig, options.configuration)
|
|
1039
|
-
}
|
|
1040
1039
|
|
|
1041
1040
|
const populateDoubleDash = !!options.configuration['populate--']
|
|
1042
1041
|
const config = Object.assign({}, options.configuration, {
|
|
@@ -1204,7 +1203,7 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
1204
1203
|
}
|
|
1205
1204
|
|
|
1206
1205
|
self._runValidation = function runValidation (argv, aliases, positionalMap, parseErrors) {
|
|
1207
|
-
if (parseErrors) throw new YError(parseErrors.message
|
|
1206
|
+
if (parseErrors) throw new YError(parseErrors.message)
|
|
1208
1207
|
validation.nonOptionCount(argv)
|
|
1209
1208
|
validation.requiredArguments(argv)
|
|
1210
1209
|
if (strict) validation.unknownArguments(argv, aliases, positionalMap)
|
|
@@ -1216,15 +1215,8 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
1216
1215
|
|
|
1217
1216
|
function guessLocale () {
|
|
1218
1217
|
if (!detectLocale) return
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
const { env } = process
|
|
1222
|
-
const locale = env.LC_ALL || env.LC_MESSAGES || env.LANG || env.LANGUAGE || 'en_US'
|
|
1223
|
-
self.locale(locale.replace(/[.:].*/, ''))
|
|
1224
|
-
} catch (err) {
|
|
1225
|
-
// if we explode looking up locale just noop
|
|
1226
|
-
// we'll keep using the default language 'en'.
|
|
1227
|
-
}
|
|
1218
|
+
const locale = process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || process.env.LANGUAGE || 'en_US'
|
|
1219
|
+
self.locale(locale.replace(/[.:].*/, ''))
|
|
1228
1220
|
}
|
|
1229
1221
|
|
|
1230
1222
|
// an app should almost always have --version and --help,
|
|
@@ -1235,6 +1227,9 @@ function Yargs (processArgs, cwd, parentRequire) {
|
|
|
1235
1227
|
return self
|
|
1236
1228
|
}
|
|
1237
1229
|
|
|
1230
|
+
// allow consumers to directly use the version of yargs-parser used by yargs
|
|
1231
|
+
exports.Parser = Parser
|
|
1232
|
+
|
|
1238
1233
|
// rebase an absolute path to a relative one with respect to a base directory
|
|
1239
1234
|
// exported for tests
|
|
1240
1235
|
exports.rebase = rebase
|