@better-auth/cli 1.3.8-beta.3 → 1.3.8-beta.4
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/dist/index.mjs +24 -19
- package/package.json +4 -10
package/dist/index.mjs
CHANGED
|
@@ -4,10 +4,9 @@ import { parse } from 'dotenv';
|
|
|
4
4
|
import semver from 'semver';
|
|
5
5
|
import prettier, { format } from 'prettier';
|
|
6
6
|
import * as z from 'zod/v4';
|
|
7
|
-
import fs
|
|
7
|
+
import fs, { existsSync } from 'fs';
|
|
8
8
|
import path from 'path';
|
|
9
9
|
import fs$1 from 'fs/promises';
|
|
10
|
-
import fs from 'fs-extra';
|
|
11
10
|
import chalk from 'chalk';
|
|
12
11
|
import { intro, log, outro, confirm, isCancel, cancel, spinner, text, select, multiselect } from '@clack/prompts';
|
|
13
12
|
import { exec } from 'child_process';
|
|
@@ -28,11 +27,7 @@ import 'dotenv/config';
|
|
|
28
27
|
|
|
29
28
|
function getPackageInfo(cwd) {
|
|
30
29
|
const packageJsonPath = cwd ? path.join(cwd, "package.json") : path.join("package.json");
|
|
31
|
-
|
|
32
|
-
return fs.readJSONSync(packageJsonPath);
|
|
33
|
-
} catch (error) {
|
|
34
|
-
throw error;
|
|
35
|
-
}
|
|
30
|
+
return JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
36
31
|
}
|
|
37
32
|
|
|
38
33
|
function installDependencies({
|
|
@@ -1694,9 +1689,9 @@ function getSvelteKitPathAliases(cwd) {
|
|
|
1694
1689
|
const svelteConfigPath = path.join(cwd, "svelte.config.js");
|
|
1695
1690
|
const svelteConfigTsPath = path.join(cwd, "svelte.config.ts");
|
|
1696
1691
|
let isSvelteKitProject = false;
|
|
1697
|
-
if (fs
|
|
1692
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
1698
1693
|
try {
|
|
1699
|
-
const packageJson = JSON.parse(fs
|
|
1694
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
1700
1695
|
const deps = {
|
|
1701
1696
|
...packageJson.dependencies,
|
|
1702
1697
|
...packageJson.devDependencies
|
|
@@ -1706,19 +1701,19 @@ function getSvelteKitPathAliases(cwd) {
|
|
|
1706
1701
|
}
|
|
1707
1702
|
}
|
|
1708
1703
|
if (!isSvelteKitProject) {
|
|
1709
|
-
isSvelteKitProject = fs
|
|
1704
|
+
isSvelteKitProject = fs.existsSync(svelteConfigPath) || fs.existsSync(svelteConfigTsPath);
|
|
1710
1705
|
}
|
|
1711
1706
|
if (!isSvelteKitProject) {
|
|
1712
1707
|
return aliases;
|
|
1713
1708
|
}
|
|
1714
1709
|
const libPaths = [path.join(cwd, "src", "lib"), path.join(cwd, "lib")];
|
|
1715
1710
|
for (const libPath of libPaths) {
|
|
1716
|
-
if (fs
|
|
1711
|
+
if (fs.existsSync(libPath)) {
|
|
1717
1712
|
aliases["$lib"] = libPath;
|
|
1718
1713
|
const commonSubPaths = ["server", "utils", "components", "stores"];
|
|
1719
1714
|
for (const subPath of commonSubPaths) {
|
|
1720
1715
|
const subDir = path.join(libPath, subPath);
|
|
1721
|
-
if (fs
|
|
1716
|
+
if (fs.existsSync(subDir)) {
|
|
1722
1717
|
aliases[`$lib/${subPath}`] = subDir;
|
|
1723
1718
|
}
|
|
1724
1719
|
}
|
|
@@ -1737,9 +1732,9 @@ function getSvelteConfigAliases(cwd) {
|
|
|
1737
1732
|
path.join(cwd, "svelte.config.ts")
|
|
1738
1733
|
];
|
|
1739
1734
|
for (const configPath of configPaths) {
|
|
1740
|
-
if (fs
|
|
1735
|
+
if (fs.existsSync(configPath)) {
|
|
1741
1736
|
try {
|
|
1742
|
-
const content = fs
|
|
1737
|
+
const content = fs.readFileSync(configPath, "utf-8");
|
|
1743
1738
|
const aliasMatch = content.match(/alias\s*:\s*\{([^}]+)\}/);
|
|
1744
1739
|
if (aliasMatch && aliasMatch[1]) {
|
|
1745
1740
|
const aliasContent = aliasMatch[1];
|
|
@@ -1875,9 +1870,9 @@ function resolveReferencePath(configDir, refPath) {
|
|
|
1875
1870
|
if (refPath.endsWith(".json")) {
|
|
1876
1871
|
return resolvedPath;
|
|
1877
1872
|
}
|
|
1878
|
-
if (fs
|
|
1873
|
+
if (fs.existsSync(resolvedPath)) {
|
|
1879
1874
|
try {
|
|
1880
|
-
const stats = fs
|
|
1875
|
+
const stats = fs.statSync(resolvedPath);
|
|
1881
1876
|
if (stats.isFile()) {
|
|
1882
1877
|
return resolvedPath;
|
|
1883
1878
|
}
|
|
@@ -1891,7 +1886,7 @@ function getPathAliasesRecursive(tsconfigPath, visited = /* @__PURE__ */ new Set
|
|
|
1891
1886
|
return {};
|
|
1892
1887
|
}
|
|
1893
1888
|
visited.add(tsconfigPath);
|
|
1894
|
-
if (!fs
|
|
1889
|
+
if (!fs.existsSync(tsconfigPath)) {
|
|
1895
1890
|
logger.warn(`Referenced tsconfig not found: ${tsconfigPath}`);
|
|
1896
1891
|
return {};
|
|
1897
1892
|
}
|
|
@@ -1928,7 +1923,7 @@ function getPathAliasesRecursive(tsconfigPath, visited = /* @__PURE__ */ new Set
|
|
|
1928
1923
|
}
|
|
1929
1924
|
function getPathAliases(cwd) {
|
|
1930
1925
|
const tsConfigPath = path.join(cwd, "tsconfig.json");
|
|
1931
|
-
if (!fs
|
|
1926
|
+
if (!fs.existsSync(tsConfigPath)) {
|
|
1932
1927
|
return null;
|
|
1933
1928
|
}
|
|
1934
1929
|
try {
|
|
@@ -2342,8 +2337,13 @@ const generateDrizzleSchema = async ({
|
|
|
2342
2337
|
type += `.default(${attr.defaultValue})`;
|
|
2343
2338
|
}
|
|
2344
2339
|
}
|
|
2340
|
+
if (attr.onUpdate && attr.type === "date") {
|
|
2341
|
+
if (typeof attr.onUpdate === "function") {
|
|
2342
|
+
type += `.$onUpdate(${attr.onUpdate})`;
|
|
2343
|
+
}
|
|
2344
|
+
}
|
|
2345
2345
|
return `${field}: ${type}${attr.required ? ".notNull()" : ""}${attr.unique ? ".unique()" : ""}${attr.references ? `.references(()=> ${getModelName(
|
|
2346
|
-
attr.references.model,
|
|
2346
|
+
tables[attr.references.model]?.modelName || attr.references.model,
|
|
2347
2347
|
adapter.options
|
|
2348
2348
|
)}.${attr.references.field}, { onDelete: '${attr.references.onDelete || "cascade"}' })` : ""}`;
|
|
2349
2349
|
}).join(",\n ")}
|
|
@@ -2899,6 +2899,11 @@ async function loginAction(opts) {
|
|
|
2899
2899
|
"\n\u{1F4DD} Note: This was a demo authentication for testing purposes."
|
|
2900
2900
|
)
|
|
2901
2901
|
);
|
|
2902
|
+
console.log(
|
|
2903
|
+
chalk.blue(
|
|
2904
|
+
"\nFor more information, visit: https://better-auth.com/docs/plugins/device-authorization"
|
|
2905
|
+
)
|
|
2906
|
+
);
|
|
2902
2907
|
}
|
|
2903
2908
|
} catch (err) {
|
|
2904
2909
|
spinner.stop();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/cli",
|
|
3
|
-
"version": "1.3.8-beta.
|
|
3
|
+
"version": "1.3.8-beta.4",
|
|
4
4
|
"description": "The CLI for Better Auth",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"repository": {
|
|
@@ -26,12 +26,9 @@
|
|
|
26
26
|
"exports": "./dist/index.mjs",
|
|
27
27
|
"bin": "./dist/index.mjs",
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@types/diff": "^7.0.1",
|
|
30
|
-
"@types/fs-extra": "^11.0.4",
|
|
31
29
|
"tsx": "^4.20.4",
|
|
32
30
|
"typescript": "^5.9.2",
|
|
33
|
-
"unbuild": "^3.5.0"
|
|
34
|
-
"zod": "^4.0.0"
|
|
31
|
+
"unbuild": "^3.5.0"
|
|
35
32
|
},
|
|
36
33
|
"dependencies": {
|
|
37
34
|
"@babel/core": "^7.0.0",
|
|
@@ -48,7 +45,6 @@
|
|
|
48
45
|
"commander": "^12.1.0",
|
|
49
46
|
"dotenv": "^16.4.7",
|
|
50
47
|
"drizzle-orm": "^0.33.0",
|
|
51
|
-
"fs-extra": "^11.3.0",
|
|
52
48
|
"get-tsconfig": "^4.8.1",
|
|
53
49
|
"open": "^10.1.0",
|
|
54
50
|
"prettier": "^3.4.2",
|
|
@@ -57,10 +53,8 @@
|
|
|
57
53
|
"semver": "^7.7.1",
|
|
58
54
|
"tinyexec": "^0.3.1",
|
|
59
55
|
"yocto-spinner": "^0.1.1",
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
"peerDependencies": {
|
|
63
|
-
"zod": "3.25.0 || ^4.0.0"
|
|
56
|
+
"zod": "^4.0.0",
|
|
57
|
+
"better-auth": "1.3.8-beta.4"
|
|
64
58
|
},
|
|
65
59
|
"files": [
|
|
66
60
|
"dist"
|