diff --git a/.changeset/strange-camels-kiss.md b/.changeset/strange-camels-kiss.md new file mode 100644 index 0000000000..f8d603fd62 --- /dev/null +++ b/.changeset/strange-camels-kiss.md @@ -0,0 +1,5 @@ +--- +"@pnpm/list": minor +--- + +Feat - add path as part of list command json output diff --git a/packages/list/src/renderJson.ts b/packages/list/src/renderJson.ts index 4f9c8d34ad..19b97942e2 100644 --- a/packages/list/src/renderJson.ts +++ b/packages/list/src/renderJson.ts @@ -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) { diff --git a/packages/list/test/index.ts b/packages/list/test/index.ts index 921b737944..276e654d1f 100644 --- a/packages/list/test/index.ts +++ b/packages/list/test/index.ts @@ -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',