Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/node-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
echo "::group::packing npm release $npmVersion"
pushd "$npmDir" >/dev/null
node scripts/resetdeps.js
npmtarball="$(node . pack --loglevel=silent --json | jq -r .[0].filename)"
npmtarball="$(node . pack --loglevel=silent --json | jq -r 'to_entries[0].value.filename')"
tar czf "$npmFile" -C "$npmDir" .
popd >/dev/null
echo "npm=$npmFile" >> $GITHUB_OUTPUT
Expand Down
12 changes: 6 additions & 6 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
".": "12.0.0",
"workspaces/arborist": "10.0.0",
".": "12.0.1",
"workspaces/arborist": "10.0.1",
"workspaces/libnpmaccess": "11.0.0",
"workspaces/libnpmdiff": "9.0.0",
"workspaces/libnpmexec": "11.0.0",
"workspaces/libnpmfund": "8.0.0",
"workspaces/libnpmdiff": "9.0.1",
"workspaces/libnpmexec": "11.0.1",
"workspaces/libnpmfund": "8.0.1",
"workspaces/libnpmorg": "9.0.0",
"workspaces/libnpmpack": "10.0.0",
"workspaces/libnpmpack": "10.0.1",
"workspaces/libnpmpublish": "12.0.0",
"workspaces/libnpmsearch": "10.0.0",
"workspaces/libnpmteam": "9.0.0",
Expand Down
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -1035,3 +1035,4 @@ Dale Lakes <6843636+dale-lakes@users.noreply.github.com>
rijildaniel <40638987+rijildaniel@users.noreply.github.com>
UB <ubed@bugqore.com>
Justin Clark <u2mejc@users.noreply.github.com>
James Prevett <jp@jamespre.dev>
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## [12.0.1](https://github.com/npm/cli/compare/v12.0.0...v12.0.1) (2026-07-10)
### Bug Fixes
* [`ecb02a8`](https://github.com/npm/cli/commit/ecb02a88a7ca0940d25957d941dc7c66736af4f7) [#9745](https://github.com/npm/cli/pull/9745) view: avoid wrapping array results (#9745) (@reggi, @martinrrm, @Copilot)
* [`47fc8b1`](https://github.com/npm/cli/commit/47fc8b191a841ec177f2d7d486dde1b66dc0045c) [#9740](https://github.com/npm/cli/pull/9740) correct bundled sigstore from dev dependency conflict (#9740) (@james-pre)


### Dependencies

* [workspace](https://github.com/npm/cli/releases/tag/arborist-v10.0.1): `@npmcli/arborist@10.0.1`
* [workspace](https://github.com/npm/cli/releases/tag/libnpmdiff-v9.0.1): `libnpmdiff@9.0.1`
* [workspace](https://github.com/npm/cli/releases/tag/libnpmexec-v11.0.1): `libnpmexec@11.0.1`
* [workspace](https://github.com/npm/cli/releases/tag/libnpmfund-v8.0.1): `libnpmfund@8.0.1`
* [workspace](https://github.com/npm/cli/releases/tag/libnpmpack-v10.0.1): `libnpmpack@10.0.1`

## [12.0.0](https://github.com/npm/cli/compare/v12.0.0-pre.3...v12.0.0) (2026-07-08)
### ⚠️ BREAKING CHANGES
* npm view --json now always returns an array.
Expand Down
4 changes: 3 additions & 1 deletion docs/lib/content/commands/npm-view.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ If only a single string field for a single version is output, then it will not b
If the field is an object, it will be output as a JavaScript object literal.

If the `--json` flag is given, the outputted fields will be JSON.
The output is always an array, even if only a single version matches.
Scalar and object results are returned in an array, even if only a single version matches.
When the output contains one array-valued result, that array is returned directly without an additional result wrapper.
Multiple array-valued results remain separate items in the outer results array.

If the version range matches multiple versions then each printed value will be prefixed with the version it applies to.

Expand Down
5 changes: 4 additions & 1 deletion lib/commands/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,15 @@ class View extends BaseCommand {
})

if (json) {
// Users can expect an array .
const first = Object.keys(res[0] || {})
const jsonRes = first.length === 1 ? res.map(m => m[first[0]]) : res
if (jsonRes.length === 0) {
return
}
// Avoid wrapping a single array-valued result in another array.
if (jsonRes.length === 1 && Array.isArray(jsonRes[0])) {
return jsonRes[0]
}
return jsonRes
}

Expand Down
32 changes: 16 additions & 16 deletions package-lock.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "npm",
"version": "12.0.0",
"version": "12.0.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "npm",
"version": "12.0.0",
"version": "12.0.1",
"bundleDependencies": [
"@isaacs/string-locale-compare",
"@npmcli/arborist",
Expand Down Expand Up @@ -87,7 +87,7 @@
],
"dependencies": {
"@isaacs/string-locale-compare": "^1.1.0",
"@npmcli/arborist": "^10.0.0",
"@npmcli/arborist": "^10.0.1",
"@npmcli/config": "^11.0.0",
"@npmcli/fs": "^6.0.0",
"@npmcli/git": "^8.0.0",
Expand Down Expand Up @@ -115,11 +115,11 @@
"is-cidr": "^7.0.0",
"json-parse-even-better-errors": "^6.0.0",
"libnpmaccess": "^11.0.0",
"libnpmdiff": "^9.0.0",
"libnpmexec": "^11.0.0",
"libnpmfund": "^8.0.0",
"libnpmdiff": "^9.0.1",
"libnpmexec": "^11.0.1",
"libnpmfund": "^8.0.1",
"libnpmorg": "^9.0.0",
"libnpmpack": "^10.0.0",
"libnpmpack": "^10.0.1",
"libnpmpublish": "^12.0.0",
"libnpmsearch": "^10.0.0",
"libnpmteam": "^9.0.0",
Expand Down Expand Up @@ -14947,7 +14947,7 @@
},
"workspaces/arborist": {
"name": "@npmcli/arborist",
"version": "10.0.0",
"version": "10.0.1",
"license": "ISC",
"dependencies": {
"@gar/promise-retry": "^1.0.0",
Expand Down Expand Up @@ -15047,10 +15047,10 @@
}
},
"workspaces/libnpmdiff": {
"version": "9.0.0",
"version": "9.0.1",
"license": "ISC",
"dependencies": {
"@npmcli/arborist": "^10.0.0",
"@npmcli/arborist": "^10.0.1",
"@npmcli/installed-package-contents": "^5.0.0",
"binary-extensions": "^3.0.0",
"diff": "^8.0.2",
Expand All @@ -15069,11 +15069,11 @@
}
},
"workspaces/libnpmexec": {
"version": "11.0.0",
"version": "11.0.1",
"license": "ISC",
"dependencies": {
"@gar/promise-retry": "^1.0.0",
"@npmcli/arborist": "^10.0.0",
"@npmcli/arborist": "^10.0.1",
"@npmcli/package-json": "^8.0.0",
"@npmcli/run-script": "^11.0.0",
"ci-info": "^4.0.0",
Expand All @@ -15100,10 +15100,10 @@
}
},
"workspaces/libnpmfund": {
"version": "8.0.0",
"version": "8.0.1",
"license": "ISC",
"dependencies": {
"@npmcli/arborist": "^10.0.0"
"@npmcli/arborist": "^10.0.1"
},
"devDependencies": {
"@npmcli/eslint-config": "^5.0.1",
Expand Down Expand Up @@ -15133,10 +15133,10 @@
}
},
"workspaces/libnpmpack": {
"version": "10.0.0",
"version": "10.0.1",
"license": "ISC",
"dependencies": {
"@npmcli/arborist": "^10.0.0",
"@npmcli/arborist": "^10.0.1",
"@npmcli/run-script": "^11.0.0",
"npm-package-arg": "^14.0.0",
"pacote": "^22.0.0"
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "12.0.0",
"version": "12.0.1",
"name": "npm",
"description": "a package manager for JavaScript",
"workspaces": [
Expand Down Expand Up @@ -48,7 +48,7 @@
},
"dependencies": {
"@isaacs/string-locale-compare": "^1.1.0",
"@npmcli/arborist": "^10.0.0",
"@npmcli/arborist": "^10.0.1",
"@npmcli/config": "^11.0.0",
"@npmcli/fs": "^6.0.0",
"@npmcli/git": "^8.0.0",
Expand Down Expand Up @@ -76,11 +76,11 @@
"is-cidr": "^7.0.0",
"json-parse-even-better-errors": "^6.0.0",
"libnpmaccess": "^11.0.0",
"libnpmdiff": "^9.0.0",
"libnpmexec": "^11.0.0",
"libnpmfund": "^8.0.0",
"libnpmdiff": "^9.0.1",
"libnpmexec": "^11.0.1",
"libnpmfund": "^8.0.1",
"libnpmorg": "^9.0.0",
"libnpmpack": "^10.0.0",
"libnpmpack": "^10.0.1",
"libnpmpublish": "^12.0.0",
"libnpmsearch": "^10.0.0",
"libnpmteam": "^9.0.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/template-oss/node-integration-yml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
echo "::group::packing npm release $npmVersion"
pushd "$npmDir" >/dev/null
node scripts/resetdeps.js
npmtarball="$(node . pack --loglevel=silent --json | jq -r .[0].filename)"
npmtarball="$(node . pack --loglevel=silent --json | jq -r 'to_entries[0].value.filename')"
tar czf "$npmFile" -C "$npmDir" .
popd >/dev/null
echo "npm=$npmFile" >> $GITHUB_OUTPUT
Expand Down
Loading
Loading