@better-auth/cli 1.5.0-beta.1 → 1.5.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +15 -12
- package/README.md +13 -6
- package/dist/api.d.mts +44 -0
- package/dist/api.mjs +3 -0
- package/dist/generators-BJiZexpE.mjs +571 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +5 -569
- package/package.json +20 -7
package/LICENSE.md
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
Copyright (c) 2024 - present, Bereket Engida
|
|
3
3
|
|
|
4
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
-
and associated documentation files (the
|
|
6
|
-
including without limitation the rights to
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
+
this software and associated documentation files (the “Software”), to deal in
|
|
6
|
+
the Software without restriction, including without limitation the rights to
|
|
7
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
8
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
9
|
+
subject to the following conditions:
|
|
9
10
|
|
|
10
|
-
The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
substantial portions of the Software.
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
12
13
|
|
|
13
|
-
THE SOFTWARE IS PROVIDED
|
|
14
|
-
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
16
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
18
|
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
19
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
20
|
+
DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Better Auth CLI
|
|
2
2
|
|
|
3
|
-
Better Auth comes with a built-in CLI to help you manage the database schema
|
|
4
|
-
|
|
3
|
+
Better Auth comes with a built-in CLI to help you manage the database schema
|
|
4
|
+
needed for both core functionality and plugins.
|
|
5
5
|
|
|
6
6
|
### **Init**
|
|
7
7
|
|
|
@@ -13,7 +13,11 @@ npx @better-auth/cli@latest init
|
|
|
13
13
|
|
|
14
14
|
### **Generate**
|
|
15
15
|
|
|
16
|
-
The `generate` command creates the schema required by Better Auth.
|
|
16
|
+
The `generate` command creates the schema required by Better Auth.
|
|
17
|
+
If you’re using a database adapter like Prisma or Drizzle, this command will
|
|
18
|
+
generate the right schema for your ORM.
|
|
19
|
+
If you’re using the built-in Kysely adapter, it will generate an SQL file you
|
|
20
|
+
can run directly on your database.
|
|
17
21
|
|
|
18
22
|
```bash title="terminal"
|
|
19
23
|
npx @better-auth/cli@latest generate
|
|
@@ -21,7 +25,10 @@ npx @better-auth/cli@latest generate
|
|
|
21
25
|
|
|
22
26
|
### **Migrate**
|
|
23
27
|
|
|
24
|
-
The `migrate` command applies the Better Auth schema directly to your database.
|
|
28
|
+
The `migrate` command applies the Better Auth schema directly to your database.
|
|
29
|
+
This is available if you’re using the built-in Kysely adapter.
|
|
30
|
+
For other adapters, you’ll need to apply the schema using your ORM’s migration
|
|
31
|
+
tool.
|
|
25
32
|
|
|
26
33
|
```bash title="terminal"
|
|
27
34
|
npx @better-auth/cli@latest migrate
|
|
@@ -29,13 +36,13 @@ npx @better-auth/cli@latest migrate
|
|
|
29
36
|
|
|
30
37
|
### **Secret**
|
|
31
38
|
|
|
32
|
-
The CLI also provides a way to generate a secret key for your Better Auth
|
|
39
|
+
The CLI also provides a way to generate a secret key for your Better Auth
|
|
40
|
+
instance.
|
|
33
41
|
|
|
34
42
|
```bash title="terminal"
|
|
35
43
|
npx @better-auth/cli@latest secret
|
|
36
44
|
```
|
|
37
45
|
|
|
38
|
-
|
|
39
46
|
## License
|
|
40
47
|
|
|
41
48
|
MIT
|
package/dist/api.d.mts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { DBAdapter, DBAdapter as DBAdapter$1 } from "@better-auth/core/db/adapter";
|
|
2
|
+
import { BetterAuthOptions } from "@better-auth/core";
|
|
3
|
+
|
|
4
|
+
//#region src/generators/types.d.ts
|
|
5
|
+
interface SchemaGeneratorResult {
|
|
6
|
+
code?: string;
|
|
7
|
+
fileName: string;
|
|
8
|
+
overwrite?: boolean;
|
|
9
|
+
append?: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface SchemaGenerator {
|
|
12
|
+
<Options extends BetterAuthOptions>(opts: {
|
|
13
|
+
file?: string;
|
|
14
|
+
adapter: DBAdapter$1;
|
|
15
|
+
options: Options;
|
|
16
|
+
}): Promise<SchemaGeneratorResult>;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/generators/index.d.ts
|
|
20
|
+
declare const adapters: {
|
|
21
|
+
prisma: SchemaGenerator;
|
|
22
|
+
drizzle: SchemaGenerator;
|
|
23
|
+
kysely: SchemaGenerator;
|
|
24
|
+
};
|
|
25
|
+
declare const generateSchema: (opts: {
|
|
26
|
+
adapter: DBAdapter$1;
|
|
27
|
+
file?: string;
|
|
28
|
+
options: BetterAuthOptions;
|
|
29
|
+
}) => Promise<SchemaGeneratorResult> | Promise<{
|
|
30
|
+
code: string;
|
|
31
|
+
fileName: string;
|
|
32
|
+
overwrite: boolean | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/generators/drizzle.d.ts
|
|
36
|
+
declare const generateDrizzleSchema: SchemaGenerator;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/generators/kysely.d.ts
|
|
39
|
+
declare const generateKyselySchema: SchemaGenerator;
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/generators/prisma.d.ts
|
|
42
|
+
declare const generatePrismaSchema: SchemaGenerator;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { type DBAdapter, type SchemaGenerator, type SchemaGeneratorResult, adapters, generateDrizzleSchema, generateKyselySchema, generatePrismaSchema, generateSchema };
|
package/dist/api.mjs
ADDED