Skip to content

fix: resolve migration failure when tsconfig specifies rootDir#69194

Open
aparzi wants to merge 1 commit into
angular:mainfrom
aparzi:fix-run-migration-devkit
Open

fix: resolve migration failure when tsconfig specifies rootDir#69194
aparzi wants to merge 1 commit into
angular:mainfrom
aparzi:fix-run-migration-devkit

Conversation

@aparzi
Copy link
Copy Markdown
Contributor

@aparzi aparzi commented Jun 5, 2026

When rootDir was set in a project's tsconfig (e.g. rootDir: "src"), tsurge-based migrations would fail because projectRoot was derived from rootDir, causing rootRelativePath to be computed relative to src/ instead of the workspace root. This produced paths like app/app.ts instead of src/app/app.ts, which the DevKit tree could not resolve.

Fix by overriding info.projectRoot to fs.pwd() (always / in the DevKit filesystem) immediately after program creation, ensuring workspace-relative paths are used for all tree updates.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

When `rootDir` was set in a project's tsconfig (e.g. `rootDir: "src"`),
tsurge-based migrations would fail because `projectRoot` was derived from
`rootDir`, causing `rootRelativePath` to be computed relative to `src/`
instead of the workspace root. This produced paths like `app/app.ts`
instead of `src/app/app.ts`, which the DevKit tree could not resolve.

Fix by overriding `info.projectRoot` to `fs.pwd()` (always `/` in the
DevKit filesystem) immediately after program creation, ensuring
workspace-relative paths are used for all tree updates.
@pullapprove pullapprove Bot requested a review from kirjs June 5, 2026 15:40
@alan-agius4 alan-agius4 requested review from devversion and removed request for kirjs June 5, 2026 16:02
@pullapprove pullapprove Bot requested review from kirjs and removed request for devversion June 5, 2026 16:02
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