[PR #8637] [MERGED] fix(cli): warn when old @better-auth/cli is used with better-auth v1.5.x+ #25010

Closed
opened 2026-04-15 22:41:22 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

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

Base: v1.4.xHead: fix/cli-version-warning-1.5.x


📝 Commits (1)

  • 32a1a62 fix(cli): warn when old @better-auth/cli is used with better-auth v1.5.x+

📊 Changes

2 files changed (+106 additions, -0 deletions)

View changed files

📝 packages/cli/src/index.ts (+25 -0)
packages/cli/test/version-warning.test.ts (+81 -0)

📄 Description

Summary

Closes #8622

  • When the old @better-auth/cli detects better-auth >= 1.5.0 is installed, it prints a warning directing users to npx auth@latest
  • Uses createRequire from the user's CWD to resolve better-auth's package.json and semver.gte for version comparison
  • Uses chalk for terminal colors (consistent with the rest of the CLI, respects NO_COLOR)
  • Silently skips the check if better-auth is not installed yet

This is the correct target branch (v1.4.x) since the warning belongs in the old @better-auth/cli package, not the new auth CLI on canary.

See also: #8624 (same intent but incorrectly targets canary)

Test plan

  • Install better-auth@1.5.0 in a test project, run npx @better-auth/cli generate — should see the yellow warning
  • Install better-auth@1.4.21 in a test project, run npx @better-auth/cli generate — should NOT see a warning
  • Uninstall better-auth entirely, run npx @better-auth/cli init — should NOT see a warning (silent skip)

🔄 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/8637 **Author:** [@himself65](https://github.com/himself65) **Created:** 3/16/2026 **Status:** ✅ Merged **Merged:** 3/16/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `v1.4.x` ← **Head:** `fix/cli-version-warning-1.5.x` --- ### 📝 Commits (1) - [`32a1a62`](https://github.com/better-auth/better-auth/commit/32a1a62eb5efcedd36b876052163bd8158936a4d) fix(cli): warn when old @better-auth/cli is used with better-auth v1.5.x+ ### 📊 Changes **2 files changed** (+106 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/cli/src/index.ts` (+25 -0) ➕ `packages/cli/test/version-warning.test.ts` (+81 -0) </details> ### 📄 Description ## Summary Closes #8622 - When the old `@better-auth/cli` detects `better-auth` >= 1.5.0 is installed, it prints a warning directing users to `npx auth@latest` - Uses `createRequire` from the user's CWD to resolve `better-auth`'s `package.json` and `semver.gte` for version comparison - Uses `chalk` for terminal colors (consistent with the rest of the CLI, respects `NO_COLOR`) - Silently skips the check if `better-auth` is not installed yet This is the correct target branch (`v1.4.x`) since the warning belongs in the **old** `@better-auth/cli` package, not the new `auth` CLI on `canary`. See also: #8624 (same intent but incorrectly targets `canary`) ## Test plan - [ ] Install `better-auth@1.5.0` in a test project, run `npx @better-auth/cli generate` — should see the yellow warning - [ ] Install `better-auth@1.4.21` in a test project, run `npx @better-auth/cli generate` — should NOT see a warning - [ ] Uninstall `better-auth` entirely, run `npx @better-auth/cli init` — should NOT see a warning (silent skip) --- <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-15 22:41:22 -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#25010