mirror of
https://github.com/pnpm/pnpm.git
synced 2026-07-26 07:27:20 -04:00
7
.changeset/famous-tigers-protect.md
Normal file
7
.changeset/famous-tigers-protect.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-listing": patch
|
||||
"@pnpm/list": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Fix issue where `pnpm list --json pkg` shows `"private": false` for a private package [#8519](https://github.com/pnpm/pnpm/issues/8519).
|
||||
@@ -87,6 +87,7 @@ export async function searchForPackages (
|
||||
return {
|
||||
name: entryPkg.name,
|
||||
version: entryPkg.version,
|
||||
private: entryPkg.private,
|
||||
|
||||
path: projectPath,
|
||||
...buildDependenciesHierarchy,
|
||||
|
||||
@@ -133,6 +133,7 @@ export type ListCommandOptions = Pick<Config,
|
||||
alwaysPrintRootPackage?: boolean
|
||||
depth?: number
|
||||
excludePeers?: boolean
|
||||
json?: boolean
|
||||
lockfileDir?: string
|
||||
long?: boolean
|
||||
parseable?: boolean
|
||||
|
||||
31
reviewing/plugin-commands-listing/test/json.ts
Normal file
31
reviewing/plugin-commands-listing/test/json.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { list } from '@pnpm/plugin-commands-listing'
|
||||
import { prepare } from '@pnpm/prepare'
|
||||
import { DEFAULT_OPTS } from './utils'
|
||||
|
||||
// Covers https://github.com/pnpm/pnpm/issues/8519
|
||||
describe('correctly report the value of the private field when arguments are provided', () => {
|
||||
test.each([
|
||||
[undefined, false],
|
||||
[false, false],
|
||||
[true, true],
|
||||
])('%s -> %s', async (given, expected) => {
|
||||
prepare({
|
||||
name: 'root',
|
||||
version: '0.0.0',
|
||||
private: given,
|
||||
})
|
||||
|
||||
const output = await list.handler({
|
||||
...DEFAULT_OPTS,
|
||||
dir: process.cwd(),
|
||||
json: true,
|
||||
}, ['root'])
|
||||
|
||||
expect(JSON.parse(output)).toStrictEqual([{
|
||||
name: 'root',
|
||||
version: '0.0.0',
|
||||
private: expected,
|
||||
path: expect.any(String),
|
||||
}])
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user