[PR #5006] [CLOSED] refactor: move utils to core #5712

Closed
opened 2026-03-13 12:32:35 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5006
Author: @himself65
Created: 9/30/2025
Status: Closed

Base: canaryHead: himself65/2025/09/30/refactor/utils


📝 Commits (4)

  • 9cf4ba4 refactor: move utils to core
  • 67bbb4d refactor: move utils to core
  • 13e1ef2 refactor: move utils to core
  • c272d12 fix: restrict export

📊 Changes

109 files changed (+265 additions, -118 deletions)

View changed files

📝 packages/better-auth/src/adapters/adapter-factory/index.ts (+6 -3)
📝 packages/better-auth/src/adapters/create-test-suite.ts (+2 -2)
📝 packages/better-auth/src/adapters/memory-adapter/memory-adapter.ts (+1 -1)
📝 packages/better-auth/src/adapters/test-adapter.ts (+1 -1)
📝 packages/better-auth/src/adapters/test.ts (+1 -1)
📝 packages/better-auth/src/api/index.ts (+1 -1)
📝 packages/better-auth/src/api/middlewares/origin-check.ts (+1 -1)
📝 packages/better-auth/src/api/rate-limiter/index.ts (+2 -2)
📝 packages/better-auth/src/api/routes/account.test.ts (+1 -1)
📝 packages/better-auth/src/api/routes/callback.ts (+2 -2)
📝 packages/better-auth/src/api/routes/error.ts (+1 -1)
📝 packages/better-auth/src/api/routes/ok.ts (+1 -1)
📝 packages/better-auth/src/api/routes/reset-password.ts (+2 -2)
📝 packages/better-auth/src/api/routes/session-api.test.ts (+1 -1)
📝 packages/better-auth/src/api/routes/session.ts (+2 -2)
📝 packages/better-auth/src/api/routes/sign-in.ts (+1 -1)
📝 packages/better-auth/src/api/to-auth-endpoints.ts (+1 -1)
📝 packages/better-auth/src/client/proxy.ts (+1 -1)
📝 packages/better-auth/src/client/solid/index.ts (+1 -1)
📝 packages/better-auth/src/client/svelte/index.ts (+1 -1)

...and 80 more files

📄 Description

Summary by cubic

Centralized shared utilities under @better-auth/core and updated all imports to use the new subpath. This streamlines helper usage across packages with no behavior changes.

  • Refactors

    • Added @better-auth/core/utils entry and re-exported utility modules.
    • Updated better-auth imports to point to @better-auth/core/utils (json, date, logger, colors, id, wildcard, time, etc.).
    • Removed better-auth/src/utils and stopped exporting utils from better-auth’s index.
    • Introduced env helpers in core (env, ENV, getEnvVar, isProduction/isDevelopment).
    • Updated core build config and package.json to publish the utils subpath.
  • Migration

    • Replace any imports from better-auth/utils or better-auth/src/utils with @better-auth/core/utils (or specific deep paths like @better-auth/core/utils/logger).
    • For OAuth state, import generateState from better-auth/oauth2/state.

🔄 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/5006 **Author:** [@himself65](https://github.com/himself65) **Created:** 9/30/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `himself65/2025/09/30/refactor/utils` --- ### 📝 Commits (4) - [`9cf4ba4`](https://github.com/better-auth/better-auth/commit/9cf4ba443ad9056feeba4c8a876fc7e6b25d41fe) refactor: move utils to core - [`67bbb4d`](https://github.com/better-auth/better-auth/commit/67bbb4db05f0a38ccbdb9b5ad4d0f15203f00fe8) refactor: move utils to core - [`13e1ef2`](https://github.com/better-auth/better-auth/commit/13e1ef25ce9a5b3ab18cd5c6f964156b8ac6ac17) refactor: move utils to core - [`c272d12`](https://github.com/better-auth/better-auth/commit/c272d12e6e4000623c7c34c5f7c245dee7d33339) fix: restrict export ### 📊 Changes **109 files changed** (+265 additions, -118 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/adapters/adapter-factory/index.ts` (+6 -3) 📝 `packages/better-auth/src/adapters/create-test-suite.ts` (+2 -2) 📝 `packages/better-auth/src/adapters/memory-adapter/memory-adapter.ts` (+1 -1) 📝 `packages/better-auth/src/adapters/test-adapter.ts` (+1 -1) 📝 `packages/better-auth/src/adapters/test.ts` (+1 -1) 📝 `packages/better-auth/src/api/index.ts` (+1 -1) 📝 `packages/better-auth/src/api/middlewares/origin-check.ts` (+1 -1) 📝 `packages/better-auth/src/api/rate-limiter/index.ts` (+2 -2) 📝 `packages/better-auth/src/api/routes/account.test.ts` (+1 -1) 📝 `packages/better-auth/src/api/routes/callback.ts` (+2 -2) 📝 `packages/better-auth/src/api/routes/error.ts` (+1 -1) 📝 `packages/better-auth/src/api/routes/ok.ts` (+1 -1) 📝 `packages/better-auth/src/api/routes/reset-password.ts` (+2 -2) 📝 `packages/better-auth/src/api/routes/session-api.test.ts` (+1 -1) 📝 `packages/better-auth/src/api/routes/session.ts` (+2 -2) 📝 `packages/better-auth/src/api/routes/sign-in.ts` (+1 -1) 📝 `packages/better-auth/src/api/to-auth-endpoints.ts` (+1 -1) 📝 `packages/better-auth/src/client/proxy.ts` (+1 -1) 📝 `packages/better-auth/src/client/solid/index.ts` (+1 -1) 📝 `packages/better-auth/src/client/svelte/index.ts` (+1 -1) _...and 80 more files_ </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Centralized shared utilities under @better-auth/core and updated all imports to use the new subpath. This streamlines helper usage across packages with no behavior changes. - **Refactors** - Added @better-auth/core/utils entry and re-exported utility modules. - Updated better-auth imports to point to @better-auth/core/utils (json, date, logger, colors, id, wildcard, time, etc.). - Removed better-auth/src/utils and stopped exporting utils from better-auth’s index. - Introduced env helpers in core (env, ENV, getEnvVar, isProduction/isDevelopment). - Updated core build config and package.json to publish the utils subpath. - **Migration** - Replace any imports from better-auth/utils or better-auth/src/utils with @better-auth/core/utils (or specific deep paths like @better-auth/core/utils/logger). - For OAuth state, import generateState from better-auth/oauth2/state. <!-- 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-03-13 12:32:35 -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#5712