[PR #3256] [CLOSED] fix(cli): simplify and correct comma insertion logic in plugin array #30323

Closed
opened 2026-04-17 21:26:43 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3256
Author: @bytaesu
Created: 7/3/2025
Status: Closed

Base: mainHead: fix/cli-plugin-comma-insertion


📝 Commits (4)

  • 95714ff fix(cli): simplify and correct comma insertion logic in plugin array
  • f99cad1 fix: handle the case where the plugin array ends with a comma
  • e1bc8fc refactor: extract needsComma for clarity
  • 589f40b fix: add edge case test code for empty plugins array

📊 Changes

2 files changed (+37 additions, -16 deletions)

View changed files

📝 packages/cli/src/generators/auth-config.ts (+8 -16)
📝 packages/cli/test/generate.test.ts (+29 -0)

📄 Description


This PR fixes an edge case bug by simplifying and cleaning up the plugin insertion logic.


For example:

◇  Would you like to set up plugins?
│  Yes
│
◇  Select your new plugins
│  none
│
◇  It looks like you're using NextJS. Do you want to add the next-cookies plugin? (Recommended)
│  Yes

Result:

import { nextCookies } from "better-auth/next-js";
import { betterAuth } from "better-auth";

export const auth = betterAuth({
    appName: "testing",
    plugins: [, nextCookies()],
});


🔄 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/3256 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 7/3/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/cli-plugin-comma-insertion` --- ### 📝 Commits (4) - [`95714ff`](https://github.com/better-auth/better-auth/commit/95714ff93afa810f559fbfbc50f55e63b3ce0de8) fix(cli): simplify and correct comma insertion logic in plugin array - [`f99cad1`](https://github.com/better-auth/better-auth/commit/f99cad1c404037f7f280c88de42c18a5d5cd3684) fix: handle the case where the plugin array ends with a comma - [`e1bc8fc`](https://github.com/better-auth/better-auth/commit/e1bc8fc521ce608ee6a8da122d611b771ce36d75) refactor: extract needsComma for clarity - [`589f40b`](https://github.com/better-auth/better-auth/commit/589f40bc16520ec767ca82169fa8ab0de548e73a) fix: add edge case test code for empty plugins array ### 📊 Changes **2 files changed** (+37 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `packages/cli/src/generators/auth-config.ts` (+8 -16) 📝 `packages/cli/test/generate.test.ts` (+29 -0) </details> ### 📄 Description --- This PR fixes an edge case bug by simplifying and cleaning up the plugin insertion logic. --- For example: ``` ◇ Would you like to set up plugins? │ Yes │ ◇ Select your new plugins │ none │ ◇ It looks like you're using NextJS. Do you want to add the next-cookies plugin? (Recommended) │ Yes ``` Result: ```ts import { nextCookies } from "better-auth/next-js"; import { betterAuth } from "better-auth"; export const auth = betterAuth({ appName: "testing", plugins: [, nextCookies()], }); ``` --- <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-17 21:26:43 -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#30323