diff options
author | Gar <gar+gh@danger.computer> | 2021-07-02 00:55:46 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-07-12 19:05:44 +0300 |
commit | 89483e888acc56386b9ebc4d70a4676e4a5a5cb1 (patch) | |
tree | aa28aad88eb5b63236af8714e172b19dbb9fb985 | |
parent | c3bd10e461976a073e6a898c46f8bde28b17668f (diff) |
fix(usage): better audit/boolean flag usage output
This adds the `audit` config item to the usage output of `npm ci`, and
also tweaks how usage flags are shown for boolean options that do not
default to false. Their usage is shown as the `--no-x` form of the flag
to better communicate that the flag is needed to turn that normally true
option OFF.
The description of `audit` was also updated to reflect that it runs on
many different npm commands, not just install. Because this flag is
included in the usage of those commands it's best to let the assocation
happen there instead of trying to be comprehensive in the description
itself.
A small fix to make `install-ci-test` not try to redefine its own
usage, but to inherit from `ci` was also included.
PR-URL: https://github.com/npm/cli/pull/3497
Credit: @wraithgar
Close: #3497
Reviewed-by: @nlf
-rw-r--r-- | docs/content/commands/npm-ci.md | 10 | ||||
-rw-r--r-- | docs/content/commands/npm-dedupe.md | 7 | ||||
-rw-r--r-- | docs/content/commands/npm-find-dupes.md | 7 | ||||
-rw-r--r-- | docs/content/commands/npm-install-ci-test.md | 10 | ||||
-rw-r--r-- | docs/content/commands/npm-install-test.md | 7 | ||||
-rw-r--r-- | docs/content/commands/npm-install.md | 7 | ||||
-rw-r--r-- | docs/content/commands/npm-link.md | 7 | ||||
-rw-r--r-- | docs/content/commands/npm-update.md | 7 | ||||
-rw-r--r-- | docs/content/using-npm/config.md | 7 | ||||
-rw-r--r-- | lib/ci.js | 1 | ||||
-rw-r--r-- | lib/install-ci-test.js | 8 | ||||
-rw-r--r-- | lib/utils/config/definition.js | 32 | ||||
-rw-r--r-- | lib/utils/config/definitions.js | 7 | ||||
-rw-r--r-- | tap-snapshots/test/lib/load-all-commands.js.test.cjs | 42 | ||||
-rw-r--r-- | tap-snapshots/test/lib/utils/config/definitions.js.test.cjs | 7 | ||||
-rw-r--r-- | tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs | 7 | ||||
-rw-r--r-- | tap-snapshots/test/lib/utils/npm-usage.js.test.cjs | 42 | ||||
-rw-r--r-- | test/lib/utils/config/definition.js | 7 |
18 files changed, 135 insertions, 87 deletions
diff --git a/docs/content/commands/npm-ci.md b/docs/content/commands/npm-ci.md index 9645bae7e..31c92b13c 100644 --- a/docs/content/commands/npm-ci.md +++ b/docs/content/commands/npm-ci.md @@ -69,6 +69,16 @@ cache: <!-- AUTOGENERATED CONFIG DESCRIPTIONS START --> <!-- automatically generated, do not edit manually --> +#### `audit` + +* Default: true +* Type: Boolean + +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. + #### `ignore-scripts` * Default: false diff --git a/docs/content/commands/npm-dedupe.md b/docs/content/commands/npm-dedupe.md index fbccc4105..324e6a71b 100644 --- a/docs/content/commands/npm-dedupe.md +++ b/docs/content/commands/npm-dedupe.md @@ -164,9 +164,10 @@ will *not* run any pre- or post-scripts. * Default: true * Type: Boolean -When "true" submit audit reports alongside `npm install` runs to the default -registry and all registries configured for scopes. See the documentation for -[`npm audit`](/commands/npm-audit) for details on what is submitted. +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. #### `bin-links` diff --git a/docs/content/commands/npm-find-dupes.md b/docs/content/commands/npm-find-dupes.md index 28281d567..3b28f6443 100644 --- a/docs/content/commands/npm-find-dupes.md +++ b/docs/content/commands/npm-find-dupes.md @@ -107,9 +107,10 @@ will *not* run any pre- or post-scripts. * Default: true * Type: Boolean -When "true" submit audit reports alongside `npm install` runs to the default -registry and all registries configured for scopes. See the documentation for -[`npm audit`](/commands/npm-audit) for details on what is submitted. +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. #### `bin-links` diff --git a/docs/content/commands/npm-install-ci-test.md b/docs/content/commands/npm-install-ci-test.md index c337905a0..2640311cf 100644 --- a/docs/content/commands/npm-install-ci-test.md +++ b/docs/content/commands/npm-install-ci-test.md @@ -20,6 +20,16 @@ This command runs `npm ci` followed immediately by `npm test`. <!-- AUTOGENERATED CONFIG DESCRIPTIONS START --> <!-- automatically generated, do not edit manually --> +#### `audit` + +* Default: true +* Type: Boolean + +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. + #### `ignore-scripts` * Default: false diff --git a/docs/content/commands/npm-install-test.md b/docs/content/commands/npm-install-test.md index deefbd96b..c8533cafe 100644 --- a/docs/content/commands/npm-install-test.md +++ b/docs/content/commands/npm-install-test.md @@ -149,9 +149,10 @@ will *not* run any pre- or post-scripts. * Default: true * Type: Boolean -When "true" submit audit reports alongside `npm install` runs to the default -registry and all registries configured for scopes. See the documentation for -[`npm audit`](/commands/npm-audit) for details on what is submitted. +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. #### `bin-links` diff --git a/docs/content/commands/npm-install.md b/docs/content/commands/npm-install.md index e5091e660..70d4c0d46 100644 --- a/docs/content/commands/npm-install.md +++ b/docs/content/commands/npm-install.md @@ -533,9 +533,10 @@ will *not* run any pre- or post-scripts. * Default: true * Type: Boolean -When "true" submit audit reports alongside `npm install` runs to the default -registry and all registries configured for scopes. See the documentation for -[`npm audit`](/commands/npm-audit) for details on what is submitted. +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. #### `bin-links` diff --git a/docs/content/commands/npm-link.md b/docs/content/commands/npm-link.md index b1c606676..c7b385009 100644 --- a/docs/content/commands/npm-link.md +++ b/docs/content/commands/npm-link.md @@ -233,9 +233,10 @@ will *not* run any pre- or post-scripts. * Default: true * Type: Boolean -When "true" submit audit reports alongside `npm install` runs to the default -registry and all registries configured for scopes. See the documentation for -[`npm audit`](/commands/npm-audit) for details on what is submitted. +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. #### `bin-links` diff --git a/docs/content/commands/npm-update.md b/docs/content/commands/npm-update.md index 512d04c82..c4f7694e1 100644 --- a/docs/content/commands/npm-update.md +++ b/docs/content/commands/npm-update.md @@ -255,9 +255,10 @@ will *not* run any pre- or post-scripts. * Default: true * Type: Boolean -When "true" submit audit reports alongside `npm install` runs to the default -registry and all registries configured for scopes. See the documentation for -[`npm audit`](/commands/npm-audit) for details on what is submitted. +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. #### `bin-links` diff --git a/docs/content/using-npm/config.md b/docs/content/using-npm/config.md index 1feae3d64..476db69f2 100644 --- a/docs/content/using-npm/config.md +++ b/docs/content/using-npm/config.md @@ -170,9 +170,10 @@ to the same value as the current version. * Default: true * Type: Boolean -When "true" submit audit reports alongside `npm install` runs to the default -registry and all registries configured for scopes. See the documentation for -[`npm audit`](/commands/npm-audit) for details on what is submitted. +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. #### `audit-level` @@ -33,6 +33,7 @@ class CI extends ArboristWorkspaceCmd { /* istanbul ignore next - see test/lib/load-all-commands.js */ static get params () { return [ + 'audit', 'ignore-scripts', 'script-shell', ] diff --git a/lib/install-ci-test.js b/lib/install-ci-test.js index 0d408178b..871f24b2f 100644 --- a/lib/install-ci-test.js +++ b/lib/install-ci-test.js @@ -13,14 +13,6 @@ class InstallCITest extends CI { return 'install-ci-test' } - /* istanbul ignore next - see test/lib/load-all-commands.js */ - static get params () { - return [ - 'ignore-scripts', - 'script-shell', - ] - } - exec (args, cb) { this.npm.commands.ci(args, (er) => { if (er) diff --git a/lib/utils/config/definition.js b/lib/utils/config/definition.js index 507be6a64..135485132 100644 --- a/lib/utils/config/definition.js +++ b/lib/utils/config/definition.js @@ -91,13 +91,27 @@ ${noEnvExport}`) } const describeUsage = (def) => { - let key = `--${def.key}` - if (def.short && typeof def.short === 'string') - key = `-${def.short}|${key}` + let key = '' // Single type - if (!Array.isArray(def.type)) - return `${key}${def.type === Boolean ? '' : ' ' + def.hint}` + if (!Array.isArray(def.type)) { + if (def.short) + key = `-${def.short}|` + + if (def.type === Boolean && def.default !== false) + key = `${key}--no-${def.key}` + else + key = `${key}--${def.key}` + + if (def.type !== Boolean) + key = `${key} ${def.hint}` + + return key + } + + key = `--${def.key}` + if (def.short) + key = `-${def.short}|--${def.key}` // Multiple types let types = def.type @@ -120,8 +134,12 @@ const describeUsage = (def) => { description = def.hint } - if (bool) - key = `${key}|${key}` + if (bool) { + // Currently none of our multi-type configs with boolean values default to + // false so all their hints should show `--no-`, if we ever add ones that + // default to false we can branch the logic here + key = `--no-${def.key}|${key}` + } const usage = `${key} ${description}` if (multiple) diff --git a/lib/utils/config/definitions.js b/lib/utils/config/definitions.js index 9e560fb71..a82e9b4c1 100644 --- a/lib/utils/config/definitions.js +++ b/lib/utils/config/definitions.js @@ -203,10 +203,10 @@ define('audit', { default: true, type: Boolean, description: ` - When "true" submit audit reports alongside \`npm install\` runs to the + When "true" submit audit reports alongside the current npm command to the default registry and all registries configured for scopes. See the - documentation for [\`npm audit\`](/commands/npm-audit) for details on - what is submitted. + documentation for [\`npm audit\`](/commands/npm-audit) for details on what + is submitted. `, flatten, }) @@ -440,6 +440,7 @@ define('cidr', { define('color', { default: !process.env.NO_COLOR || process.env.NO_COLOR === '0', + usage: '--color|--no-color|--color always', defaultDescription: ` true unless the NO_COLOR environ is set to something other than '0' `, diff --git a/tap-snapshots/test/lib/load-all-commands.js.test.cjs b/tap-snapshots/test/lib/load-all-commands.js.test.cjs index 3b0754c52..2c5e80db2 100644 --- a/tap-snapshots/test/lib/load-all-commands.js.test.cjs +++ b/tap-snapshots/test/lib/load-all-commands.js.test.cjs @@ -84,7 +84,7 @@ Usage: npm bugs [<pkgname>] Options: -[--browser|--browser <browser>] [--registry <registry>] +[--no-browser|--browser <browser>] [--registry <registry>] alias: issues @@ -120,7 +120,7 @@ Usage: npm ci Options: -[--ignore-scripts] [--script-shell <script-shell>] +[--no-audit] [--ignore-scripts] [--script-shell <script-shell>] aliases: clean-install, ic, install-clean, isntall-clean @@ -167,9 +167,9 @@ Usage: npm dedupe Options: -[--global-style] [--legacy-bundling] [--strict-peer-deps] [--package-lock] +[--global-style] [--legacy-bundling] [--strict-peer-deps] [--no-package-lock] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts] -[--audit] [--bin-links] [--fund] [--dry-run] +[--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] @@ -239,7 +239,7 @@ Usage: npm docs [<pkgname> [<pkgname> ...]] Options: -[--browser|--browser <browser>] [--registry <registry>] +[--no-browser|--browser <browser>] [--registry <registry>] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] @@ -337,9 +337,9 @@ Usage: npm find-dupes Options: -[--global-style] [--legacy-bundling] [--strict-peer-deps] [--package-lock] +[--global-style] [--legacy-bundling] [--strict-peer-deps] [--no-package-lock] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts] -[--audit] [--bin-links] [--fund] +[--no-audit] [--no-bin-links] [--no-fund] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] @@ -355,7 +355,7 @@ Usage: npm fund [[<@scope>/]<pkg>] Options: -[--json] [--browser|--browser <browser>] [--unicode] +[--json] [--no-browser|--browser <browser>] [--unicode] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [--which <fundingSourceNumber>] @@ -446,9 +446,9 @@ npm install <github username>/<github project> Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] -[--strict-peer-deps] [--package-lock] +[--strict-peer-deps] [--no-package-lock] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts] -[--audit] [--bin-links] [--fund] [--dry-run] +[--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] @@ -466,7 +466,7 @@ Usage: npm install-ci-test Options: -[--ignore-scripts] [--script-shell <script-shell>] +[--no-audit] [--ignore-scripts] [--script-shell <script-shell>] alias: cit @@ -493,9 +493,9 @@ npm install-test <github username>/<github project> Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] -[--strict-peer-deps] [--package-lock] +[--strict-peer-deps] [--no-package-lock] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts] -[--audit] [--bin-links] [--fund] [--dry-run] +[--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] @@ -516,9 +516,9 @@ npm link [<@scope>/]<pkg>[@<version>] Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] -[--strict-peer-deps] [--package-lock] +[--strict-peer-deps] [--no-package-lock] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts] -[--audit] [--bin-links] [--fund] [--dry-run] +[--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] @@ -768,7 +768,7 @@ Usage: npm rebuild [[<@scope>/]<name>[@<version>] ...] Options: -[-g|--global] [--bin-links] [--ignore-scripts] +[-g|--global] [--no-bin-links] [--ignore-scripts] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] @@ -786,7 +786,7 @@ Usage: npm repo [<pkgname> [<pkgname> ...]] Options: -[--browser|--browser <browser>] +[--no-browser|--browser <browser>] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] @@ -848,7 +848,7 @@ Usage: npm search [search terms ...] Options: -[-l|--long] [--json] [--color|--color <always>] [-p|--parseable] +[-l|--long] [--json] [--color|--no-color|--color always] [-p|--parseable] [--no-description] [--searchopts <searchopts>] [--searchexclude <searchexclude>] [--registry <registry>] [--prefer-online] [--prefer-offline] [--offline] @@ -1059,8 +1059,8 @@ npm update [<pkg>...] Options: [-g|--global] [--global-style] [--legacy-bundling] [--strict-peer-deps] -[--package-lock] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] -[--ignore-scripts] [--audit] [--bin-links] [--fund] [--dry-run] +[--no-package-lock] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] +[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] @@ -1078,7 +1078,7 @@ Usage: npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git] Options: -[--allow-same-version] [--commit-hooks] [--git-tag-version] [--json] +[--allow-same-version] [--no-commit-hooks] [--no-git-tag-version] [--json] [--preid prerelease-id] [--sign-git-tag] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] diff --git a/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs b/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs index 7b2ffbd8d..27e65bc70 100644 --- a/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs +++ b/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs @@ -218,9 +218,10 @@ exports[`test/lib/utils/config/definitions.js TAP > config description for audit * Default: true * Type: Boolean -When "true" submit audit reports alongside \`npm install\` runs to the default -registry and all registries configured for scopes. See the documentation for -[\`npm audit\`](/commands/npm-audit) for details on what is submitted. +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [\`npm audit\`](/commands/npm-audit) for details on what is +submitted. ` exports[`test/lib/utils/config/definitions.js TAP > config description for audit-level 1`] = ` diff --git a/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs b/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs index babed3253..d48a6239f 100644 --- a/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs +++ b/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs @@ -49,9 +49,10 @@ to the same value as the current version. * Default: true * Type: Boolean -When "true" submit audit reports alongside \`npm install\` runs to the default -registry and all registries configured for scopes. See the documentation for -[\`npm audit\`](/commands/npm-audit) for details on what is submitted. +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [\`npm audit\`](/commands/npm-audit) for details on what is +submitted. #### \`audit-level\` diff --git a/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs b/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs index f417d41b6..5836e60f3 100644 --- a/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs +++ b/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs @@ -235,7 +235,7 @@ All commands: npm bugs [<pkgname>] Options: - [--browser|--browser <browser>] [--registry <registry>] + [--no-browser|--browser <browser>] [--registry <registry>] alias: issues @@ -267,7 +267,7 @@ All commands: npm ci Options: - [--ignore-scripts] [--script-shell <script-shell>] + [--no-audit] [--ignore-scripts] [--script-shell <script-shell>] aliases: clean-install, ic, install-clean, isntall-clean @@ -308,9 +308,9 @@ All commands: npm dedupe Options: - [--global-style] [--legacy-bundling] [--strict-peer-deps] [--package-lock] + [--global-style] [--legacy-bundling] [--strict-peer-deps] [--no-package-lock] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts] - [--audit] [--bin-links] [--fund] [--dry-run] + [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] @@ -372,7 +372,7 @@ All commands: npm docs [<pkgname> [<pkgname> ...]] Options: - [--browser|--browser <browser>] [--registry <registry>] + [--no-browser|--browser <browser>] [--registry <registry>] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] @@ -458,9 +458,9 @@ All commands: npm find-dupes Options: - [--global-style] [--legacy-bundling] [--strict-peer-deps] [--package-lock] + [--global-style] [--legacy-bundling] [--strict-peer-deps] [--no-package-lock] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts] - [--audit] [--bin-links] [--fund] + [--no-audit] [--no-bin-links] [--no-fund] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] @@ -474,7 +474,7 @@ All commands: npm fund [[<@scope>/]<pkg>] Options: - [--json] [--browser|--browser <browser>] [--unicode] + [--json] [--no-browser|--browser <browser>] [--unicode] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [--which <fundingSourceNumber>] @@ -555,9 +555,9 @@ All commands: Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] - [--strict-peer-deps] [--package-lock] + [--strict-peer-deps] [--no-package-lock] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts] - [--audit] [--bin-links] [--fund] [--dry-run] + [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] @@ -573,7 +573,7 @@ All commands: npm install-ci-test Options: - [--ignore-scripts] [--script-shell <script-shell>] + [--no-audit] [--ignore-scripts] [--script-shell <script-shell>] alias: cit @@ -598,9 +598,9 @@ All commands: Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] - [--strict-peer-deps] [--package-lock] + [--strict-peer-deps] [--no-package-lock] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts] - [--audit] [--bin-links] [--fund] [--dry-run] + [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] @@ -619,9 +619,9 @@ All commands: Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] - [--strict-peer-deps] [--package-lock] + [--strict-peer-deps] [--no-package-lock] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts] - [--audit] [--bin-links] [--fund] [--dry-run] + [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] @@ -841,7 +841,7 @@ All commands: npm rebuild [[<@scope>/]<name>[@<version>] ...] Options: - [-g|--global] [--bin-links] [--ignore-scripts] + [-g|--global] [--no-bin-links] [--ignore-scripts] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] @@ -857,7 +857,7 @@ All commands: npm repo [<pkgname> [<pkgname> ...]] Options: - [--browser|--browser <browser>] + [--no-browser|--browser <browser>] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] @@ -911,7 +911,7 @@ All commands: npm search [search terms ...] Options: - [-l|--long] [--json] [--color|--color <always>] [-p|--parseable] + [-l|--long] [--json] [--color|--no-color|--color always] [-p|--parseable] [--no-description] [--searchopts <searchopts>] [--searchexclude <searchexclude>] [--registry <registry>] [--prefer-online] [--prefer-offline] [--offline] @@ -1094,8 +1094,8 @@ All commands: Options: [-g|--global] [--global-style] [--legacy-bundling] [--strict-peer-deps] - [--package-lock] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] - [--ignore-scripts] [--audit] [--bin-links] [--fund] [--dry-run] + [--no-package-lock] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] + [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] @@ -1111,7 +1111,7 @@ All commands: npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git] Options: - [--allow-same-version] [--commit-hooks] [--git-tag-version] [--json] + [--allow-same-version] [--no-commit-hooks] [--no-git-tag-version] [--json] [--preid prerelease-id] [--sign-git-tag] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] diff --git a/test/lib/utils/config/definition.js b/test/lib/utils/config/definition.js index 45f4c977a..a17a1a09a 100644 --- a/test/lib/utils/config/definition.js +++ b/test/lib/utils/config/definition.js @@ -95,6 +95,13 @@ t.test('basic definition', async t => { description: 'test description', }) t.equal(hasShort.usage, '-t|--key <key>') + const multiHasShort = new Definition('key', { + default: 'test default', + short: 't', + type: [null, String], + description: 'test description', + }) + t.equal(multiHasShort.usage, '-t|--key <key>') const hardCodedTypes = new Definition('key', { default: 'test default', type: ['string1', 'string2'], |