pecunia-cli 0.0.1 → 0.0.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/api.mjs +1 -1
- package/dist/{generators-9JxZBCCZ.mjs → generators-C6jfpk4d.mjs} +2 -214
- package/dist/index.mjs +7 -69
- package/package.json +7 -7
- package/README.md +0 -48
package/dist/api.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as generateKyselySchema, n as generateSchema, o as generateDrizzleSchema, r as generatePrismaSchema, t as adapters } from "./generators-
|
|
1
|
+
import { a as generateKyselySchema, n as generateSchema, o as generateDrizzleSchema, r as generatePrismaSchema, t as adapters } from "./generators-C6jfpk4d.mjs";
|
|
2
2
|
|
|
3
3
|
export { adapters, generateDrizzleSchema, generateKyselySchema, generatePrismaSchema, generateSchema };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs, { existsSync } from "node:fs";
|
|
2
2
|
import fs$1 from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { getMigrations } from "pecunia";
|
|
5
|
-
import { getPaymentTables, initGetFieldName, initGetModelName } from "pecunia-core";
|
|
4
|
+
import { getMigrations } from "pecunia-root";
|
|
5
|
+
import { capitalizeFirstLetter, getPaymentTables, initGetFieldName, initGetModelName } from "pecunia-core";
|
|
6
6
|
import prettier from "prettier";
|
|
7
7
|
import { produceSchema } from "@mrleebo/prisma-ast";
|
|
8
8
|
|
|
@@ -290,218 +290,6 @@ const generateKyselySchema = async ({ options, file }) => {
|
|
|
290
290
|
};
|
|
291
291
|
};
|
|
292
292
|
|
|
293
|
-
//#endregion
|
|
294
|
-
//#region ../core/dist/env-C7DHqPmD.mjs
|
|
295
|
-
const _envShim = Object.create(null);
|
|
296
|
-
const _getEnv = (useShim) => globalThis.process?.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (useShim ? _envShim : globalThis);
|
|
297
|
-
const env = new Proxy(_envShim, {
|
|
298
|
-
get(_, prop) {
|
|
299
|
-
return _getEnv()[prop] ?? _envShim[prop];
|
|
300
|
-
},
|
|
301
|
-
has(_, prop) {
|
|
302
|
-
return prop in _getEnv() || prop in _envShim;
|
|
303
|
-
},
|
|
304
|
-
set(_, prop, value) {
|
|
305
|
-
const env$1 = _getEnv(true);
|
|
306
|
-
env$1[prop] = value;
|
|
307
|
-
return true;
|
|
308
|
-
},
|
|
309
|
-
deleteProperty(_, prop) {
|
|
310
|
-
if (!prop) return false;
|
|
311
|
-
const env$1 = _getEnv(true);
|
|
312
|
-
delete env$1[prop];
|
|
313
|
-
return true;
|
|
314
|
-
},
|
|
315
|
-
ownKeys() {
|
|
316
|
-
const env$1 = _getEnv(true);
|
|
317
|
-
return Object.keys(env$1);
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
const nodeENV = typeof process !== "undefined" && process.env && process.env.NODE_ENV || "";
|
|
321
|
-
/**
|
|
322
|
-
* Get environment variable with fallback
|
|
323
|
-
*/
|
|
324
|
-
function getEnvVar(key, fallback) {
|
|
325
|
-
if (typeof process !== "undefined" && process.env) return process.env[key] ?? fallback;
|
|
326
|
-
if (typeof Deno !== "undefined") return Deno.env.get(key) ?? fallback;
|
|
327
|
-
if (typeof Bun !== "undefined") return Bun.env[key] ?? fallback;
|
|
328
|
-
return fallback;
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Common environment variables used in Pecunia
|
|
332
|
-
*/
|
|
333
|
-
const ENV = Object.freeze({
|
|
334
|
-
get NODE_ENV() {
|
|
335
|
-
return getEnvVar("NODE_ENV", "development");
|
|
336
|
-
},
|
|
337
|
-
get PACKAGE_VERSION() {
|
|
338
|
-
return getEnvVar("PACKAGE_VERSION", "0.0.0");
|
|
339
|
-
}
|
|
340
|
-
});
|
|
341
|
-
const COLORS_2 = 1;
|
|
342
|
-
const COLORS_16 = 4;
|
|
343
|
-
const COLORS_256 = 8;
|
|
344
|
-
const COLORS_16m = 24;
|
|
345
|
-
const TERM_ENVS = {
|
|
346
|
-
eterm: COLORS_16,
|
|
347
|
-
cons25: COLORS_16,
|
|
348
|
-
console: COLORS_16,
|
|
349
|
-
cygwin: COLORS_16,
|
|
350
|
-
dtterm: COLORS_16,
|
|
351
|
-
gnome: COLORS_16,
|
|
352
|
-
hurd: COLORS_16,
|
|
353
|
-
jfbterm: COLORS_16,
|
|
354
|
-
konsole: COLORS_16,
|
|
355
|
-
kterm: COLORS_16,
|
|
356
|
-
mlterm: COLORS_16,
|
|
357
|
-
mosh: COLORS_16m,
|
|
358
|
-
putty: COLORS_16,
|
|
359
|
-
st: COLORS_16,
|
|
360
|
-
"rxvt-unicode-24bit": COLORS_16m,
|
|
361
|
-
terminator: COLORS_16m,
|
|
362
|
-
"xterm-kitty": COLORS_16m
|
|
363
|
-
};
|
|
364
|
-
const CI_ENVS_MAP = new Map(Object.entries({
|
|
365
|
-
APPVEYOR: COLORS_256,
|
|
366
|
-
BUILDKITE: COLORS_256,
|
|
367
|
-
CIRCLECI: COLORS_16m,
|
|
368
|
-
DRONE: COLORS_256,
|
|
369
|
-
GITEA_ACTIONS: COLORS_16m,
|
|
370
|
-
GITHUB_ACTIONS: COLORS_16m,
|
|
371
|
-
GITLAB_CI: COLORS_256,
|
|
372
|
-
TRAVIS: COLORS_256
|
|
373
|
-
}));
|
|
374
|
-
const TERM_ENVS_REG_EXP = [
|
|
375
|
-
/ansi/,
|
|
376
|
-
/color/,
|
|
377
|
-
/linux/,
|
|
378
|
-
/direct/,
|
|
379
|
-
/^con[0-9]*x[0-9]/,
|
|
380
|
-
/^rxvt/,
|
|
381
|
-
/^screen/,
|
|
382
|
-
/^xterm/,
|
|
383
|
-
/^vt100/,
|
|
384
|
-
/^vt220/
|
|
385
|
-
];
|
|
386
|
-
function getColorDepth() {
|
|
387
|
-
if (getEnvVar("FORCE_COLOR") !== void 0) switch (getEnvVar("FORCE_COLOR")) {
|
|
388
|
-
case "":
|
|
389
|
-
case "1":
|
|
390
|
-
case "true": return COLORS_16;
|
|
391
|
-
case "2": return COLORS_256;
|
|
392
|
-
case "3": return COLORS_16m;
|
|
393
|
-
default: return COLORS_2;
|
|
394
|
-
}
|
|
395
|
-
if (getEnvVar("NODE_DISABLE_COLORS") !== void 0 && getEnvVar("NODE_DISABLE_COLORS") !== "" || getEnvVar("NO_COLOR") !== void 0 && getEnvVar("NO_COLOR") !== "" || getEnvVar("TERM") === "dumb") return COLORS_2;
|
|
396
|
-
if (getEnvVar("TMUX")) return COLORS_16m;
|
|
397
|
-
if ("TF_BUILD" in env && "AGENT_NAME" in env) return COLORS_16;
|
|
398
|
-
if ("CI" in env) {
|
|
399
|
-
for (const { 0: envName, 1: colors } of CI_ENVS_MAP) if (envName in env) return colors;
|
|
400
|
-
if (getEnvVar("CI_NAME") === "codeship") return COLORS_256;
|
|
401
|
-
return COLORS_2;
|
|
402
|
-
}
|
|
403
|
-
if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(getEnvVar("TEAMCITY_VERSION")) !== null ? COLORS_16 : COLORS_2;
|
|
404
|
-
switch (getEnvVar("TERM_PROGRAM")) {
|
|
405
|
-
case "iTerm.app":
|
|
406
|
-
if (!getEnvVar("TERM_PROGRAM_VERSION") || /^[0-2]\./.exec(getEnvVar("TERM_PROGRAM_VERSION")) !== null) return COLORS_256;
|
|
407
|
-
return COLORS_16m;
|
|
408
|
-
case "HyperTerm":
|
|
409
|
-
case "MacTerm": return COLORS_16m;
|
|
410
|
-
case "Apple_Terminal": return COLORS_256;
|
|
411
|
-
}
|
|
412
|
-
if (getEnvVar("COLORTERM") === "truecolor" || getEnvVar("COLORTERM") === "24bit") return COLORS_16m;
|
|
413
|
-
if (getEnvVar("TERM")) {
|
|
414
|
-
if (/truecolor/.exec(getEnvVar("TERM")) !== null) return COLORS_16m;
|
|
415
|
-
if (/^xterm-256/.exec(getEnvVar("TERM")) !== null) return COLORS_256;
|
|
416
|
-
const termEnv = getEnvVar("TERM").toLowerCase();
|
|
417
|
-
if (TERM_ENVS[termEnv]) return TERM_ENVS[termEnv];
|
|
418
|
-
if (TERM_ENVS_REG_EXP.some((term) => term.exec(termEnv) !== null)) return COLORS_16;
|
|
419
|
-
}
|
|
420
|
-
if (getEnvVar("COLORTERM")) return COLORS_16;
|
|
421
|
-
return COLORS_2;
|
|
422
|
-
}
|
|
423
|
-
const TTY_COLORS = {
|
|
424
|
-
reset: "\x1B[0m",
|
|
425
|
-
bright: "\x1B[1m",
|
|
426
|
-
dim: "\x1B[2m",
|
|
427
|
-
undim: "\x1B[22m",
|
|
428
|
-
underscore: "\x1B[4m",
|
|
429
|
-
blink: "\x1B[5m",
|
|
430
|
-
reverse: "\x1B[7m",
|
|
431
|
-
hidden: "\x1B[8m",
|
|
432
|
-
fg: {
|
|
433
|
-
black: "\x1B[30m",
|
|
434
|
-
red: "\x1B[31m",
|
|
435
|
-
green: "\x1B[32m",
|
|
436
|
-
yellow: "\x1B[33m",
|
|
437
|
-
blue: "\x1B[34m",
|
|
438
|
-
magenta: "\x1B[35m",
|
|
439
|
-
cyan: "\x1B[36m",
|
|
440
|
-
white: "\x1B[37m"
|
|
441
|
-
},
|
|
442
|
-
bg: {
|
|
443
|
-
black: "\x1B[40m",
|
|
444
|
-
red: "\x1B[41m",
|
|
445
|
-
green: "\x1B[42m",
|
|
446
|
-
yellow: "\x1B[43m",
|
|
447
|
-
blue: "\x1B[44m",
|
|
448
|
-
magenta: "\x1B[45m",
|
|
449
|
-
cyan: "\x1B[46m",
|
|
450
|
-
white: "\x1B[47m"
|
|
451
|
-
}
|
|
452
|
-
};
|
|
453
|
-
const levels = [
|
|
454
|
-
"debug",
|
|
455
|
-
"info",
|
|
456
|
-
"success",
|
|
457
|
-
"warn",
|
|
458
|
-
"error"
|
|
459
|
-
];
|
|
460
|
-
function shouldPublishLog(currentLogLevel, logLevel) {
|
|
461
|
-
return levels.indexOf(logLevel) >= levels.indexOf(currentLogLevel);
|
|
462
|
-
}
|
|
463
|
-
const levelColors = {
|
|
464
|
-
info: TTY_COLORS.fg.blue,
|
|
465
|
-
success: TTY_COLORS.fg.green,
|
|
466
|
-
warn: TTY_COLORS.fg.yellow,
|
|
467
|
-
error: TTY_COLORS.fg.red,
|
|
468
|
-
debug: TTY_COLORS.fg.magenta
|
|
469
|
-
};
|
|
470
|
-
const formatMessage = (level, message, colorsEnabled) => {
|
|
471
|
-
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
472
|
-
if (colorsEnabled) return `${TTY_COLORS.dim}${timestamp}${TTY_COLORS.reset} ${levelColors[level]}${level.toUpperCase()}${TTY_COLORS.reset} ${TTY_COLORS.bright}[Better Auth]:${TTY_COLORS.reset} ${message}`;
|
|
473
|
-
return `${timestamp} ${level.toUpperCase()} [Better Auth]: ${message}`;
|
|
474
|
-
};
|
|
475
|
-
const createLogger = (options) => {
|
|
476
|
-
const enabled = options?.disabled !== true;
|
|
477
|
-
const logLevel = options?.level ?? "error";
|
|
478
|
-
const colorsEnabled = options?.disableColors !== void 0 ? !options.disableColors : getColorDepth() !== 1;
|
|
479
|
-
const LogFunc = (level, message, args = []) => {
|
|
480
|
-
if (!enabled || !shouldPublishLog(logLevel, level)) return;
|
|
481
|
-
const formattedMessage = formatMessage(level, message, colorsEnabled);
|
|
482
|
-
if (!options || typeof options.log !== "function") {
|
|
483
|
-
if (level === "error") console.error(formattedMessage, ...args);
|
|
484
|
-
else if (level === "warn") console.warn(formattedMessage, ...args);
|
|
485
|
-
else console.log(formattedMessage, ...args);
|
|
486
|
-
return;
|
|
487
|
-
}
|
|
488
|
-
options.log(level === "success" ? "info" : level, message, ...args);
|
|
489
|
-
};
|
|
490
|
-
return {
|
|
491
|
-
...Object.fromEntries(levels.map((level) => [level, (...[message, ...args]) => LogFunc(level, message, args)])),
|
|
492
|
-
get level() {
|
|
493
|
-
return logLevel;
|
|
494
|
-
}
|
|
495
|
-
};
|
|
496
|
-
};
|
|
497
|
-
const logger = createLogger();
|
|
498
|
-
|
|
499
|
-
//#endregion
|
|
500
|
-
//#region ../core/dist/utils-BNmlJWNJ.mjs
|
|
501
|
-
function capitalizeFirstLetter(val) {
|
|
502
|
-
return val.charAt(0).toUpperCase() + val.slice(1);
|
|
503
|
-
}
|
|
504
|
-
|
|
505
293
|
//#endregion
|
|
506
294
|
//#region src/utils/get-package-info.ts
|
|
507
295
|
function getPackageInfo(cwd) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as getPackageInfo, n as generateSchema } from "./generators-
|
|
2
|
+
import { i as getPackageInfo, n as generateSchema } from "./generators-C6jfpk4d.mjs";
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
import fs, { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import fs$1 from "node:fs/promises";
|
|
6
6
|
import path from "node:path";
|
|
7
|
-
import { getAdapter, getMigrations } from "pecunia";
|
|
7
|
+
import { getAdapter, getMigrations } from "pecunia-root";
|
|
8
8
|
import chalk from "chalk";
|
|
9
9
|
import prompts from "prompts";
|
|
10
10
|
import yoctoSpinner from "yocto-spinner";
|
|
@@ -108,10 +108,7 @@ function getPathAliases(cwd) {
|
|
|
108
108
|
const tsConfigPath = path.join(cwd, "tsconfig.json");
|
|
109
109
|
if (!fs.existsSync(tsConfigPath)) return null;
|
|
110
110
|
try {
|
|
111
|
-
|
|
112
|
-
addSvelteKitEnvModules(result);
|
|
113
|
-
addCloudflareModules(result);
|
|
114
|
-
return result;
|
|
111
|
+
return getPathAliasesRecursive(tsConfigPath);
|
|
115
112
|
} catch (error) {
|
|
116
113
|
console.error(error);
|
|
117
114
|
throw new PecuniaError("Error parsing tsconfig.json");
|
|
@@ -232,22 +229,7 @@ async function generateAction(opts) {
|
|
|
232
229
|
options: config
|
|
233
230
|
});
|
|
234
231
|
spinner.stop();
|
|
235
|
-
if (!schema.code)
|
|
236
|
-
console.log("Your schema is already up to date.");
|
|
237
|
-
try {
|
|
238
|
-
await (await createTelemetry(config)).publish({
|
|
239
|
-
type: "cli_generate",
|
|
240
|
-
payload: {
|
|
241
|
-
outcome: "no_changes",
|
|
242
|
-
config: getTelemetryAuthConfig(config, {
|
|
243
|
-
adapter: adapter.id,
|
|
244
|
-
database: typeof config.database === "function" ? "adapter" : "kysely"
|
|
245
|
-
})
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
} catch {}
|
|
249
|
-
process.exit(0);
|
|
250
|
-
}
|
|
232
|
+
if (!schema.code) console.log("Your schema is already up to date.");
|
|
251
233
|
if (schema.overwrite) {
|
|
252
234
|
let confirm$1 = options.y || options.yes;
|
|
253
235
|
if (!confirm$1) confirm$1 = (await prompts({
|
|
@@ -260,29 +242,7 @@ async function generateAction(opts) {
|
|
|
260
242
|
if (schema.overwrite) await fs$1.writeFile(path.join(cwd, schema.fileName), schema.code);
|
|
261
243
|
else await fs$1.appendFile(path.join(cwd, schema.fileName), schema.code);
|
|
262
244
|
console.log(`🚀 Schema was ${schema.overwrite ? "overwritten" : "appended"} successfully!`);
|
|
263
|
-
|
|
264
|
-
await (await createTelemetry(config)).publish({
|
|
265
|
-
type: "cli_generate",
|
|
266
|
-
payload: {
|
|
267
|
-
outcome: schema.overwrite ? "overwritten" : "appended",
|
|
268
|
-
config: getTelemetryAuthConfig(config)
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
} catch {}
|
|
272
|
-
process.exit(0);
|
|
273
|
-
} else {
|
|
274
|
-
console.error("Schema generation aborted.");
|
|
275
|
-
try {
|
|
276
|
-
await (await createTelemetry(config)).publish({
|
|
277
|
-
type: "cli_generate",
|
|
278
|
-
payload: {
|
|
279
|
-
outcome: "aborted",
|
|
280
|
-
config: getTelemetryAuthConfig(config)
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
} catch {}
|
|
284
|
-
process.exit(1);
|
|
285
|
-
}
|
|
245
|
+
} else console.error("Schema generation aborted.");
|
|
286
246
|
}
|
|
287
247
|
if (options.y) {
|
|
288
248
|
console.warn("WARNING: --y is deprecated. Consider -y or --yes");
|
|
@@ -294,34 +254,12 @@ async function generateAction(opts) {
|
|
|
294
254
|
name: "confirm",
|
|
295
255
|
message: `Do you want to generate the schema to ${chalk.yellow(schema.fileName)}?`
|
|
296
256
|
})).confirm;
|
|
297
|
-
if (!confirm)
|
|
298
|
-
console.error("Schema generation aborted.");
|
|
299
|
-
try {
|
|
300
|
-
await (await createTelemetry(config)).publish({
|
|
301
|
-
type: "cli_generate",
|
|
302
|
-
payload: {
|
|
303
|
-
outcome: "aborted",
|
|
304
|
-
config: getTelemetryAuthConfig(config)
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
} catch {}
|
|
308
|
-
process.exit(1);
|
|
309
|
-
}
|
|
257
|
+
if (!confirm) console.error("Schema generation aborted.");
|
|
310
258
|
if (!options.output) {
|
|
311
259
|
if (!existsSync(path.dirname(path.join(cwd, schema.fileName)))) await fs$1.mkdir(path.dirname(path.join(cwd, schema.fileName)), { recursive: true });
|
|
312
260
|
}
|
|
313
261
|
await fs$1.writeFile(options.output || path.join(cwd, schema.fileName), schema.code);
|
|
314
262
|
console.log(`🚀 Schema was generated successfully!`);
|
|
315
|
-
try {
|
|
316
|
-
await (await createTelemetry(config)).publish({
|
|
317
|
-
type: "cli_generate",
|
|
318
|
-
payload: {
|
|
319
|
-
outcome: "generated",
|
|
320
|
-
config: getTelemetryAuthConfig(config)
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
} catch {}
|
|
324
|
-
process.exit(0);
|
|
325
263
|
}
|
|
326
264
|
const generate = new Command("generate").option("-c, --cwd <cwd>", "the working directory. defaults to the current directory.", process.cwd()).option("--config <config>", "the path to the configuration file. defaults to the first configuration file found.").option("--output <output>", "the file to output to the generated schema").option("-y, --yes", "automatically answer yes to all prompts", false).option("--y", "(deprecated) same as --yes", false).action(generateAction);
|
|
327
265
|
|
|
@@ -690,7 +628,7 @@ ${JSON.stringify(betterAuthInfo, null, 2)}
|
|
|
690
628
|
|
|
691
629
|
//#endregion
|
|
692
630
|
//#region src/commands/init.ts
|
|
693
|
-
const init = new Command("init").option("-c, --cwd <cwd>", "The working directory.", process.cwd()).option("--config <config>", "The path to the auth configuration file. defaults to the first `auth.ts` file found.").option("--tsconfig <tsconfig>", "The path to the tsconfig file.").option("--skip-db", "Skip the database setup.").option("--skip-plugins", "Skip the plugins setup.").option("--package-manager <package-manager>", "The package manager you want to use.")
|
|
631
|
+
const init = new Command("init").option("-c, --cwd <cwd>", "The working directory.", process.cwd()).option("--config <config>", "The path to the auth configuration file. defaults to the first `auth.ts` file found.").option("--tsconfig <tsconfig>", "The path to the tsconfig file.").option("--skip-db", "Skip the database setup.").option("--skip-plugins", "Skip the plugins setup.").option("--package-manager <package-manager>", "The package manager you want to use.");
|
|
694
632
|
|
|
695
633
|
//#endregion
|
|
696
634
|
//#region src/commands/migrate.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pecunia-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -36,29 +36,27 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"bin": {
|
|
39
|
-
"
|
|
39
|
+
"pecunia-cli": "./dist/index.mjs"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/better-sqlite3": "^7.6.13",
|
|
43
43
|
"@types/prompts": "^2.4.9",
|
|
44
44
|
"@types/semver": "^7.7.1",
|
|
45
45
|
"jiti": "^2.6.0",
|
|
46
|
-
"tsdown": "
|
|
46
|
+
"tsdown": "^0.19.0",
|
|
47
47
|
"tsx": "^4.20.6",
|
|
48
48
|
"type-fest": "^5.2.0",
|
|
49
|
-
"typescript": "
|
|
49
|
+
"typescript": "^5.9.3"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@babel/core": "^7.28.4",
|
|
53
53
|
"@babel/preset-react": "^7.27.1",
|
|
54
54
|
"@babel/preset-typescript": "^7.27.1",
|
|
55
|
-
"pecunia-core": "workspace:*",
|
|
56
|
-
"@better-auth/utils": "catalog:",
|
|
57
55
|
"@clack/prompts": "^0.11.0",
|
|
58
56
|
"@mrleebo/prisma-ast": "^0.13.0",
|
|
59
57
|
"@prisma/client": "^5.22.0",
|
|
60
58
|
"@types/pg": "^8.15.5",
|
|
61
|
-
"
|
|
59
|
+
"better-call": "^1.1.8",
|
|
62
60
|
"better-sqlite3": "^12.2.0",
|
|
63
61
|
"c12": "^3.2.0",
|
|
64
62
|
"chalk": "^5.6.2",
|
|
@@ -66,6 +64,8 @@
|
|
|
66
64
|
"dotenv": "^17.2.2",
|
|
67
65
|
"drizzle-orm": "^0.33.0",
|
|
68
66
|
"open": "^10.2.0",
|
|
67
|
+
"pecunia-core": "^0.0.2",
|
|
68
|
+
"pecunia-root": "^0.0.4",
|
|
69
69
|
"pg": "^8.16.3",
|
|
70
70
|
"prettier": "^3.6.2",
|
|
71
71
|
"prompts": "^2.4.2",
|
package/README.md
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
# Better Auth CLI
|
|
2
|
-
|
|
3
|
-
Better Auth comes with a built-in CLI to help you manage the database schema
|
|
4
|
-
needed for both core functionality and plugins.
|
|
5
|
-
|
|
6
|
-
### **Init**
|
|
7
|
-
|
|
8
|
-
The CLI includes an `init` command to add Better Auth to your project.
|
|
9
|
-
|
|
10
|
-
```bash title="terminal"
|
|
11
|
-
npx @better-auth/cli@latest init
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### **Generate**
|
|
15
|
-
|
|
16
|
-
The `generate` command creates the schema required by Better Auth.
|
|
17
|
-
If you’re using a database adapter like Prisma or Drizzle, this command will
|
|
18
|
-
generate the right schema for your ORM.
|
|
19
|
-
If you’re using the built-in Kysely adapter, it will generate an SQL file you
|
|
20
|
-
can run directly on your database.
|
|
21
|
-
|
|
22
|
-
```bash title="terminal"
|
|
23
|
-
npx @better-auth/cli@latest generate
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### **Migrate**
|
|
27
|
-
|
|
28
|
-
The `migrate` command applies the Better Auth schema directly to your database.
|
|
29
|
-
This is available if you’re using the built-in Kysely adapter.
|
|
30
|
-
For other adapters, you’ll need to apply the schema using your ORM’s migration
|
|
31
|
-
tool.
|
|
32
|
-
|
|
33
|
-
```bash title="terminal"
|
|
34
|
-
npx @better-auth/cli@latest migrate
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### **Secret**
|
|
38
|
-
|
|
39
|
-
The CLI also provides a way to generate a secret key for your Better Auth
|
|
40
|
-
instance.
|
|
41
|
-
|
|
42
|
-
```bash title="terminal"
|
|
43
|
-
npx @better-auth/cli@latest secret
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## License
|
|
47
|
-
|
|
48
|
-
MIT
|