Skip to content

feat(core): support --skip-third-party flag in nx migrate#35497

Draft
leosvelperez wants to merge 2 commits intomasterfrom
nxc-4076
Draft

feat(core): support --skip-third-party flag in nx migrate#35497
leosvelperez wants to merge 2 commits intomasterfrom
nxc-4076

Conversation

@leosvelperez
Copy link
Copy Markdown
Member

Current Behavior

nx migrate <target> always processes every entry in the resolved packageJsonUpdates, including third-party packages outside the target's nx.packageGroup. There is no way to scope a migration run to the target package and its package group.

Expected Behavior

Adds an opt-in --skip-third-party flag to nx migrate:

  • When set, packageJsonUpdates is filtered down to packages in the target version's fetched nx.packageGroup (plus the target itself and nx). Third-party packages are dropped before they enter the result, and entries that contain only third-party packages collapse to empty and are dropped.
  • Mixed entries are preserved, keeping only the first-party packages.
  • Mechanism is target-agnostic — the filter is just package name ∈ targetPackageGroup, so the flag works for any target whose metadata defines a packageGroup.

This lets users migrate Nx (or any framework that ships a package group) to a new version without bumping any third-party packages whose updates Nx happens to manage.

@leosvelperez leosvelperez self-assigned this Apr 29, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 29, 2026

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit 3217b02
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/69f343e97283b3000861c535
😎 Deploy Preview https://deploy-preview-35497--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 29, 2026

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 3217b02
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/69f343e991b4340008a882ed
😎 Deploy Preview https://deploy-preview-35497--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Apr 29, 2026

View your CI Pipeline Execution ↗ for commit 3217b02

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ❌ Failed 56m 40s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3s View ↗
nx-cloud record -- pnpm nx-cloud conformance:check ✅ Succeeded 16s View ↗
nx build workspace-plugin ✅ Succeeded <1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 22s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 6s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-30 12:58:33 UTC

@leosvelperez leosvelperez force-pushed the nxc-4076 branch 3 times, most recently from 136ec94 to 1c34504 Compare April 29, 2026 16:41
Copy link
Copy Markdown
Contributor

@nx-cloud nx-cloud Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nx Cloud is proposing a fix for your failed CI:

We added writable: true to all Object.defineProperty calls in the resolveMode test block to fix cross-suite pollution in Jest workers. Without this flag, process.stdin.isTTY was being made non-writable, causing analytics-prompt.spec.ts tests that use direct property assignment to throw TypeError: Cannot assign to read only property 'isTTY'.

Warning

We could not verify this fix.

Suggested Fix changes
diff --git a/packages/nx/src/command-line/migrate/migrate.spec.ts b/packages/nx/src/command-line/migrate/migrate.spec.ts
index 39f7efefef..6f66022d09 100644
--- a/packages/nx/src/command-line/migrate/migrate.spec.ts
+++ b/packages/nx/src/command-line/migrate/migrate.spec.ts
@@ -2268,6 +2268,7 @@ describe('Migration', () => {
       Object.defineProperty(process.stdin, 'isTTY', {
         value: originalTty,
         configurable: true,
+        writable: true,
       });
     });
 
@@ -2275,6 +2276,7 @@ describe('Migration', () => {
       Object.defineProperty(process.stdin, 'isTTY', {
         value: true,
         configurable: true,
+        writable: true,
       });
       process.env.CI = 'false';
       const result = await resolveMode('first-party');
@@ -2286,6 +2288,7 @@ describe('Migration', () => {
       Object.defineProperty(process.stdin, 'isTTY', {
         value: false,
         configurable: true,
+        writable: true,
       });
       process.env.CI = 'false';
       const result = await resolveMode(undefined);
@@ -2297,6 +2300,7 @@ describe('Migration', () => {
       Object.defineProperty(process.stdin, 'isTTY', {
         value: true,
         configurable: true,
+        writable: true,
       });
       process.env.CI = 'true';
       const result = await resolveMode(undefined);
@@ -2308,6 +2312,7 @@ describe('Migration', () => {
       Object.defineProperty(process.stdin, 'isTTY', {
         value: true,
         configurable: true,
+        writable: true,
       });
       process.env.CI = 'false';
       mockPrompt.mockReturnValueOnce(Promise.resolve({ mode: 'first-party' }));

🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.

Apply fix via Nx Cloud  Reject fix via Nx Cloud


Or Apply changes locally with:

npx nx-cloud apply-locally x9D8-9EnX

Apply fix locally with your editor ↗   View interactive diff ↗



🎓 Learn more about Self-Healing CI on nx.dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant