@deessejs/cli 0.0.15 → 0.0.16
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.js +6 -5
- package/dist/index.mjs +6 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
Step
|
|
5
|
-
|
|
6
|
-
\
|
|
2
|
+
var z=Object.create;var p=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var b=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of v(n))!S.call(e,r)&&r!==t&&p(e,r,{get:()=>n[r],enumerable:!(o=A(n,r))||o.enumerable});return e};var g=(e,n,t)=>(t=e!=null?z(D(e)):{},b(n||!e||!e.__esModule?p(t,"default",{value:e,enumerable:!0}):t,e));var u=require("commander"),a=require("execa"),s=g(require("picocolors")),h=g(require("dotenv")),c=require("fs"),f=require("path");h.config();var l=new u.Command;l.name("deesse").description("CLI for the DeesseJS framework").version("1.0.0");async function m(){return(process.env.npm_config_user_agent||"").includes("pnpm")?{name:"pnpm",runner:"pnpm dlx"}:{name:"npm",runner:"npx"}}async function k(){let e=await m(),n=(0,f.resolve)(process.cwd(),"package.json");(0,c.existsSync)(n)||(console.error(s.default.red("\u274C No package.json found. Please run this command in your project root.")),process.exit(1));let t=JSON.parse((0,c.readFileSync)(n,"utf-8")),o={...t.dependencies,...t.devDependencies},i=["drizzle-orm","drizzle-kit"].filter(d=>!o[d]);if(i.length>0){console.log(s.default.yellow(`\u{1F4E6} Missing dependencies detected: ${i.join(", ")}`)),console.log(s.default.blue(`Installing missing packages with ${e.name}...`));let d=e.name==="pnpm"?"add":"install",w="-D";try{await(0,a.execa)(e.name,[d,...i,w],{stdio:"inherit"}),console.log(s.default.green(`\u2705 Dependencies installed successfully.
|
|
3
|
+
`))}catch{console.error(s.default.red("\u274C Failed to install required dependencies.")),process.exit(1)}}}async function y(){let{runner:e}=await m(),[n,...t]=e.split(" ");console.log(s.default.blue("\u2728 Generating Better Auth schema..."));try{await(0,a.execa)(n,[...t,"@better-auth/cli","generate","--output","./.deesse/schema.ts","--config","./src/deesse.config.ts","--yes"],{stdio:"inherit"}),console.log(s.default.green("\u2705 Better Auth schema generated in ./.deesse/schema.ts"))}catch{console.error(s.default.red("\u274C Failed to generate Better Auth schema")),process.exit(1)}}l.command("generate").description("Generate the Better Auth schema").action(async()=>{await y()});l.command("migrate").description("Sync schema and push to database (Better Auth + Drizzle)").option("--dialect <dialect>","Database dialect (postgresql, mysql, sqlite)","postgresql").action(async e=>{await k();let{runner:n}=await m(),[t,...o]=n.split(" ");console.log(s.default.cyan(`
|
|
4
|
+
Step 1: Synchronizing framework schema...`)),await y(),console.log(s.default.cyan(`
|
|
5
|
+
Step 2: Pushing schema to database via Drizzle...`));let r=process.env.DATABASE_URL;r||(console.error(s.default.red("\u274C Error: DATABASE_URL is missing in your .env file.")),process.exit(1));try{await(0,a.execa)(t,[...o,"drizzle-kit","push",`--dialect=${e.dialect}`,"--schema=./.deesse/schema.ts",`--url=${r}`],{stdio:"inherit"}),console.log(s.default.green(`
|
|
6
|
+
\u2705 Database synchronization completed!`))}catch{console.error(s.default.red(`
|
|
7
|
+
\u274C Failed to push schema via Drizzle.`)),process.exit(1)}});l.parse();
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Command as
|
|
3
|
-
|
|
4
|
-
Step
|
|
5
|
-
|
|
6
|
-
\
|
|
2
|
+
import{Command as u}from"commander";import{execa as l}from"execa";import e from"picocolors";import*as m from"dotenv";import{readFileSync as h,existsSync as f}from"fs";import{resolve as y}from"path";m.config();var i=new u;i.name("deesse").description("CLI for the DeesseJS framework").version("1.0.0");async function d(){return(process.env.npm_config_user_agent||"").includes("pnpm")?{name:"pnpm",runner:"pnpm dlx"}:{name:"npm",runner:"npx"}}async function w(){let n=await d(),s=y(process.cwd(),"package.json");f(s)||(console.error(e.red("\u274C No package.json found. Please run this command in your project root.")),process.exit(1));let t=JSON.parse(h(s,"utf-8")),r={...t.dependencies,...t.devDependencies},o=["drizzle-orm","drizzle-kit"].filter(c=>!r[c]);if(o.length>0){console.log(e.yellow(`\u{1F4E6} Missing dependencies detected: ${o.join(", ")}`)),console.log(e.blue(`Installing missing packages with ${n.name}...`));let c=n.name==="pnpm"?"add":"install",g="-D";try{await l(n.name,[c,...o,g],{stdio:"inherit"}),console.log(e.green(`\u2705 Dependencies installed successfully.
|
|
3
|
+
`))}catch{console.error(e.red("\u274C Failed to install required dependencies.")),process.exit(1)}}}async function p(){let{runner:n}=await d(),[s,...t]=n.split(" ");console.log(e.blue("\u2728 Generating Better Auth schema..."));try{await l(s,[...t,"@better-auth/cli","generate","--output","./.deesse/schema.ts","--config","./src/deesse.config.ts","--yes"],{stdio:"inherit"}),console.log(e.green("\u2705 Better Auth schema generated in ./.deesse/schema.ts"))}catch{console.error(e.red("\u274C Failed to generate Better Auth schema")),process.exit(1)}}i.command("generate").description("Generate the Better Auth schema").action(async()=>{await p()});i.command("migrate").description("Sync schema and push to database (Better Auth + Drizzle)").option("--dialect <dialect>","Database dialect (postgresql, mysql, sqlite)","postgresql").action(async n=>{await w();let{runner:s}=await d(),[t,...r]=s.split(" ");console.log(e.cyan(`
|
|
4
|
+
Step 1: Synchronizing framework schema...`)),await p(),console.log(e.cyan(`
|
|
5
|
+
Step 2: Pushing schema to database via Drizzle...`));let a=process.env.DATABASE_URL;a||(console.error(e.red("\u274C Error: DATABASE_URL is missing in your .env file.")),process.exit(1));try{await l(t,[...r,"drizzle-kit","push",`--dialect=${n.dialect}`,"--schema=./.deesse/schema.ts",`--url=${a}`],{stdio:"inherit"}),console.log(e.green(`
|
|
6
|
+
\u2705 Database synchronization completed!`))}catch{console.error(e.red(`
|
|
7
|
+
\u274C Failed to push schema via Drizzle.`)),process.exit(1)}});i.parse();
|