auth 1.7.0-rc.3 → 1.7.0-rc.5
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 +43 -40
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -2954,6 +2954,9 @@ function installDependencies({ dependencies, packageManager, cwd, type = "prod",
|
|
|
2954
2954
|
});
|
|
2955
2955
|
}
|
|
2956
2956
|
//#endregion
|
|
2957
|
+
//#region src/version.ts
|
|
2958
|
+
const cliVersion = "1.7.0-rc.5";
|
|
2959
|
+
//#endregion
|
|
2957
2960
|
//#region src/commands/init/configs/frameworks.config.ts
|
|
2958
2961
|
const FRAMEWORKS = [
|
|
2959
2962
|
{
|
|
@@ -7402,22 +7405,37 @@ const generateSecret = new Command("secret").action(() => {
|
|
|
7402
7405
|
${chalk.gray("# Auth Secret") + chalk.green(`\nBETTER_AUTH_SECRET=${secret}`)}`);
|
|
7403
7406
|
});
|
|
7404
7407
|
//#endregion
|
|
7405
|
-
//#region src/utils/fetch-latest-version.ts
|
|
7406
|
-
async function fetchLatestVersion(packageName) {
|
|
7407
|
-
const encoded = packageName.startsWith("@") ? `@${encodeURIComponent(packageName.slice(1))}` : encodeURIComponent(packageName);
|
|
7408
|
-
try {
|
|
7409
|
-
const response = await fetch(`https://registry.npmjs.org/${encoded}/latest`);
|
|
7410
|
-
if (!response.ok) return null;
|
|
7411
|
-
return (await response.json()).version ?? null;
|
|
7412
|
-
} catch {
|
|
7413
|
-
return null;
|
|
7414
|
-
}
|
|
7415
|
-
}
|
|
7416
|
-
//#endregion
|
|
7417
7408
|
//#region src/commands/upgrade.ts
|
|
7418
|
-
|
|
7419
|
-
|
|
7409
|
+
const fixedReleaseGroup = [[
|
|
7410
|
+
"better-auth",
|
|
7411
|
+
"@better-auth/core",
|
|
7412
|
+
"auth",
|
|
7413
|
+
"@better-auth/api-key",
|
|
7414
|
+
"@better-auth/cimd",
|
|
7415
|
+
"@better-auth/drizzle-adapter",
|
|
7416
|
+
"@better-auth/electron",
|
|
7417
|
+
"@better-auth/expo",
|
|
7418
|
+
"@better-auth/i18n",
|
|
7419
|
+
"@better-auth/kysely-adapter",
|
|
7420
|
+
"@better-auth/mcp",
|
|
7421
|
+
"@better-auth/memory-adapter",
|
|
7422
|
+
"@better-auth/mongo-adapter",
|
|
7423
|
+
"@better-auth/oauth-provider",
|
|
7424
|
+
"@better-auth/passkey",
|
|
7425
|
+
"@better-auth/prisma-adapter",
|
|
7426
|
+
"@better-auth/redis-storage",
|
|
7427
|
+
"@better-auth/scim",
|
|
7428
|
+
"@better-auth/sso",
|
|
7429
|
+
"@better-auth/stripe",
|
|
7430
|
+
"@better-auth/telemetry",
|
|
7431
|
+
"@better-auth/test-utils"
|
|
7432
|
+
]].find((group) => group.includes("better-auth"));
|
|
7433
|
+
if (!fixedReleaseGroup) throw new Error("The Better Auth fixed release group is not configured.");
|
|
7434
|
+
const SYNCHRONIZED_BETTER_AUTH_PACKAGES = new Set(fixedReleaseGroup.filter((name) => name !== "auth"));
|
|
7435
|
+
function isSynchronizedBetterAuthPackage(name) {
|
|
7436
|
+
return SYNCHRONIZED_BETTER_AUTH_PACKAGES.has(name);
|
|
7420
7437
|
}
|
|
7438
|
+
/** @internal */
|
|
7421
7439
|
async function upgradeAction(opts) {
|
|
7422
7440
|
const options = z.object({
|
|
7423
7441
|
cwd: z.string(),
|
|
@@ -7438,12 +7456,12 @@ async function upgradeAction(opts) {
|
|
|
7438
7456
|
const deps = packageJson.dependencies ?? {};
|
|
7439
7457
|
const devDeps = packageJson.devDependencies ?? {};
|
|
7440
7458
|
const candidates = [];
|
|
7441
|
-
for (const [name, version] of Object.entries(deps)) if (
|
|
7459
|
+
for (const [name, version] of Object.entries(deps)) if (isSynchronizedBetterAuthPackage(name) && !version.startsWith("workspace:")) candidates.push({
|
|
7442
7460
|
name,
|
|
7443
7461
|
current: version,
|
|
7444
7462
|
depType: "prod"
|
|
7445
7463
|
});
|
|
7446
|
-
for (const [name, version] of Object.entries(devDeps)) if (
|
|
7464
|
+
for (const [name, version] of Object.entries(devDeps)) if (isSynchronizedBetterAuthPackage(name) && !version.startsWith("workspace:")) candidates.push({
|
|
7447
7465
|
name,
|
|
7448
7466
|
current: version,
|
|
7449
7467
|
depType: "dev"
|
|
@@ -7453,22 +7471,13 @@ async function upgradeAction(opts) {
|
|
|
7453
7471
|
return;
|
|
7454
7472
|
}
|
|
7455
7473
|
const spinner = yoctoSpinner({ text: "checking for updates..." }).start();
|
|
7456
|
-
const results = await Promise.allSettled(candidates.map(async (c) => {
|
|
7457
|
-
const latest = await fetchLatestVersion(c.name);
|
|
7458
|
-
return {
|
|
7459
|
-
...c,
|
|
7460
|
-
latest
|
|
7461
|
-
};
|
|
7462
|
-
}));
|
|
7463
7474
|
const upgrades = [];
|
|
7464
|
-
for (const
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
const coerced = semver.coerce(current);
|
|
7468
|
-
if (coerced && semver.lt(coerced, latest)) upgrades.push({
|
|
7475
|
+
for (const { name, current, depType } of candidates) {
|
|
7476
|
+
const currentVersion = semver.minVersion(current);
|
|
7477
|
+
if (currentVersion && semver.lt(currentVersion, cliVersion)) upgrades.push({
|
|
7469
7478
|
name,
|
|
7470
7479
|
current,
|
|
7471
|
-
|
|
7480
|
+
target: cliVersion,
|
|
7472
7481
|
depType
|
|
7473
7482
|
});
|
|
7474
7483
|
}
|
|
@@ -7478,7 +7487,7 @@ async function upgradeAction(opts) {
|
|
|
7478
7487
|
return;
|
|
7479
7488
|
}
|
|
7480
7489
|
console.log(`\nThe following packages can be upgraded:\n`);
|
|
7481
|
-
for (const u of upgrades) console.log(` ${chalk.cyan(u.name)} ${chalk.gray(u.current)} ${chalk.white("→")} ${chalk.green(u.
|
|
7490
|
+
for (const u of upgrades) console.log(` ${chalk.cyan(u.name)} ${chalk.gray(u.current)} ${chalk.white("→")} ${chalk.green(u.target)}`);
|
|
7482
7491
|
console.log();
|
|
7483
7492
|
let confirmed = options.yes;
|
|
7484
7493
|
if (!confirmed) confirmed = (await prompts({
|
|
@@ -7492,8 +7501,8 @@ async function upgradeAction(opts) {
|
|
|
7492
7501
|
return;
|
|
7493
7502
|
}
|
|
7494
7503
|
const { packageManager } = await detectPackageManager(cwd, packageJson);
|
|
7495
|
-
const prodUpgrades = upgrades.filter((u) => u.depType === "prod").map((u) => `${u.name}@${u.
|
|
7496
|
-
const devUpgrades = upgrades.filter((u) => u.depType === "dev").map((u) => `${u.name}@${u.
|
|
7504
|
+
const prodUpgrades = upgrades.filter((u) => u.depType === "prod").map((u) => `${u.name}@${u.target}`);
|
|
7505
|
+
const devUpgrades = upgrades.filter((u) => u.depType === "dev").map((u) => `${u.name}@${u.target}`);
|
|
7497
7506
|
const installSpinner = yoctoSpinner({ text: "installing updates..." }).start();
|
|
7498
7507
|
try {
|
|
7499
7508
|
if (prodUpgrades.length > 0) await installDependencies({
|
|
@@ -7516,19 +7525,13 @@ async function upgradeAction(opts) {
|
|
|
7516
7525
|
process.exit(1);
|
|
7517
7526
|
}
|
|
7518
7527
|
}
|
|
7519
|
-
const upgrade = new Command("upgrade").description("Upgrade better-auth packages to
|
|
7528
|
+
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);
|
|
7520
7529
|
//#endregion
|
|
7521
7530
|
//#region src/index.ts
|
|
7522
7531
|
process.on("SIGINT", () => process.exit(0));
|
|
7523
7532
|
process.on("SIGTERM", () => process.exit(0));
|
|
7524
|
-
let cliVersion = "1.1.2";
|
|
7525
7533
|
async function main() {
|
|
7526
7534
|
const program = new Command("better-auth");
|
|
7527
|
-
let packageInfo = {};
|
|
7528
|
-
try {
|
|
7529
|
-
packageInfo = await getPackageInfo();
|
|
7530
|
-
cliVersion = packageInfo.version || "1.1.2";
|
|
7531
|
-
} catch {}
|
|
7532
7535
|
program.addCommand(ai).addCommand(createAdmin).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());
|
|
7533
7536
|
program.parse();
|
|
7534
7537
|
}
|
|
@@ -7537,4 +7540,4 @@ main().catch((error) => {
|
|
|
7537
7540
|
process.exit(1);
|
|
7538
7541
|
});
|
|
7539
7542
|
//#endregion
|
|
7540
|
-
export {
|
|
7543
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auth",
|
|
3
|
-
"version": "1.7.0-rc.
|
|
3
|
+
"version": "1.7.0-rc.5",
|
|
4
4
|
"description": "The CLI for Better Auth",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"auth": "./dist/index.mjs"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@babel/core": "^7.29.
|
|
49
|
+
"@babel/core": "^7.29.7",
|
|
50
50
|
"@babel/preset-react": "^7.28.5",
|
|
51
51
|
"@babel/preset-typescript": "^7.28.5",
|
|
52
52
|
"@better-auth/utils": "0.4.2",
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"semver": "^7.8.4",
|
|
65
65
|
"yocto-spinner": "^1.2.0",
|
|
66
66
|
"zod": "^4.3.6",
|
|
67
|
-
"@better-auth/core": "1.7.0-rc.
|
|
68
|
-
"@better-auth/telemetry": "1.7.0-rc.
|
|
69
|
-
"better-auth": "1.7.0-rc.
|
|
67
|
+
"@better-auth/core": "1.7.0-rc.5",
|
|
68
|
+
"@better-auth/telemetry": "1.7.0-rc.5",
|
|
69
|
+
"better-auth": "1.7.0-rc.5"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/better-sqlite3": "^7.6.13",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"tsx": "^4.21.0",
|
|
79
79
|
"type-fest": "^5.7.0",
|
|
80
80
|
"typescript": "^6.0.3",
|
|
81
|
-
"@better-auth/passkey": "1.7.0-rc.
|
|
81
|
+
"@better-auth/passkey": "1.7.0-rc.5"
|
|
82
82
|
},
|
|
83
83
|
"scripts": {
|
|
84
84
|
"build": "tsdown",
|