@better-auth/cli 1.3.18 → 1.4.0-beta.2

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.
Files changed (2) hide show
  1. package/dist/index.mjs +13 -29
  2. package/package.json +3 -6
package/dist/index.mjs CHANGED
@@ -2331,11 +2331,7 @@ const generateDrizzleSchema = async ({
2331
2331
  if (attr.defaultValue !== null && typeof attr.defaultValue !== "undefined") {
2332
2332
  if (typeof attr.defaultValue === "function") {
2333
2333
  if (attr.type === "date" && attr.defaultValue.toString().includes("new Date()")) {
2334
- if (databaseType === "sqlite") {
2335
- type += `.default(sql\`(current_timestamp)\`)`;
2336
- } else {
2337
- type += `.defaultNow()`;
2338
- }
2334
+ type += `.defaultNow()`;
2339
2335
  } else {
2340
2336
  type += `.$defaultFn(${attr.defaultValue})`;
2341
2337
  }
@@ -2374,8 +2370,7 @@ function generateImport({
2374
2370
  tables,
2375
2371
  options
2376
2372
  }) {
2377
- const rootImports = [];
2378
- const coreImports = [];
2373
+ let imports = [];
2379
2374
  let hasBigint = false;
2380
2375
  let hasJson = false;
2381
2376
  for (const table of Object.values(tables)) {
@@ -2386,14 +2381,12 @@ function generateImport({
2386
2381
  if (hasJson && hasBigint) break;
2387
2382
  }
2388
2383
  const useNumberId = options.advanced?.database?.useNumberId;
2389
- coreImports.push(`${databaseType}Table`);
2390
- coreImports.push(
2384
+ imports.push(`${databaseType}Table`);
2385
+ imports.push(
2391
2386
  databaseType === "mysql" ? "varchar, text" : databaseType === "pg" ? "text" : "text"
2392
2387
  );
2393
- coreImports.push(
2394
- hasBigint ? databaseType !== "sqlite" ? "bigint" : "" : ""
2395
- );
2396
- coreImports.push(databaseType !== "sqlite" ? "timestamp, boolean" : "");
2388
+ imports.push(hasBigint ? databaseType !== "sqlite" ? "bigint" : "" : "");
2389
+ imports.push(databaseType !== "sqlite" ? "timestamp, boolean" : "");
2397
2390
  if (databaseType === "mysql") {
2398
2391
  const hasNonBigintNumber = Object.values(tables).some(
2399
2392
  (table) => Object.values(table.fields).some(
@@ -2402,7 +2395,7 @@ function generateImport({
2402
2395
  );
2403
2396
  const needsInt = !!useNumberId || hasNonBigintNumber;
2404
2397
  if (needsInt) {
2405
- coreImports.push("int");
2398
+ imports.push("int");
2406
2399
  }
2407
2400
  } else if (databaseType === "pg") {
2408
2401
  const hasNonBigintNumber = Object.values(tables).some(
@@ -2417,26 +2410,17 @@ function generateImport({
2417
2410
  );
2418
2411
  const needsInteger = hasNonBigintNumber || options.advanced?.database?.useNumberId && hasFkToId;
2419
2412
  if (needsInteger) {
2420
- coreImports.push("integer");
2413
+ imports.push("integer");
2421
2414
  }
2422
2415
  } else {
2423
- coreImports.push("integer");
2416
+ imports.push("integer");
2424
2417
  }
2425
- coreImports.push(useNumberId ? databaseType === "pg" ? "serial" : "" : "");
2418
+ imports.push(useNumberId ? databaseType === "pg" ? "serial" : "" : "");
2426
2419
  if (hasJson) {
2427
- if (databaseType === "pg") coreImports.push("jsonb");
2428
- if (databaseType === "mysql") coreImports.push("json");
2429
- }
2430
- const hasSQLiteTimestamp = databaseType === "sqlite" && Object.values(tables).some(
2431
- (table) => Object.values(table.fields).some(
2432
- (field) => field.type === "date" && field.defaultValue && typeof field.defaultValue === "function" && field.defaultValue.toString().includes("new Date()")
2433
- )
2434
- );
2435
- if (hasSQLiteTimestamp) {
2436
- rootImports.push("sql");
2420
+ if (databaseType === "pg") imports.push("jsonb");
2421
+ if (databaseType === "mysql") imports.push("json");
2437
2422
  }
2438
- return `${rootImports.length > 0 ? `import { ${rootImports.join(", ")} } from "drizzle-orm";
2439
- ` : ""}import { ${coreImports.map((x) => x.trim()).filter((x) => x !== "").join(", ")} } from "drizzle-orm/${databaseType}-core";
2423
+ return `import { ${imports.map((x) => x.trim()).filter((x) => x !== "").join(", ")} } from "drizzle-orm/${databaseType}-core";
2440
2424
  `;
2441
2425
  }
2442
2426
  function getModelName(modelName, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/cli",
3
- "version": "1.3.18",
3
+ "version": "1.4.0-beta.2",
4
4
  "description": "The CLI for Better Auth",
5
5
  "module": "dist/index.mjs",
6
6
  "repository": {
@@ -26,7 +26,6 @@
26
26
  "exports": "./dist/index.mjs",
27
27
  "bin": "./dist/index.mjs",
28
28
  "devDependencies": {
29
- "@types/semver": "^7.7.1",
30
29
  "tsx": "^4.20.5",
31
30
  "typescript": "^5.9.2",
32
31
  "unbuild": "3.6.1"
@@ -47,7 +46,6 @@
47
46
  "dotenv": "^17.2.2",
48
47
  "drizzle-orm": "^0.33.0",
49
48
  "get-tsconfig": "^4.10.1",
50
- "jiti": "^2.6.0",
51
49
  "open": "^10.2.0",
52
50
  "prettier": "^3.6.2",
53
51
  "prisma": "^5.22.0",
@@ -56,7 +54,7 @@
56
54
  "tinyexec": "^0.3.2",
57
55
  "yocto-spinner": "^0.2.3",
58
56
  "zod": "^4.1.5",
59
- "better-auth": "1.3.18"
57
+ "better-auth": "1.4.0-beta.2"
60
58
  },
61
59
  "files": [
62
60
  "dist"
@@ -66,7 +64,6 @@
66
64
  "stub": "unbuild --stub",
67
65
  "start": "node ./dist/index.mjs",
68
66
  "dev": "tsx ./src/index.ts",
69
- "test": "vitest",
70
- "typecheck": "tsc --project tsconfig.json"
67
+ "test": "vitest"
71
68
  }
72
69
  }