[PR #6201] [CLOSED] feat(cli): enable direct package installation with explicit bin command #23417

Closed
opened 2026-04-15 21:42:19 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6201
Author: @mburumaxwell
Created: 11/22/2025
Status: Closed

Base: canaryHead: feat/cli-explicit-bin-command


📝 Commits (1)

  • 5266ff1 feat(cli): enable direct package installation with explicit bin command

📊 Changes

2 files changed (+8 additions, -2 deletions)

View changed files

📝 packages/cli/package.json (+3 -1)
📝 packages/cli/test/utils.ts (+5 -1)

📄 Description

Changes

  • Updated bin field in packages/cli/package.json from a string to an object with explicit command name mapping: { "better-auth": "./dist/index.mjs" }

Motivation

The current CLI setup works well with npx @better-auth/cli@latest, but this approach has some limitations:

  • Shadow installs the package every time (or uses cache)
  • Cannot lock CLI version alongside other better-auth packages
  • Difficult to ensure all team members use the same CLI version

With this change, projects can now:

  • Install CLI as a dev dependency: pnpm install -D @better-auth/cli
  • Execute with locked version: pnpm exec better-auth <command>
  • Manage CLI updates together with other better-auth package updates
  • Avoid repeated installations

Usage Examples

After this change:

# Install as dev dependency
pnpm install -D @better-auth/cli

# Run commands using project's installed version
pnpm exec better-auth init
pnpm exec better-auth generate
pnpm exec better-auth migrate

# Or install globally
pnpm install -g @better-auth/cli
better-auth init

Existing npx usage still works:

npx @better-auth/cli@latest init

Summary by cubic

Exposes the better-auth CLI as a direct command via an explicit bin mapping. Allows installing and running a pinned CLI version without relying on repeated npx installs.

  • New Features
    • Install as a dev dependency and run with: pnpm exec better-auth .
    • Global install supported: better-auth .
    • Lock CLI version with the project; npx usage still works.

Written for commit 5266ff14e6. Summary will update automatically on new commits.


🔄 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/6201 **Author:** [@mburumaxwell](https://github.com/mburumaxwell) **Created:** 11/22/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `feat/cli-explicit-bin-command` --- ### 📝 Commits (1) - [`5266ff1`](https://github.com/better-auth/better-auth/commit/5266ff14e63ba66147f9c15dae0da81b12e9102e) feat(cli): enable direct package installation with explicit bin command ### 📊 Changes **2 files changed** (+8 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/cli/package.json` (+3 -1) 📝 `packages/cli/test/utils.ts` (+5 -1) </details> ### 📄 Description ## Changes - Updated `bin` field in `packages/cli/package.json` from a string to an object with explicit command name mapping: `{ "better-auth": "./dist/index.mjs" }` ## Motivation The current CLI setup works well with `npx @better-auth/cli@latest`, but this approach has some limitations: - Shadow installs the package every time (or uses cache) - Cannot lock CLI version alongside other better-auth packages - Difficult to ensure all team members use the same CLI version With this change, projects can now: - Install CLI as a dev dependency: `pnpm install -D @better-auth/cli` - Execute with locked version: `pnpm exec better-auth <command>` - Manage CLI updates together with other better-auth package updates - Avoid repeated installations ## Usage Examples **After this change:** ```bash # Install as dev dependency pnpm install -D @better-auth/cli # Run commands using project's installed version pnpm exec better-auth init pnpm exec better-auth generate pnpm exec better-auth migrate # Or install globally pnpm install -g @better-auth/cli better-auth init ``` **Existing npx usage still works:** ```bash npx @better-auth/cli@latest init ``` <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Exposes the better-auth CLI as a direct command via an explicit bin mapping. Allows installing and running a pinned CLI version without relying on repeated npx installs. - New Features - Install as a dev dependency and run with: pnpm exec better-auth <command>. - Global install supported: better-auth <command>. - Lock CLI version with the project; npx usage still works. <sup>Written for commit 5266ff14e63ba66147f9c15dae0da81b12e9102e. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <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 21:42:19 -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#23417