Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: npm/cli
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v10.2.3
Choose a base ref
...
head repository: npm/cli
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v10.2.4
Choose a head ref

Commits on Nov 6, 2023

  1. Copy the full SHA
    dce3b08 View commit details
  2. Copy the full SHA
    b3a53c6 View commit details
  3. Copy the full SHA
    0f70088 View commit details

Commits on Nov 13, 2023

  1. fix(publish): split github workflow ref (#6978)

    Properly splits the github workflow ref on only the first `@`, ignoring any potential extras in the tag field.
    sxzz authored Nov 13, 2023
    Copy the full SHA
    fff8698 View commit details
  2. Copy the full SHA
    da18e4f View commit details
  3. Copy the full SHA
    d11496b View commit details

Commits on Nov 14, 2023

  1. Copy the full SHA
    f3a7380 View commit details
  2. deps: @sigstore/tuf@2.2.0

    wraithgar committed Nov 14, 2023
    Copy the full SHA
    a0a58b7 View commit details
  3. deps: ci-info@4.0.0

    wraithgar committed Nov 14, 2023
    Copy the full SHA
    cd0c649 View commit details
  4. deps: strip-ansi@7.1.0

    wraithgar committed Nov 14, 2023
    Copy the full SHA
    8c5882f View commit details
  5. chore: yaml@2.3.4

    wraithgar committed Nov 14, 2023
    Copy the full SHA
    43d1fe3 View commit details
  6. chore: nock@13.3.8

    wraithgar committed Nov 14, 2023
    Copy the full SHA
    5faab9f View commit details
  7. chore: eslint@8.53.0

    wraithgar committed Nov 14, 2023
    Copy the full SHA
    1acb277 View commit details
  8. deps: signal-exit@4.1.0

    wraithgar committed Nov 14, 2023
    Copy the full SHA
    54c4f7b View commit details
  9. deps: hoisting newer deps in favor of older ones

    In some cases this adds duplication to the tree which will be
    cleaned up as subdependencies update to the latest versions
    wraithgar committed Nov 14, 2023
    Copy the full SHA
    4613774 View commit details
  10. deps: @sigstore/sign@2.2.0

    wraithgar committed Nov 14, 2023
    Copy the full SHA
    b00e780 View commit details
  11. deps: is-core-module@2.13.1

    wraithgar committed Nov 14, 2023
    Copy the full SHA
    faf9eff View commit details
  12. deps: lru-cache@10.0.2

    wraithgar committed Nov 14, 2023
    Copy the full SHA
    e9ec2f7 View commit details
  13. fix: refactor search formatting code (#6995)

    output is the same but the code is more streamlined, and passes in the stripAnsi function as a "clean" function that can be extended or replaced later
    wraithgar authored Nov 14, 2023
    Copy the full SHA
    cd291e7 View commit details
  14. docs: add path usage for view command (#6616)

    Document how to target the current project context using the path `.`, so that field data about a local project can be viewed.
    RobinKnipe authored Nov 14, 2023
    Copy the full SHA
    a38836c View commit details

Commits on Nov 15, 2023

  1. chore: release 10.2.4

    github-actions[bot] authored and wraithgar committed Nov 15, 2023
    2
    Copy the full SHA
    7788ef2 View commit details
Showing with 3,263 additions and 1,305 deletions.
  1. +4 −4 .release-please-manifest.json
  2. +4 −0 AUTHORS
  3. +30 −0 CHANGELOG.md
  4. +3 −2 DEPENDENCIES.md
  5. +2 −3 docs/lib/content/commands/npm-prune.md
  6. +7 −0 docs/lib/content/commands/npm-view.md
  7. +17 −8 lib/commands/exec.js
  8. +2 −2 lib/commands/outdated.js
  9. +3 −4 lib/commands/pkg.js
  10. +4 −4 lib/commands/search.js
  11. +3 −3 lib/commands/token.js
  12. +83 −109 lib/utils/format-search-stream.js
  13. +1 −1 lib/utils/open-url.js
  14. +9 −2 lib/utils/sbom-cyclonedx.js
  15. +8 −1 lib/utils/sbom-spdx.js
  16. +36 −12 node_modules/.gitignore
  17. +0 −8 node_modules/@isaacs/cliui/node_modules/ansi-regex/index.js
  18. +0 −14 node_modules/@isaacs/cliui/node_modules/strip-ansi/index.js
  19. +163 −0 node_modules/@npmcli/disparity-colors/node_modules/ansi-styles/index.js
  20. +1 −1 ...isaacs/cliui/node_modules/strip-ansi → @npmcli/disparity-colors/node_modules/ansi-styles}/license
  21. +10 −8 node_modules/{wrap-ansi → @npmcli/disparity-colors}/node_modules/ansi-styles/package.json
  22. +2 −1 node_modules/@sigstore/sign/dist/witness/tlog/index.js
  23. +3 −3 node_modules/@sigstore/sign/package.json
  24. +14 −8 node_modules/@sigstore/tuf/dist/client.js
  25. +4 −3 node_modules/@sigstore/tuf/dist/index.js
  26. +1 −1 node_modules/@sigstore/tuf/package.json
  27. 0 node_modules/{@npmcli/agent/node_modules → }/agent-base/dist/helpers.js
  28. 0 node_modules/{@npmcli/agent/node_modules → }/agent-base/dist/index.js
  29. 0 node_modules/{@npmcli/agent/node_modules → }/agent-base/package.json
  30. +3 −5 node_modules/ansi-regex/index.js
  31. +1 −1 node_modules/ansi-regex/license
  32. +9 −6 node_modules/ansi-regex/package.json
  33. +190 −130 node_modules/ansi-styles/index.js
  34. +1 −1 node_modules/ansi-styles/license
  35. +8 −10 node_modules/ansi-styles/package.json
  36. +1 −1 node_modules/ci-info/package.json
  37. +29 −14 node_modules/ci-info/vendors.json
  38. +6 −9 node_modules/cidr-regex/index.js
  39. +12 −22 node_modules/cidr-regex/package.json
  40. +10 −0 node_modules/cli-columns/node_modules/ansi-regex/index.js
  41. +1 −1 node_modules/{@isaacs/cliui → cli-columns}/node_modules/ansi-regex/license
  42. +6 −9 node_modules/{wrap-ansi → cli-columns}/node_modules/ansi-regex/package.json
  43. +4 −0 node_modules/cli-columns/node_modules/strip-ansi/index.js
  44. +1 −1 node_modules/{wrap-ansi/node_modules/ansi-styles → cli-columns/node_modules/strip-ansi}/license
  45. +7 −10 node_modules/{@isaacs/cliui → cli-columns}/node_modules/strip-ansi/package.json
  46. +10 −0 node_modules/columnify/node_modules/ansi-regex/index.js
  47. +1 −1 node_modules/{wrap-ansi → columnify}/node_modules/ansi-regex/license
  48. +6 −9 node_modules/{@isaacs/cliui → columnify}/node_modules/ansi-regex/package.json
  49. +4 −0 node_modules/columnify/node_modules/strip-ansi/index.js
  50. +9 −0 node_modules/columnify/node_modules/strip-ansi/license
  51. +7 −10 node_modules/{wrap-ansi → columnify}/node_modules/strip-ansi/package.json
  52. +44 −12 node_modules/function-bind/implementation.js
  53. +38 −14 node_modules/function-bind/package.json
  54. +10 −0 node_modules/gauge/node_modules/ansi-regex/index.js
  55. +9 −0 node_modules/gauge/node_modules/ansi-regex/license
  56. +55 −0 node_modules/gauge/node_modules/ansi-regex/package.json
  57. +4 −0 node_modules/gauge/node_modules/strip-ansi/index.js
  58. +9 −0 node_modules/gauge/node_modules/strip-ansi/license
  59. +54 −0 node_modules/gauge/node_modules/strip-ansi/package.json
  60. +0 −22 node_modules/has/LICENSE-MIT
  61. +0 −48 node_modules/has/package.json
  62. +0 −5 node_modules/has/src/index.js
  63. +0 −10 node_modules/has/test/index.js
  64. +21 −0 node_modules/hasown/LICENSE
  65. +8 −0 node_modules/hasown/index.js
  66. +91 −0 node_modules/hasown/package.json
  67. +49 −0 node_modules/hasown/tsconfig.json
  68. 0 node_modules/{@npmcli/agent/node_modules → }/http-proxy-agent/LICENSE
  69. 0 node_modules/{@npmcli/agent/node_modules → }/http-proxy-agent/dist/index.js
  70. 0 node_modules/{@npmcli/agent/node_modules → }/http-proxy-agent/package.json
  71. 0 node_modules/{@npmcli/agent/node_modules → }/https-proxy-agent/dist/index.js
  72. 0 node_modules/{@npmcli/agent/node_modules → }/https-proxy-agent/dist/parse-proxy-response.js
  73. 0 node_modules/{@npmcli/agent/node_modules → }/https-proxy-agent/package.json
  74. +20 −20 node_modules/ip-regex/index.js
  75. +1 −1 node_modules/ip-regex/license
  76. +8 −5 node_modules/ip-regex/package.json
  77. +7 −7 node_modules/is-cidr/index.js
  78. +12 −26 node_modules/is-cidr/package.json
  79. +2 −2 node_modules/is-core-module/index.js
  80. +4 −4 node_modules/is-core-module/package.json
  81. +0 −2 node_modules/lru-cache/dist/cjs/index.min.js
  82. +17 −11 node_modules/lru-cache/dist/{cjs → commonjs}/index.js
  83. 0 node_modules/lru-cache/dist/{cjs → commonjs}/package.json
  84. +17 −11 node_modules/lru-cache/dist/{mjs → esm}/index.js
  85. 0 node_modules/lru-cache/dist/{mjs → esm}/package.json
  86. +0 −2 node_modules/lru-cache/dist/mjs/index.min.js
  87. +54 −44 node_modules/lru-cache/package.json
  88. +19 −12 node_modules/signal-exit/dist/cjs/index.js
  89. +19 −12 node_modules/signal-exit/dist/mjs/index.js
  90. +1 −1 node_modules/signal-exit/package.json
  91. 0 node_modules/{@npmcli/agent/node_modules → }/socks-proxy-agent/dist/index.js
  92. 0 node_modules/{@npmcli/agent/node_modules → }/socks-proxy-agent/package.json
  93. +10 −0 node_modules/string-width-cjs/node_modules/ansi-regex/index.js
  94. +9 −0 node_modules/string-width-cjs/node_modules/ansi-regex/license
  95. +55 −0 node_modules/string-width-cjs/node_modules/ansi-regex/package.json
  96. +4 −0 node_modules/string-width-cjs/node_modules/strip-ansi/index.js
  97. +9 −0 node_modules/string-width-cjs/node_modules/strip-ansi/license
  98. +54 −0 node_modules/string-width-cjs/node_modules/strip-ansi/package.json
  99. +10 −0 node_modules/string-width/node_modules/ansi-regex/index.js
  100. +9 −0 node_modules/string-width/node_modules/ansi-regex/license
  101. +55 −0 node_modules/string-width/node_modules/ansi-regex/package.json
  102. +4 −0 node_modules/string-width/node_modules/strip-ansi/index.js
  103. +9 −0 node_modules/string-width/node_modules/strip-ansi/license
  104. +54 −0 node_modules/string-width/node_modules/strip-ansi/package.json
  105. +10 −0 node_modules/strip-ansi-cjs/node_modules/ansi-regex/index.js
  106. +9 −0 node_modules/strip-ansi-cjs/node_modules/ansi-regex/license
  107. +55 −0 node_modules/strip-ansi-cjs/node_modules/ansi-regex/package.json
  108. +13 −3 node_modules/strip-ansi/index.js
  109. +1 −1 node_modules/strip-ansi/license
  110. +10 −7 node_modules/strip-ansi/package.json
  111. +10 −0 node_modules/wrap-ansi-cjs/node_modules/ansi-regex/index.js
  112. +9 −0 node_modules/wrap-ansi-cjs/node_modules/ansi-regex/license
  113. +55 −0 node_modules/wrap-ansi-cjs/node_modules/ansi-regex/package.json
  114. +163 −0 node_modules/wrap-ansi-cjs/node_modules/ansi-styles/index.js
  115. +9 −0 node_modules/wrap-ansi-cjs/node_modules/ansi-styles/license
  116. +56 −0 node_modules/wrap-ansi-cjs/node_modules/ansi-styles/package.json
  117. +4 −0 node_modules/wrap-ansi-cjs/node_modules/strip-ansi/index.js
  118. +9 −0 node_modules/wrap-ansi-cjs/node_modules/strip-ansi/license
  119. +54 −0 node_modules/wrap-ansi-cjs/node_modules/strip-ansi/package.json
  120. +0 −8 node_modules/wrap-ansi/node_modules/ansi-regex/index.js
  121. +0 −223 node_modules/wrap-ansi/node_modules/ansi-styles/index.js
  122. +0 −14 node_modules/wrap-ansi/node_modules/strip-ansi/index.js
  123. +0 −9 node_modules/wrap-ansi/node_modules/strip-ansi/license
  124. +764 −283 package-lock.json
  125. +9 −9 package.json
  126. +14 −14 tap-snapshots/test/lib/commands/search.js.test.cjs
  127. +55 −0 tap-snapshots/test/lib/utils/sbom-cyclonedx.js.test.cjs
  128. +135 −0 tap-snapshots/test/lib/utils/sbom-spdx.js.test.cjs
  129. +91 −2 test/lib/commands/exec.js
  130. +4 −2 test/lib/commands/hook.js
  131. +6 −4 test/lib/commands/org.js
  132. +37 −0 test/lib/commands/pkg.js
  133. +1 −1 test/lib/utils/open-url.js
  134. +18 −2 test/lib/utils/sbom-cyclonedx.js
  135. +30 −0 test/lib/utils/sbom-spdx.js
  136. +6 −0 workspaces/config/CHANGELOG.md
  137. +2 −2 workspaces/config/package.json
  138. +6 −0 workspaces/libnpmexec/CHANGELOG.md
  139. +2 −2 workspaces/libnpmexec/package.json
  140. +10 −0 workspaces/libnpmpublish/CHANGELOG.md
  141. +5 −3 workspaces/libnpmpublish/lib/provenance.js
  142. +2 −2 workspaces/libnpmpublish/package.json
  143. +4 −1 workspaces/libnpmpublish/test/publish.js
8 changes: 4 additions & 4 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
".": "10.2.3",
".": "10.2.4",
"workspaces/arborist": "7.2.1",
"workspaces/libnpmaccess": "8.0.1",
"workspaces/libnpmdiff": "6.0.3",
"workspaces/libnpmexec": "7.0.3",
"workspaces/libnpmexec": "7.0.4",
"workspaces/libnpmfund": "5.0.1",
"workspaces/libnpmhook": "10.0.0",
"workspaces/libnpmorg": "6.0.1",
"workspaces/libnpmpack": "6.0.3",
"workspaces/libnpmpublish": "9.0.1",
"workspaces/libnpmpublish": "9.0.2",
"workspaces/libnpmsearch": "7.0.0",
"workspaces/libnpmteam": "6.0.0",
"workspaces/libnpmversion": "5.0.1",
"workspaces/config": "8.0.1"
"workspaces/config": "8.0.2"
}
4 changes: 4 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -908,3 +908,7 @@ Wes Todd <wes@wesleytodd.com>
Mike McCready <66998419+MikeMcC399@users.noreply.github.com>
Piotr Kmieć <103869106+Gekuro@users.noreply.github.com>
Santoshraj2 <143222321+Santoshraj2@users.noreply.github.com>
Jamie Tanna <github@jamietanna.co.uk>
三咲智子 Kevin Deng <sxzz@sxzz.moe>
Manuel Spigolon <behemoth89@gmail.com>
Robin <robin.knipe@gmail.com>
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# Changelog

## [10.2.4](https://github.com/npm/cli/compare/v10.2.3...v10.2.4) (2023-11-14)

### Bug Fixes

* [`cd291e7`](https://github.com/npm/cli/commit/cd291e7aa52e56fc45f8245e67c77e0ed3711b07) [#6995](https://github.com/npm/cli/pull/6995) refactor search formatting code (#6995) (@wraithgar)
* [`f3a7380`](https://github.com/npm/cli/commit/f3a7380a45323dbf6c74015e418de3963fb11a69) [#6973](https://github.com/npm/cli/pull/6973) look in workspace for exec commands (#6973) (@wraithgar)
* [`d11496b`](https://github.com/npm/cli/commit/d11496b26dfee5957e7e2a1b328f346b2aca9348) [#6977](https://github.com/npm/cli/pull/6977) pkg: properly output in workspace mode (#6977) (@wraithgar)
* [`0f70088`](https://github.com/npm/cli/commit/0f7008851f1c250405e8dc326f15d535e8fc1eae) [#6969](https://github.com/npm/cli/pull/6969) correctly handle object licenses in SBOM generation (#6969) (@jamietanna)
* [`dce3b08`](https://github.com/npm/cli/commit/dce3b0896ba81b2109fea42ab32edd8a3193324c) [#6951](https://github.com/npm/cli/pull/6951) properly catch missing url opener error (#6951) (@wraithgar)

### Documentation

* [`a38836c`](https://github.com/npm/cli/commit/a38836ce9d703f5012ff4d4a8a4e3b9a9aedc025) [#6616](https://github.com/npm/cli/pull/6616) add path usage for view command (#6616) (@RobinKnipe)
* [`da18e4f`](https://github.com/npm/cli/commit/da18e4f9baa180beeb325a384759a26a19ac2919) [#6987](https://github.com/npm/cli/pull/6987) update npm-prune description (#6987) (@Eomm)

### Dependencies

* [`e9ec2f7`](https://github.com/npm/cli/commit/e9ec2f7005e7326d9a819978b251cf0a05062538) [#6994](https://github.com/npm/cli/pull/6994) `lru-cache@10.0.2`
* [`faf9eff`](https://github.com/npm/cli/commit/faf9efffb7bfe6efde6e53830cb054b34c3a6ea3) [#6994](https://github.com/npm/cli/pull/6994) `is-core-module@2.13.1`
* [`b00e780`](https://github.com/npm/cli/commit/b00e7808e370513e79ca31c261958377984e7444) [#6994](https://github.com/npm/cli/pull/6994) `@sigstore/sign@2.2.0`
* [`4613774`](https://github.com/npm/cli/commit/461377426d998ed79400501b09e1ee67c32bee23) [#6994](https://github.com/npm/cli/pull/6994) hoisting newer deps in favor of older ones
* [`54c4f7b`](https://github.com/npm/cli/commit/54c4f7b8705b2c9d5b8bc5bb846f4e7863735b7e) [#6994](https://github.com/npm/cli/pull/6994) `signal-exit@4.1.0`
* [`8c5882f`](https://github.com/npm/cli/commit/8c5882f3eed305bbd3514d7143f9d92e9577e1b9) [#6994](https://github.com/npm/cli/pull/6994) `strip-ansi@7.1.0`
* [`cd0c649`](https://github.com/npm/cli/commit/cd0c649ec2b421b59012854e61788a11a77194f2) [#6994](https://github.com/npm/cli/pull/6994) `ci-info@4.0.0`
* [`a0a58b7`](https://github.com/npm/cli/commit/a0a58b735c418d8555a06890b63098c68f53106e) [#6994](https://github.com/npm/cli/pull/6994) `@sigstore/tuf@2.2.0`
* [`b3a53c6`](https://github.com/npm/cli/commit/b3a53c6ab5fd933fc7f8258c155ed31be834393e) [#6949](https://github.com/npm/cli/pull/6949) `is-cidr@5.0.3` (#6949)
* [Workspace](https://github.com/npm/cli/releases/tag/config-v8.0.2): `@npmcli/config@8.0.2`
* [Workspace](https://github.com/npm/cli/releases/tag/libnpmexec-v7.0.4): `libnpmexec@7.0.4`
* [Workspace](https://github.com/npm/cli/releases/tag/libnpmpublish-v9.0.2): `libnpmpublish@9.0.2`

## [10.2.3](https://github.com/npm/cli/compare/v10.2.2...v10.2.3) (2023-11-02)

### Dependencies
5 changes: 3 additions & 2 deletions DEPENDENCIES.md
Original file line number Diff line number Diff line change
@@ -318,7 +318,7 @@ graph LR;
glob-->minimatch;
glob-->minipass;
glob-->path-scurry;
has-->function-bind;
hasown-->function-bind;
hosted-git-info-->lru-cache;
http-proxy-agent-->agent-base;
http-proxy-agent-->debug;
@@ -334,7 +334,7 @@ graph LR;
init-package-json-->validate-npm-package-license;
init-package-json-->validate-npm-package-name;
is-cidr-->cidr-regex;
is-core-module-->has;
is-core-module-->hasown;
isaacs-cliui-->string-width-cjs;
isaacs-cliui-->string-width;
isaacs-cliui-->strip-ansi-cjs;
@@ -441,6 +441,7 @@ graph LR;
libnpmversion-->require-inject;
libnpmversion-->semver;
libnpmversion-->tap;
lru-cache-->semver;
lru-cache-->yallist;
make-fetch-happen-->cacache;
make-fetch-happen-->http-cache-semantics;
5 changes: 2 additions & 3 deletions docs/lib/content/commands/npm-prune.md
Original file line number Diff line number Diff line change
@@ -16,10 +16,9 @@ then only packages matching one of the supplied names are removed.
Extraneous packages are those present in the `node_modules` folder that are
not listed as any package's dependency list.

If the `--production` flag is specified or the `NODE_ENV` environment
If the `--omit=dev` flag is specified or the `NODE_ENV` environment
variable is set to `production`, this command will remove the packages
specified in your `devDependencies`. Setting `--no-production` will negate
`NODE_ENV` being set to `production`.
specified in your `devDependencies`.

If the `--dry-run` flag is used then no changes will actually be made.

7 changes: 7 additions & 0 deletions docs/lib/content/commands/npm-view.md
Original file line number Diff line number Diff line change
@@ -28,6 +28,13 @@ For example, to show the dependencies of the `ronn` package at version
npm view ronn@0.3.5 dependencies
```

By default, `npm view` shows data about the current project context (by looking for a `package.json`).
To show field data for the current project use a file path (i.e. `.`):

```bash
npm view . dependencies
```

You can view child fields by separating them with a period.
To view the git repository URL for the latest version of `npm`, you would run the following command:

25 changes: 17 additions & 8 deletions lib/commands/exec.js
Original file line number Diff line number Diff line change
@@ -34,24 +34,33 @@ class Exec extends BaseCommand {
for (const [name, path] of this.workspaces) {
const locationMsg =
`in workspace ${this.npm.chalk.green(name)} at location:\n${this.npm.chalk.dim(path)}`
await this.callExec(args, { locationMsg, runPath: path })
await this.callExec(args, { name, locationMsg, runPath: path })
}
}

async callExec (args, { locationMsg, runPath } = {}) {
// This is where libnpmexec will look for locally installed packages
async callExec (args, { name, locationMsg, runPath } = {}) {
// This is where libnpmexec will look for locally installed packages at the project level
const localPrefix = this.npm.localPrefix
// This is where libnpmexec will look for locally installed packages at the workspace level
let localBin = this.npm.localBin
let path = localPrefix

// This is where libnpmexec will actually run the scripts from
if (!runPath) {
runPath = process.cwd()
} else {
// We have to consider if the workspace has its own separate versions
// libnpmexec will walk up to localDir after looking here
localBin = resolve(this.npm.localDir, name, 'node_modules', '.bin')
// We also need to look for `bin` entries in the workspace package.json
// libnpmexec will NOT look in the project root for the bin entry
path = runPath
}

const call = this.npm.config.get('call')
let globalPath
const {
flatOptions,
localBin,
globalBin,
globalDir,
chalk,
@@ -79,14 +88,14 @@ class Exec extends BaseCommand {
// copy args so they dont get mutated
args: [...args],
call,
localBin,
locationMsg,
chalk,
globalBin,
globalPath,
localBin,
locationMsg,
output,
chalk,
packages,
path: localPrefix,
path,
runPath,
scriptShell,
yes,
4 changes: 2 additions & 2 deletions lib/commands/outdated.js
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ const npa = require('npm-package-arg')
const pickManifest = require('npm-pick-manifest')
const localeCompare = require('@isaacs/string-locale-compare')('en')

const ansiTrim = require('strip-ansi')
const ArboristWorkspaceCmd = require('../arborist-cmd.js')

class Outdated extends ArboristWorkspaceCmd {
@@ -23,6 +22,7 @@ class Outdated extends ArboristWorkspaceCmd {
]

async exec (args) {
const { default: stripAnsi } = await import('strip-ansi')
const global = resolve(this.npm.globalDir, '..')
const where = this.npm.global
? global
@@ -106,7 +106,7 @@ class Outdated extends ArboristWorkspaceCmd {

const tableOpts = {
align: ['l', 'r', 'r', 'r', 'l'],
stringLength: s => ansiTrim(s).length,
stringLength: s => stripAnsi(s).length,
}
this.npm.output(table(outTable, tableOpts))
}
7 changes: 3 additions & 4 deletions lib/commands/pkg.js
Original file line number Diff line number Diff line change
@@ -82,10 +82,9 @@ class Pkg extends BaseCommand {
}
}

// only outputs if not running with workspaces config,
// in case you're retrieving info for workspaces the pkgWorkspaces
// will handle the output to make sure it get keyed by ws name
if (!this.npm.config.get('workspaces')) {
// only outputs if not running with workspaces config
// execWorkspaces will handle the output otherwise
if (!this.workspaces) {
this.npm.output(JSON.stringify(result, null, 2))
}

8 changes: 4 additions & 4 deletions lib/commands/search.js
Original file line number Diff line number Diff line change
@@ -81,12 +81,12 @@ class Search extends BaseCommand {

const filterStream = new FilterStream()

// Grab a configured output stream that will spit out packages in the
// desired format.
const outputStream = formatSearchStream({
const { default: stripAnsi } = await import('strip-ansi')
// Grab a configured output stream that will spit out packages in the desired format.
const outputStream = await formatSearchStream({
args, // --searchinclude options are not highlighted
...opts,
})
}, stripAnsi)

log.silly('search', 'searching packages')
const p = new Pipeline(
6 changes: 3 additions & 3 deletions lib/commands/token.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const Table = require('cli-table3')
const { v4: isCidrV4, v6: isCidrV6 } = require('is-cidr')
const log = require('../utils/log-shim.js')
const profile = require('npm-profile')

@@ -137,7 +136,7 @@ class Token extends BaseCommand {
const readonly = conf.readOnly

const password = await readUserInfo.password()
const validCIDR = this.validateCIDRList(cidr)
const validCIDR = await this.validateCIDRList(cidr)
log.info('token', 'creating')
const result = await pulseTillDone.withPromise(
otplease(this.npm, conf, c => profile.createToken(password, readonly, validCIDR, c))
@@ -209,7 +208,8 @@ class Token extends BaseCommand {
return byId
}

validateCIDRList (cidrs) {
async validateCIDRList (cidrs) {
const { v4: isCidrV4, v6: isCidrV6 } = await import('is-cidr')
const maybeList = [].concat(cidrs).filter(Boolean)
const list = maybeList.length === 1 ? maybeList[0].split(/,\s*/) : maybeList
for (const cidr of list) {
Loading