yargs 16.0.1 → 16.1.0

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 CHANGED
@@ -2,6 +2,36 @@
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
+ ## [16.1.0](https://www.github.com/yargs/yargs/compare/v16.0.3...v16.1.0) (2020-10-15)
6
+
7
+
8
+ ### Features
9
+
10
+ * expose hideBin helper for CJS ([#1768](https://www.github.com/yargs/yargs/issues/1768)) ([63e1173](https://www.github.com/yargs/yargs/commit/63e1173bb47dc651c151973a16ef659082a9ae66))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **deno:** update types for deno ^1.4.0 ([#1772](https://www.github.com/yargs/yargs/issues/1772)) ([0801752](https://www.github.com/yargs/yargs/commit/080175207d281be63edf90adfe4f0568700b0bf5))
16
+ * **exports:** node 13.0-13.6 require a string fallback ([#1776](https://www.github.com/yargs/yargs/issues/1776)) ([b45c43a](https://www.github.com/yargs/yargs/commit/b45c43a5f64b565c3794f9792150eaeec4e00b69))
17
+ * **modules:** module path was incorrect ([#1759](https://www.github.com/yargs/yargs/issues/1759)) ([95a4a0a](https://www.github.com/yargs/yargs/commit/95a4a0ac573cfe158e6e4bc8c8682ebd1644a198))
18
+ * **positional:** positional strings no longer drop decimals ([#1761](https://www.github.com/yargs/yargs/issues/1761)) ([e1a300f](https://www.github.com/yargs/yargs/commit/e1a300f1293ad821c900284616337f080b207980))
19
+ * make positionals in -- count towards validation ([#1752](https://www.github.com/yargs/yargs/issues/1752)) ([eb2b29d](https://www.github.com/yargs/yargs/commit/eb2b29d34f1a41e0fd6c4e841960e5bfc329dc3c))
20
+
21
+ ### [16.0.3](https://www.github.com/yargs/yargs/compare/v16.0.2...v16.0.3) (2020-09-10)
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * move yargs.cjs to yargs to fix Node 10 imports ([#1747](https://www.github.com/yargs/yargs/issues/1747)) ([5bfb85b](https://www.github.com/yargs/yargs/commit/5bfb85b33b85db8a44b5f7a700a8e4dbaf022df0))
27
+
28
+ ### [16.0.2](https://www.github.com/yargs/yargs/compare/v16.0.1...v16.0.2) (2020-09-09)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * **typescript:** yargs-parser was breaking @types/yargs ([#1745](https://www.github.com/yargs/yargs/issues/1745)) ([2253284](https://www.github.com/yargs/yargs/commit/2253284b233cceabd8db677b81c5bf1755eef230))
34
+
5
35
  ### [16.0.1](https://www.github.com/yargs/yargs/compare/v16.0.0...v16.0.1) (2020-09-09)
6
36
 
7
37
 
package/README.md CHANGED
@@ -21,9 +21,22 @@ Yargs helps you build interactive command line tools, by parsing arguments and g
21
21
  It gives you:
22
22
 
23
23
  * commands and (grouped) options (`my-program.js serve --port=5000`).
24
- * a dynamically generated help menu based on your arguments.
24
+ * a dynamically generated help menu based on your arguments:
25
25
 
26
- > <img width="400" src="https://raw.githubusercontent.com/yargs/yargs/master/screen.png">
26
+ ```
27
+ mocha [spec..]
28
+
29
+ Run tests with Mocha
30
+
31
+ Commands
32
+ mocha inspect [spec..] Run tests with Mocha [default]
33
+ mocha init <path> create a client-side Mocha setup at <path>
34
+
35
+ Rules & Behavior
36
+ --allow-uncaught Allow uncaught errors to propagate [boolean]
37
+ --async-only, -A Require all tests to use a callback (async) or
38
+ return a Promise [boolean]
39
+ ```
27
40
 
28
41
  * bash-completion shortcuts for commands and options.
29
42
  * and [tons more](/docs/api.md).
@@ -46,7 +59,9 @@ npm i yargs@next
46
59
 
47
60
  ```javascript
48
61
  #!/usr/bin/env node
49
- const {argv} = require('yargs')
62
+ const yargs = require('yargs/yargs')
63
+ const { hideBin } = require('yargs/helpers')
64
+ const argv = yargs(hideBin(process.argv)).argv
50
65
 
51
66
  if (argv.ships > 3 && argv.distance < 53.5) {
52
67
  console.log('Plunder more riffiwobbles!')
@@ -67,7 +82,10 @@ Retreat from the xupptumblers!
67
82
 
68
83
  ```javascript
69
84
  #!/usr/bin/env node
70
- require('yargs') // eslint-disable-line
85
+ const yargs = require('yargs/yargs')
86
+ const { hideBin } = require('yargs/helpers')
87
+
88
+ yargs(hideBin(process.argv))
71
89
  .command('serve [port]', 'start the server', (yargs) => {
72
90
  yargs
73
91
  .positional('port', {
@@ -108,7 +126,7 @@ As of `v16`, `yargs` supports [Deno](https://github.com/denoland/deno):
108
126
  import yargs from 'https://deno.land/x/yargs/deno.ts'
109
127
  import { Arguments, YargsType } from 'https://deno.land/x/yargs/types.ts'
110
128
 
111
- yargs()
129
+ yargs(Deno.args)
112
130
  .command('download <files...>', 'download a list of files', (yargs: YargsType) => {
113
131
  return yargs.positional('files', {
114
132
  describe: 'a list of files to do something with'
@@ -118,7 +136,7 @@ yargs()
118
136
  })
119
137
  .strictCommands()
120
138
  .demandCommand(1)
121
- .parse(Deno.args)
139
+ .argv
122
140
  ```
123
141
 
124
142
  ### ESM
@@ -162,6 +180,7 @@ Having problems? want to contribute? join our [community slack](http://devtoolsc
162
180
  * [Composing Your App Using Commands](/docs/advanced.md#commands)
163
181
  * [Building Configurable CLI Apps](/docs/advanced.md#configuration)
164
182
  * [Customizing Yargs' Parser](/docs/advanced.md#customizing)
183
+ * [Bundling yargs](/docs/bundling.md)
165
184
  * [Contributing](/contributing.md)
166
185
 
167
186
  ## Supported Node.js Versions
package/browser.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  // Bootstrap yargs for browser:
2
- import browserPlatformShim from './lib/platform-shims/browser.mjs'
3
- import { YargsWithShim } from './build/lib/yargs-factory.js'
2
+ import browserPlatformShim from './lib/platform-shims/browser.mjs';
3
+ import {YargsWithShim} from './build/lib/yargs-factory.js';
4
4
 
5
- const Yargs = YargsWithShim(browserPlatformShim)
5
+ const Yargs = YargsWithShim(browserPlatformShim);
6
6
 
7
- export default Yargs
7
+ export default Yargs;