mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-11 09:28:24 -04:00
feat(list): add workspace to list command when setting output to json (#3432)
when running pnpm list with --json flag for each workspace print the path in the json output closes #3418 Co-authored-by: Zoltan Kochan <zkochan@users.noreply.github.com>
This commit is contained in:
5
.changeset/strange-camels-kiss.md
Normal file
5
.changeset/strange-camels-kiss.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/list": minor
|
||||
---
|
||||
|
||||
Feat - add path as part of list command json output
|
||||
@@ -17,8 +17,8 @@ export default async function (
|
||||
const jsonArr = await Promise.all(pkgs.map(async (pkg) => {
|
||||
const jsonObj = {
|
||||
name: pkg.name,
|
||||
|
||||
version: pkg.version,
|
||||
path: pkg.path,
|
||||
}
|
||||
for (const dependenciesField of [...DEPENDENCIES_FIELDS.sort(), 'unsavedDependencies']) {
|
||||
if (pkg[dependenciesField]?.length) {
|
||||
|
||||
@@ -245,7 +245,7 @@ test('JSON list with depth 1', async () => {
|
||||
expect(await list([fixture], { reportAs: 'json', depth: 1, lockfileDir: fixture })).toBe(JSON.stringify([{
|
||||
name: 'fixture',
|
||||
version: '1.0.0',
|
||||
|
||||
path: fixture,
|
||||
dependencies: {
|
||||
'write-json-file': {
|
||||
from: 'write-json-file',
|
||||
@@ -320,12 +320,11 @@ test('JSON list with aliased dep', async () => {
|
||||
{
|
||||
name: 'with-aliased-dep',
|
||||
version: '1.0.0',
|
||||
|
||||
path: fixtureWithAliasedDep,
|
||||
dependencies: {
|
||||
positive: {
|
||||
from: 'is-positive',
|
||||
version: '1.0.0',
|
||||
|
||||
resolved: 'https://registry.npmjs.org/is-positive/-/is-positive-1.0.0.tgz',
|
||||
},
|
||||
},
|
||||
@@ -338,7 +337,7 @@ test('JSON list with aliased dep', async () => {
|
||||
JSON.stringify([{
|
||||
name: 'with-aliased-dep',
|
||||
version: '1.0.0',
|
||||
|
||||
path: fixtureWithAliasedDep,
|
||||
dependencies: {
|
||||
positive: {
|
||||
from: 'is-positive',
|
||||
|
||||
Reference in New Issue
Block a user