auth 1.6.26 → 1.6.27
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.d.mts +1 -5
- package/dist/index.mjs +13 -36
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -2697,6 +2697,9 @@ function installDependencies({ dependencies, packageManager, cwd, type = "prod",
|
|
|
2697
2697
|
});
|
|
2698
2698
|
}
|
|
2699
2699
|
//#endregion
|
|
2700
|
+
//#region src/version.ts
|
|
2701
|
+
const cliVersion = "1.6.27";
|
|
2702
|
+
//#endregion
|
|
2700
2703
|
//#region src/commands/init/configs/frameworks.config.ts
|
|
2701
2704
|
const FRAMEWORKS = [
|
|
2702
2705
|
{
|
|
@@ -7202,22 +7205,11 @@ const generateSecret = new Command("secret").action(() => {
|
|
|
7202
7205
|
${chalk.gray("# Auth Secret") + chalk.green(`\nBETTER_AUTH_SECRET=${secret}`)}`);
|
|
7203
7206
|
});
|
|
7204
7207
|
//#endregion
|
|
7205
|
-
//#region src/utils/fetch-latest-version.ts
|
|
7206
|
-
async function fetchLatestVersion(packageName) {
|
|
7207
|
-
const encoded = packageName.startsWith("@") ? `@${encodeURIComponent(packageName.slice(1))}` : encodeURIComponent(packageName);
|
|
7208
|
-
try {
|
|
7209
|
-
const response = await fetch(`https://registry.npmjs.org/${encoded}/latest`);
|
|
7210
|
-
if (!response.ok) return null;
|
|
7211
|
-
return (await response.json()).version ?? null;
|
|
7212
|
-
} catch {
|
|
7213
|
-
return null;
|
|
7214
|
-
}
|
|
7215
|
-
}
|
|
7216
|
-
//#endregion
|
|
7217
7208
|
//#region src/commands/upgrade.ts
|
|
7218
7209
|
function isBetterAuthPackage(name) {
|
|
7219
7210
|
return name === "better-auth" || name.startsWith("@better-auth/");
|
|
7220
7211
|
}
|
|
7212
|
+
/** @internal */
|
|
7221
7213
|
async function upgradeAction(opts) {
|
|
7222
7214
|
const options = z.object({
|
|
7223
7215
|
cwd: z.string(),
|
|
@@ -7253,22 +7245,13 @@ async function upgradeAction(opts) {
|
|
|
7253
7245
|
return;
|
|
7254
7246
|
}
|
|
7255
7247
|
const spinner = yoctoSpinner({ text: "checking for updates..." }).start();
|
|
7256
|
-
const results = await Promise.allSettled(candidates.map(async (c) => {
|
|
7257
|
-
const latest = await fetchLatestVersion(c.name);
|
|
7258
|
-
return {
|
|
7259
|
-
...c,
|
|
7260
|
-
latest
|
|
7261
|
-
};
|
|
7262
|
-
}));
|
|
7263
7248
|
const upgrades = [];
|
|
7264
|
-
for (const
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
const coerced = semver.coerce(current);
|
|
7268
|
-
if (coerced && semver.lt(coerced, latest)) upgrades.push({
|
|
7249
|
+
for (const { name, current, depType } of candidates) {
|
|
7250
|
+
const currentVersion = semver.minVersion(current);
|
|
7251
|
+
if (currentVersion && semver.lt(currentVersion, cliVersion)) upgrades.push({
|
|
7269
7252
|
name,
|
|
7270
7253
|
current,
|
|
7271
|
-
|
|
7254
|
+
target: cliVersion,
|
|
7272
7255
|
depType
|
|
7273
7256
|
});
|
|
7274
7257
|
}
|
|
@@ -7278,7 +7261,7 @@ async function upgradeAction(opts) {
|
|
|
7278
7261
|
return;
|
|
7279
7262
|
}
|
|
7280
7263
|
console.log(`\nThe following packages can be upgraded:\n`);
|
|
7281
|
-
for (const u of upgrades) console.log(` ${chalk.cyan(u.name)} ${chalk.gray(u.current)} ${chalk.white("→")} ${chalk.green(u.
|
|
7264
|
+
for (const u of upgrades) console.log(` ${chalk.cyan(u.name)} ${chalk.gray(u.current)} ${chalk.white("→")} ${chalk.green(u.target)}`);
|
|
7282
7265
|
console.log();
|
|
7283
7266
|
let confirmed = options.yes;
|
|
7284
7267
|
if (!confirmed) confirmed = (await prompts({
|
|
@@ -7292,8 +7275,8 @@ async function upgradeAction(opts) {
|
|
|
7292
7275
|
return;
|
|
7293
7276
|
}
|
|
7294
7277
|
const { packageManager } = await detectPackageManager(cwd, packageJson);
|
|
7295
|
-
const prodUpgrades = upgrades.filter((u) => u.depType === "prod").map((u) => `${u.name}@${u.
|
|
7296
|
-
const devUpgrades = upgrades.filter((u) => u.depType === "dev").map((u) => `${u.name}@${u.
|
|
7278
|
+
const prodUpgrades = upgrades.filter((u) => u.depType === "prod").map((u) => `${u.name}@${u.target}`);
|
|
7279
|
+
const devUpgrades = upgrades.filter((u) => u.depType === "dev").map((u) => `${u.name}@${u.target}`);
|
|
7297
7280
|
const installSpinner = yoctoSpinner({ text: "installing updates..." }).start();
|
|
7298
7281
|
try {
|
|
7299
7282
|
if (prodUpgrades.length > 0) await installDependencies({
|
|
@@ -7316,19 +7299,13 @@ async function upgradeAction(opts) {
|
|
|
7316
7299
|
process.exit(1);
|
|
7317
7300
|
}
|
|
7318
7301
|
}
|
|
7319
|
-
const upgrade = new Command("upgrade").description("Upgrade better-auth packages to
|
|
7302
|
+
const upgrade = new Command("upgrade").description("Upgrade better-auth packages to the running CLI version").option("-c, --cwd <cwd>", "the working directory. defaults to the current directory.", process.cwd()).option("-y, --yes", "automatically accept and upgrade without prompting", false).action(upgradeAction);
|
|
7320
7303
|
//#endregion
|
|
7321
7304
|
//#region src/index.ts
|
|
7322
7305
|
process.on("SIGINT", () => process.exit(0));
|
|
7323
7306
|
process.on("SIGTERM", () => process.exit(0));
|
|
7324
|
-
let cliVersion = "1.1.2";
|
|
7325
7307
|
async function main() {
|
|
7326
7308
|
const program = new Command("better-auth");
|
|
7327
|
-
let packageInfo = {};
|
|
7328
|
-
try {
|
|
7329
|
-
packageInfo = await getPackageInfo();
|
|
7330
|
-
cliVersion = packageInfo.version || "1.1.2";
|
|
7331
|
-
} catch {}
|
|
7332
7309
|
program.addCommand(ai).addCommand(init).addCommand(migrate).addCommand(generate).addCommand(generateSecret).addCommand(info).addCommand(login).addCommand(logout).addCommand(mcp).addCommand(upgrade).version(cliVersion).description("Better Auth CLI").action(() => program.help());
|
|
7333
7310
|
program.parse();
|
|
7334
7311
|
}
|
|
@@ -7337,4 +7314,4 @@ main().catch((error) => {
|
|
|
7337
7314
|
process.exit(1);
|
|
7338
7315
|
});
|
|
7339
7316
|
//#endregion
|
|
7340
|
-
export {
|
|
7317
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auth",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.27",
|
|
4
4
|
"description": "The CLI for Better Auth",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"semver": "^7.7.4",
|
|
61
61
|
"yocto-spinner": "^0.2.3",
|
|
62
62
|
"zod": "^4.3.6",
|
|
63
|
-
"@better-auth/core": "1.6.
|
|
64
|
-
"@better-auth/telemetry": "1.6.
|
|
65
|
-
"better-auth": "1.6.
|
|
63
|
+
"@better-auth/core": "1.6.27",
|
|
64
|
+
"@better-auth/telemetry": "1.6.27",
|
|
65
|
+
"better-auth": "1.6.27"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/better-sqlite3": "^7.6.13",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"tsx": "^4.21.0",
|
|
76
76
|
"type-fest": "^5.4.4",
|
|
77
77
|
"typescript": "^6.0.3",
|
|
78
|
-
"@better-auth/passkey": "1.6.
|
|
78
|
+
"@better-auth/passkey": "1.6.27"
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|
|
81
81
|
"build": "tsdown",
|