[PR #8520] [MERGED] fix(cli): resolve path aliases from extended tsconfig files #16279

Closed
opened 2026-04-13 10:28:54 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8520
Author: @himself65
Created: 3/9/2026
Status: Merged
Merged: 3/9/2026
Merged by: @himself65

Base: canaryHead: fix/cli-tsconfig-extends-path-alias


📝 Commits (5)

  • af5cdc0 fix(cli): resolve path aliases from extended tsconfig files
  • 191e5e4 fix(cli): use @src/* alias pattern in extends test
  • f66201e refactor(cli): use get-tsconfig for tsconfig resolution
  • 0c36b2e fix(cli): handle direct tsconfig file references and knip config
  • c53facd refactor(cli): simplify tsconfig alias resolution

📊 Changes

6 files changed (+309 additions, -106 deletions)

View changed files

📝 knip.jsonc (+1 -0)
📝 packages/cli/package.json (+1 -0)
📝 packages/cli/src/utils/get-config.ts (+78 -66)
packages/cli/src/utils/get-tsconfig-info.ts (+0 -27)
📝 packages/cli/test/get-config.test.ts (+213 -0)
📝 pnpm-lock.yaml (+16 -13)

📄 Description

Summary

  • Fix CLI failing to resolve TypeScript path aliases when defined in a parent tsconfig via extends
  • Replace hand-rolled tsconfig parsing with get-tsconfig which properly handles extends (including chained and array extends), baseUrl, and paths resolution
  • Keep a thin references traversal layer since get-tsconfig strips the references field during extends resolution
  • Remove now-unused getTsconfigInfo import and custom resolveExtendsPath/resolveReferencePath/getPathAliasesRecursive functions

Closes #6373

Test plan

  • Added 3 integration tests: basic extends, chained extends, and child override
  • pnpm typecheck passes
  • pnpm lint passes

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/8520 **Author:** [@himself65](https://github.com/himself65) **Created:** 3/9/2026 **Status:** ✅ Merged **Merged:** 3/9/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix/cli-tsconfig-extends-path-alias` --- ### 📝 Commits (5) - [`af5cdc0`](https://github.com/better-auth/better-auth/commit/af5cdc02613d69bcf581dd5fa25ce8af52435257) fix(cli): resolve path aliases from extended tsconfig files - [`191e5e4`](https://github.com/better-auth/better-auth/commit/191e5e4ec533d2f4125e2e6c8511bae0e24a33d7) fix(cli): use @src/* alias pattern in extends test - [`f66201e`](https://github.com/better-auth/better-auth/commit/f66201e77e58a13a4af3744b72f1805d47e80617) refactor(cli): use get-tsconfig for tsconfig resolution - [`0c36b2e`](https://github.com/better-auth/better-auth/commit/0c36b2eb9f521defcee46a38aab7e759d3d26197) fix(cli): handle direct tsconfig file references and knip config - [`c53facd`](https://github.com/better-auth/better-auth/commit/c53facd8219e683f5274c28549f7e71675a68eca) refactor(cli): simplify tsconfig alias resolution ### 📊 Changes **6 files changed** (+309 additions, -106 deletions) <details> <summary>View changed files</summary> 📝 `knip.jsonc` (+1 -0) 📝 `packages/cli/package.json` (+1 -0) 📝 `packages/cli/src/utils/get-config.ts` (+78 -66) ➖ `packages/cli/src/utils/get-tsconfig-info.ts` (+0 -27) 📝 `packages/cli/test/get-config.test.ts` (+213 -0) 📝 `pnpm-lock.yaml` (+16 -13) </details> ### 📄 Description ## Summary - Fix CLI failing to resolve TypeScript path aliases when defined in a parent tsconfig via `extends` - Replace hand-rolled tsconfig parsing with [`get-tsconfig`](https://github.com/privatenumber/get-tsconfig) which properly handles `extends` (including chained and array extends), `baseUrl`, and `paths` resolution - Keep a thin references traversal layer since `get-tsconfig` strips the `references` field during extends resolution - Remove now-unused `getTsconfigInfo` import and custom `resolveExtendsPath`/`resolveReferencePath`/`getPathAliasesRecursive` functions Closes #6373 ## Test plan - [x] Added 3 integration tests: basic extends, chained extends, and child override - [x] `pnpm typecheck` passes - [x] `pnpm lint` passes --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 10:28:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#16279