@better-auth/cli 1.3.7 → 1.3.8-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 +6 -3
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -1957,6 +1957,9 @@ const jitiOptions = (cwd) => {
1957
1957
  alias
1958
1958
  };
1959
1959
  };
1960
+ const isDefaultExport = (object) => {
1961
+ return typeof object === "object" && object !== null && !Array.isArray(object) && Object.keys(object).length > 0 && "options" in object;
1962
+ };
1960
1963
  async function getConfig({
1961
1964
  cwd,
1962
1965
  configPath,
@@ -1972,7 +1975,7 @@ async function getConfig({
1972
1975
  dotenv: true,
1973
1976
  jitiOptions: jitiOptions(cwd)
1974
1977
  });
1975
- if (!config.auth && !config.default) {
1978
+ if (!("auth" in config) && !isDefaultExport(config)) {
1976
1979
  if (shouldThrowOnError) {
1977
1980
  throw new Error(
1978
1981
  `Couldn't read your auth config in ${resolvedPath}. Make sure to default export your auth instance or to export as a variable named auth.`
@@ -1983,7 +1986,7 @@ async function getConfig({
1983
1986
  );
1984
1987
  process.exit(1);
1985
1988
  }
1986
- configFile = config.auth?.options || config.default?.options || null;
1989
+ configFile = "auth" in config ? config.auth?.options : config.options;
1987
1990
  }
1988
1991
  if (!configFile) {
1989
1992
  for (const possiblePath of possiblePaths) {
@@ -2326,7 +2329,7 @@ const generateDrizzleSchema = async ({
2326
2329
  ${Object.keys(fields).map((field) => {
2327
2330
  const attr = fields[field];
2328
2331
  let type = getType(field, attr);
2329
- if (attr.defaultValue) {
2332
+ if (attr.defaultValue !== null && typeof attr.defaultValue !== "undefined") {
2330
2333
  if (typeof attr.defaultValue === "function") {
2331
2334
  type += `.$defaultFn(${attr.defaultValue})`;
2332
2335
  } else if (typeof attr.defaultValue === "string") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/cli",
3
- "version": "1.3.7",
3
+ "version": "1.3.8-beta.2",
4
4
  "description": "The CLI for Better Auth",
5
5
  "module": "dist/index.mjs",
6
6
  "repository": {
@@ -42,7 +42,7 @@
42
42
  "@types/better-sqlite3": "^7.6.12",
43
43
  "@types/prompts": "^2.4.9",
44
44
  "better-sqlite3": "^11.6.0",
45
- "c12": "^2.0.1",
45
+ "c12": "^3.2.0",
46
46
  "chalk": "^5.3.0",
47
47
  "commander": "^12.1.0",
48
48
  "dotenv": "^16.4.7",
@@ -55,7 +55,7 @@
55
55
  "semver": "^7.7.1",
56
56
  "tinyexec": "^0.3.1",
57
57
  "yocto-spinner": "^0.1.1",
58
- "better-auth": "1.3.7"
58
+ "better-auth": "1.3.8-beta.2"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "zod": "3.25.0 || ^4.0.0"