Commit Graph
63 Commits
Author SHA1 Message Date
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
Ammar ElbeheryandGitHub bde1407b15 cli(fix): add bigint type to generators (#1217) 2025-01-16 12:29:46 +03:00
Bereket Engida 9f2e45b8c7 chore: cleanup 2025-01-06 14:30:39 +03:00
Bereket EngidaandGitHub bfc8f15aad fix(drizzle): default to snake-case (#1012) 2024-12-24 13:04:14 +03:00
KesvaLandGitHub 74fff8a946 fix: get-config paths for missing slash for /lib/server (#919) 2024-12-17 08:55:45 +03:00
Bereket Engida 7076f7cf56 chore: lint 2024-12-16 13:18:57 +03:00
Bereket Engida 7ff86949e3 fix(cli): improve cli message for server-only package blocking execution 2024-12-16 13:08:23 +03:00
Bereket EngidaandGitHub 0aaa573a32 fix(drizzle): it should use text for id fields other than mysql (#719) 2024-12-02 12:26:43 +03:00
Bereket EngidaandGitHub ee705a5f26 fix: prisma schema generator should add @db.text for mysql and generate many fields (#718) 2024-12-02 12:01:54 +03:00
Bereket Engida 221edcad6c chore:lint 2024-11-29 20:28:18 +03:00
ChlorineandGitHub 74eb485597 fix: conditionally set Drizzle text type to varchar for MySQL migrations (#672) 2024-11-29 20:22:52 +03:00
Bereket Engida 982bdd497a chore:lint 2024-11-26 15:12:42 +03:00
enchartandGitHub d3929d0fd9 feat(cli): account for usePlural option in drizzle schema generation (#664) 2024-11-26 15:12:22 +03:00
LovelessCodesandGitHub ae4d5bae35 chore: rename secert.ts to secret.ts (#661) 2024-11-26 10:41:21 +03:00
Bereket EngidaandGitHub ca5e90883c feat(cli): add secret generator command for the cli (#659) 2024-11-25 23:44:30 +03:00
Jonathan RomanoandGitHub b236e26b03 fix: Drizzle schema generation custom model name (#634) 2024-11-25 11:10:05 +03:00
AbdallahandGitHub abe3dddf23 fix(cli): fix -y flag in generate.ts (#631) 2024-11-25 09:11:29 +03:00
Bereket Engida b58c17b621 feat(cli): cli should look for auth config on 2024-11-23 23:43:22 +03:00
Bereket Engida 4b92d71d64 chore: update snapshot 2024-11-23 03:29:54 +03:00
Bereket EngidaandGitHub d3506e1f44 fix: CLI fails on trailing commas when reading tsconfig (#607) 2024-11-20 22:42:45 +03:00