laney a5ccd13f92
feat(core): update getTouchedProjectsFromLockFile to detect which projects were changed from pnpm lock file diff (#31091)
…jects were changed from pnpm lock file diff

Closes #29986

## Current Behavior

Nx projects that use pnpm catalogs cannot take advantage of the
`projectsAffectedByDependencyUpdates` `“auto”` setting because updating
catalog versions does not touch project files.

## Expected Behavior

When `projectsAffectedByDependencyUpdates` is set to `“auto”`, updating
a catalog dependency version should result in all projects that use it
getting marked as affected.

A catalog version update and the affected projects can be detected from
a changed pnpm lock file. This PR updates the
`getTouchedProjectsFromLockFile` logic to check the lock file for pnpm
monorepos.

Example pnpm lock file diff after catalog dependency update:

```diff
# pnpm-lock.yaml

# ...

catalogs:
  default:
    '@aws-sdk/client-s3':
-      specifier: ^3.535.0
-      version: 3.535.0
+      specifier: ^3.797.0
+      version: 3.797.0

importers:

  apps/app1:
    dependencies:
      '@aws-sdk/client-s3':
        specifier: 'catalog:'
-        version: 3.535.0
+        version: 3.797.0

# ...
```

## Related Issue(s)

https://github.com/nrwl/nx/issues/29986

Fixes #29986

---------

Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
2025-05-16 13:17:45 -04:00
2019-03-07 13:23:11 -05:00

Nx - Smart Monorepos · Fast CI

CircleCI License NPM Version Semantic Release Commitizen friendly Join the chat at https://gitter.im/nrwl-nx/community Join the Official Nx Discord Server


Smart Monorepos · Fast CI

Build system, optimized for monorepos, with AI-powered architectural awareness and advanced CI capabilities.

Create a new Nx workspace with

npx create-nx-workspace

...or run

npx nx init

to add Nx to your existing workspace to get faster task scheduling, caching and more. More in the docs.

Learn about CI with Nx Cloud

Nx Cloud connects directly to your existing CI setup, helping you scale your monorepos on CI by leveraging remote caching, task distribution across multiple machines, automated e2e test splitting and automated task flakiness detection

Connect your existing Nx workspace with

npx nx connect

Learn more in the Nx CI docs »

Nx - Smart Monorepos · Fast CI

Want to help?

If you want to file a bug or submit a PR, read up on our guidelines for contributing and watch this video that will help you get started.

Nx - How to contribute video

Core Team

Victor Savkin Jason Jean Benjamin Cabanes Jack Hsu
Victor Savkin Jason Jean Benjamin Cabanes Jack Hsu
vsavkin FrozenPandaz bcabanes jaysoo
James Henry Jon Cammisuli Isaac Mann Juri Strumpflohner
James Henry Jon Cammisuli Isaac Mann Juri Strumpflohner
JamesHenry cammisuli isaacplmann juristr
Philip Fulcher Caleb Ukle Katerina Skroumpelou Colum Ferry
Philip Fulcher Caleb Ukle Katerina Skroumpelou Colum Ferry
philipjfulcher barbados-clemens mandarini Coly010
Emily Xiong Miroslav Jonaš Leosvel Pérez Espinosa Zachary DeRose
Emily Xiong Miroslav Jonaš Leosvel Pérez Espinosa Zachary DeRose
xiongemi meeroslav leosvelperez ZackDeRose
Craigory Coppola Chau Tran Nicholas Cunningham Max Kless
Craigory Coppola Chau Tran Nicholas Cunningham Max Kless
AgentEnder nartc ndcunningham MaxKless
Description
No description provided
Readme 619 MiB
Languages
TypeScript 95%
Rust 2.9%
JavaScript 1.3%
Kotlin 0.3%
MDX 0.3%
Other 0.1%