Commit Graph
82 Commits
Author SHA1 Message Date
TaesuandGitHub df6151d161 fix(cli): simplify and correct comma insertion logic in plugin array (#4281) 2025-08-29 11:40:39 -07:00
Alex YangandGitHub 70d4dc609a chore: enable lint rule noTsIgnore (#4296) 2025-08-28 15:09:47 -07:00
Alex YangandGitHub 7931166c8d feat(cli): add info script (#4143) 2025-08-27 10:49:34 -07:00
Alex YangandGitHub 240ef3d20e feat: add onUpdate field on db schema generation (#4241)
Fixes: https://github.com/better-auth/better-auth/issues/4187
2025-08-26 15:28:20 -07:00
Alex YangandGitHub 557dc39c32 chore: remove unused deps (#4227) 2025-08-25 17:48:13 -07:00
MaxwellandGitHub 5d84a76a54 fix(cli): Incorrect drizzle schema gen (#4132) 2025-08-23 18:18:10 -07:00
Alex YangandGitHub 55ec22c877 fix: small dx for device login (#4141) 2025-08-21 17:46:11 -07:00
Alex YangandGitHub 5ded0904d4 feat: support device authorization (#3811) 2025-08-21 14:59:31 -07:00
Alex YangandGitHub bb634a0f5c fix(cli): generate throws error with default export (#4113) 2025-08-20 16:25:32 -07:00
Eniola OsabiyaandGitHub d9f8806090 fix(cli): check for undefined defaultValue instead of truthy value when generating drizzle schema(#3512) 2025-08-20 09:35:44 -07:00
KinfeMichael TarikuandGitHub 9a6a8d741b feat(cli): support sveltekit $ imports in CLI generate cmd (#4042)
* sync

* lint

* sync

* sync

* lint
2025-08-17 01:11:27 -07:00
c5d10fda64 feat(cli): resolves tsconfig references for path aliases (#3764)
* feat(cli): resolves tsconfig references for path aliases

Previously references field was ignored and path aliases were only taken
from main tsconfig file

* chore: generate changeset

* test(cli): config is loaded correctly with alias

* chore: remove changeset

---------

Co-authored-by: Bereket Engida <86073083+Bekacru@users.noreply.github.com>
Co-authored-by: KinfeMichael Tariku <65047246+Kinfe123@users.noreply.github.com>
2025-08-16 09:34:50 -07:00
KinfeMichael TarikuandBereket Engida 1993317251 fix(cli): clean up unused pg and mysql import in drizzle schema generator (#3974)
* fix(cli): clean up unused pg import in schema generator

* sql clean up

* clean up
2025-08-14 18:35:26 -07:00
Ben AgnewandGitHub 0d16d8e02c fix(cli): incorrect api for auto increment in drizzle schema generation(#3940) 2025-08-11 17:37:52 -07:00
Fraol LemechaGitHubKinfe123Bereket Engidacubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>Alex YangBereket Engida
2915e4c92d feat: add telemetry (#3822)
* feat: telemetry

Co-authored-by: Kinfe123 <kinfishtech@gmail.com>

* chore: remove changeset

* fix: do not generate project id unless telemetry is enabled

* fix: return `isInsiderContainerCached`

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

* chore: remove unused utils file

* fix: properly cache generated project id

* feat: interpret empty env vars as false

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

* fix: use nullish coalescing to set fallback

* fix: should be `isInsideContainerCached`

* fix: unique icons + tooltip for telemetry component

* fix: import child process from node

* fix: remove quotes in description

Co-authored-by: Alex Yang <himself65@outlook.com>

* fix: address reviews

Co-authored-by: Alex Yang <himself65@outlook.com>

* chore: refactor

* refactor

* add tests

* cache pkg json

* add cli tracking

* add migrate

* chore fix xi

* skip tet

* update snapshot

* chore: fix typecheck

* Expand telemetry docs: list collected fields, clarify anonymous redaction via getTelemetryAuthConfig, and document CLI events and audit/opt‑out paths.

* docs

* doc cleanup

* fixes

* remove git first commit message

* update docs

---------

Co-authored-by: Kinfe123 <kinfishtech@gmail.com>
Co-authored-by: Bereket Engida <86073083+Bekacru@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: Alex Yang <himself65@outlook.com>
Co-authored-by: Bereket Engida <Bekacru@gmail.com>
2025-08-10 01:11:56 -07:00
KinfeMichael TarikuandBereket Engida 4c4c259a54 fix(cli): prisma schema generate mismatch on custom plugin table names (#3021)
* fix: generate mismatch

* clean up

* linkt

* lint

* clean up

* clean up

* lint

* lint

* test

* clean up

* clean up

* lint

* update
2025-08-06 16:38:50 -07:00
Fraol LemechaandGitHub 2481c1d575 fix(cli): only show the overwrite message when the schema file exists and the code has changed (#3826) 2025-08-06 11:01:19 -07:00
Alex YangandGitHub 575070f605 chore: bump biome (#3784) 2025-08-04 13:48:54 -07:00
2d8d05330d fix(cli): --yes option does not work on @better-auth/cli generate (#3749)
* fix: do not prompt before overwriting schema on `@better-auth/cli generate --yes ...`

* chore: changeset

---------

Co-authored-by: Bereket Engida <86073083+Bekacru@users.noreply.github.com>
2025-08-02 08:58:44 -07:00
Khiet Tam NguyenandGitHub e11c51e210 feat(cli): added --yes for generate/migrate, deprecated --y (#3542)
* feat(cli): added --yes option, deprecated --y, as per #1937

* feat:(cli): add deprecation warning to console if --y is used

* style(cli): linted migrate.ts & generate.ts

* docs(cli): revert 1.0 changelog
2025-07-23 09:31:06 -07:00
Bereket EngidaandGitHub 5b1b242a88 Merge branch 'main' into v1.3 2025-07-18 20:09:14 -07:00
Bereket EngidaandGitHub 847fc9bfda feat(drizzle): support camel case schema generation (#2550) 2025-07-18 10:39:16 -07:00
Bereket Engida 56bd676534 Merge branch 'main' into v1.3 2025-07-17 10:08:46 -07:00
KinfeMichael TarikuandGitHub 15452a5402 fix: mysql foreign key constraints on generate (#2828)
* fix: mysql foreign key constraints

* lint

* clean up

* clean up

* lint
2025-07-17 09:58:52 -07:00
AbdallahandGitHub e02c28115d fix: schema generation when using advanced.databse.useNumberId (#3311)
* fix: schema generation when using advanced.databse.useNumberId

* fix: ci test
2025-07-17 09:06:21 -07:00
KinfeMichael TarikuandGitHub 4cff983e5c refactor: migrated all packages from Zod v3 to Zod v4 (#3399)
Refactors
- Updated all imports and type references to use zod/v4.
- Replaced deprecated or changed Zod APIs and options across the codebase.
- Adjusted validation schemas and error messages to match Zod v4 requirements.
- Updated dependencies and lockfiles to use Zod v4.
2025-07-17 08:30:02 -07:00
KinfeMichael TarikuandGitHub 6444c0498e fix(cli): format drizzle schema output (#3244) 2025-07-02 13:45:03 -07:00
AbbasandGitHub 12e15cce41 fix(drizzle-cli): use serial as PK when useNumberId is enabled (#3228) 2025-06-30 18:36:23 -07:00
Tai VoandGitHub 552ea8a041 feat(cli): allow cli to use custom adapter createSchema if implemented (#3006)
* the cli now uses createSchema from custom adapters

* rename function misnomer and keep old name as deprecated
2025-06-13 16:59:00 -07:00
KinfeMichael TarikuandGitHub e9b8d92438 chore: fix jsodc typo (#2942) 2025-06-07 11:52:12 -07:00
KinfeMichael TarikuandGitHub 90cd37caee fix: remove empty migration with semi colon (#2927) 2025-06-06 22:15:32 -07:00
AlexandGitHub e7aec18d7d chore: missing quotes for drizzle default values 2025-05-16 10:02:43 -07:00
Muntasir MahmudandGitHub d914650289 chore: clean up minor typo mistakes 2025-05-14 10:27:58 -07:00
KinfeMichael TarikuandGitHub e75c67accc fix: resolve custom ts config path 2025-05-03 21:05:12 +03:00
KinfeMichael TarikuandGitHub af402dba3a fix: add a default value for generated fields 2025-05-02 00:29:32 +03:00
Anthony DePasquale 863129ca70 "up to date" (no hyphens needed when not modifying a noun) 2025-04-13 14:11:08 +02:00
Anthony DePasquale fc4c0eb280 Better Auth 2025-04-13 14:11:08 +02:00
Anthony DePasquale 25d517e99e TypeScript 2025-04-13 14:11:08 +02:00
MaxwellandGitHub c6eb16e626 fix(cli): schema gen with Drizzle for PG to generate text instead of uuid (#2248) 2025-04-13 14:30:16 +03:00
986614b241 feat: createAdapter and useNumberId (#1926)
* refactor(adapter): `createAdapter` helper

* update: Kysely adapter support

* update: memory adapter

* chore: cleanup

* update: MongoDB adapter supported

* update: mongodb adapter file names

* update: support for prisma adapter

- also fixed memory adapter with `getField`
- disabled all debug logs by default

* chore: lint

* fix: generate an `id` if it isn't already provided

* update(test): init config snapshot

* update: existing adapters tests to include an `id` existence check

* fix: renamed prisma adapter file names

* ^

* update(mongo): Removed `disableIdGeneration` for mongo adapter

* fix: dont add `id` from fields if `disableIdGeneration` is false

* fix: adapter converting dates to string using the wrong value data

* add: create-adapter tests

* update: moved `adapter` to `create-adapter` under the existing `adapters` folder

* WIP: docs

* fix: create-adapter test importing from wrong path

* WIP: docs

* update: key transformation map options are now objs not fns

* chore: lint

* update: cleanup & added debugLogs/usePlural option to some adapters

* update: tests

* chore: cleanup

* update: fields name & made customTransforminput/output to run after supportsDates/supportsBoolean/SupportsJSON to run

* chore: lint

* Update: docs

* update: update-many to not use transformOutput

* chore: lint

* fix: adapter options breaking

* update: set the default limit on findMany

* update: docs

* update: docs & cleaned up code

* update: create schema comes with `tables` now

* This is useless

* fix: api-key shouldn't handle id gen in row creation

* chore: lint

* WIP: useNumberId

* chore: cleanup

* removed all cases of `id` during adapter.create call

* update: useNumberId

* update: drizzle adapter schema generation

- update: pg now sets `id` field to use `uuid`.
- fix: sets the correct reference `onDelete` action.
- refactor: cleaned up the code a lot more

* update: added `supportNumericIds` in create adapter options

* chore: cleanup

* update(tests): added option to disable any adapter tests & created a `useNumberId` test

* fix: skip tests options were using old method

* chore: lint

* WIP: Drizzle tests with number id

* chore: lint

* fix: memory adapter failing on number id adapter tests

* chore: cleanup

* fix: adapter tests fail due to emails needing to be unique

* update: support drizzle adapter use-number-id

* fix: cleanup Drizzle Adapter tests

* fix: drizzle schema generation for reference id fields

* fix: type errs in memory adapter tests

* fix: memory adapter tests

* Update init.test.ts.snap

* fix: prisma tests correctly uses the right primsa client per schema

* Delete run-vitest.ts

* update: create-adapter to support `getDefaultFieldName`

* update: create-adapter adapter options updated

* fix: adapters using older function names

* fix: create-adapter now converts where clauses & added tests

* update: new `getFieldAttributes` option in create-adapter, and fixed convert where clause fn

* chore: cleanup

* update: convertWhereClause in create-adapter improved

* update: BAOptions to start using `database` & updated adapter tests

* fix: type errors

* chore: lint

* update: default config values for the create-adapter config

* fix: getModelName doesnt take into account of plural

* chore: cleanup

* update: improved getDefaultModelname

* fix: create-adapter transform input doesn't take into account reference IDs

* fix: transformInput on reference IDs doesn't take into account of array IDs

* chore: lint

* fix: prisma tests

* fix: Prisma adapter tests running one after another

* fix: init snapshot should state supportJSON as `false`

* fix: drizzle adapter tests

* update: adapter test options to allow passing a test prefix

* chore: add state.txt to gitignore

* remove: state.txt from gitignore, it's useless

* chore: lint

* Update adapter.prisma.numberid.test.ts

* fix: get-migration for mysql & mssql `id` fields to use varchar

* chore: cleanup

* update: adapter comes with adapter-test-debug-log functions

* update: made adapterTestDebugLog functions only be in adapter if config enabled it

* fix: transactionId for debug logs not working correctly

This was due to the adapter being reinitialized each test case

* update: Added colors to debug logs

* update: adapter tests a little more refined

* add: deepmerge dev deps to deep merge better auth options config for adapters

* fix: create-adapter types

* update: revert back to old types

* fix: prisma adapter tests now run one after another

* fix: kysely adapter to work when no `id` is provided

* update: mongoDB to set `supportNumericids` to false

* update(docs): discuss new `database` object in BetterAuthOptions

* add: support for custom ID generation

* fix: docs had incorrect default value for `supportsJSON`

* update(docs): added number id adapter test documentation

* fix: drizzle-adapter mysql tests

* update: drizzle-adapter tests to use deepmerge

* add: drizzle-adapter mysql tests to test useNumberId

* add: Prisma generate to support number id

* update: support the old `generateId` option, but warn the user for deprecation

* update: init test snapshot

* update: adapter tests not included in normal tests

* Update pnpm-lock.yaml

* fix: typo in file names for kysley test files

* update: separated adapter tests

* Update pnpm-lock.yaml

* fix: please tell me I actually fixed this

* fix: pnpm-lock merge conflict

* chore: lint

* fix: sveltekit pkg.json merge conflicts (hopefully)

* Delete pnpm-lock.yaml

* update: createSchema takes into account of rate-limit and secondaryStorage

* improve docs

* add drizzle returning id retriver

* chore: fix test script

---------

Co-authored-by: Bereket Engida <bekacru@gmail.com>
2025-04-11 09:04:49 +03:00
Paul NodetandGitHub 43ab2860b4 fix(cli): invalid prisma init config (#1964) 2025-03-24 08:03:20 +03:00
occoruneandGitHub ab52426c01 cli(fix): correct typo in auth-config for DrizzleAdapter (#1950) 2025-03-23 08:42:33 +03:00
8e47f11298 fix(init-cmd): Dependencies do not install if ENVs are skipped (#1603)
* fix(cli): init cmd types

* fix(init): deps do not install if env is skipped

- also made the CLI show which packages it will install

* fix(typecheck): specify tsconfig for declarations

---------

Co-authored-by: Bereket Engida <bekacru@gmail.com>
2025-03-01 11:03:56 +03:00
c66fdc9129 feat: init Better Auth CLI command (#1427)
* update: init command now can do plugins & DB generation

* fix: revert nextjs auth.ts file

* add: pacakge @clack/prompts for better CLI experience

* update: moved from prompts to clack/prompts

* add: functionality to hide logs coming from `getConfig`

* remove: hide logs functionality

* chore: remove unneeded import

* add: install dependencies feature

* add: functionality to update/install better-auth

* fix: install/upgrade better-auth deps

* add: spinner during version checking

* fix: nextCookies plugin import path

* fix: oidc plugin contents

* update: emoji-ify

* fix: mysql code

* refactor: logging/prompt style

* update: mysql use 1 ENV

* fix: msql, revert back to old code

* fix: mysql connectionUri, again

* fix: missing sqlite env

* fix: added back the plugins multiselect

* update: outro text

* add: ENV generation for `BETTER_AUTH_URL` & `BETTER_AUTH_SECRET`

* update: intro & outro text, plus some ENV default values

* remove: name from cli options

* fix: made index.ts's getPackageInfo not crash the program entirely if ENOENT

* update: prompt to get auth config dir if not auto found

* fix: create auth config file

* add: log to state the new file that's being created

* update: outro text

* fix: unneeded diff display

* add: auth-client creator

* fix: auth-client plugins are now grouped

* fix: auth-client import path bugs

* fix: invalid client plugins

* fix: oneTap client plugin contents

* update: allow getConfig to throw errors instead of logging

* fix: auth config error logging

* WIP: auth client code gen

* chore: linter

* update: now supports auth client generation

* WIP: grouped imports

* remove: functionality to update existing auth code

* add: functionality to update tsconfig

* fix: tsconfig not saving new updated values

* fix: handle missing .env files in init process

* update: made `no env file found` error message use `outro` for better logging experience

* fix: removed `ms` at the end as the `formatMilliseconds` fn already handles that

* update: move ENV code after plugins initialization

* chore: update pnpm lockfile and remove deprecated package note

* chore: lint

---------

Co-authored-by: Bereket Engida <bekacru@gmail.com>
2025-03-01 00:33:14 +03:00
Arda SoyturkandGitHub b9ccfff628 feat(cli): add support for auth.server.ts (#1456) 2025-02-20 21:54:22 +03:00
Greg JacksonandGitHub f011c741e6 fix(cli): add on delete cascade constraint to drizzle references (#1419) 2025-02-12 08:39:00 +03:00
81936d756a fix(cli): wrong kysely schema filename (#1366)
Co-authored-by: Alfan Jauhari <alfan@zero-one-group.com>
2025-02-06 15:09:51 +03:00
1ceed9c336 chore(cli): pkg info and utils on CLI tools (#1364)
---------

Co-authored-by: Bereket Engida <bekacru@gmail.com>
2025-02-06 11:05:08 +03:00
Bereket EngidaandGitHub db4b4fce40 feat: support .js config (#1256) 2025-01-21 14:19:34 +03:00
Bereket Engida d2ce9da9b2 chore: lint 2025-01-16 13:07:34 +03:00