@deessejs/cli 0.0.4 → 0.0.6
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 +5 -5
- package/dist/index.mjs +5 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
\u274C Error: DATABASE_URL not found in .env
|
|
4
|
-
\
|
|
5
|
-
|
|
6
|
-
\u2705 Database is now in sync.`))});
|
|
2
|
+
var x=Object.create;var u=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var D=(e,s,t,n)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of v(s))!w.call(e,o)&&o!==t&&u(e,o,{get:()=>s[o],enumerable:!(n=$(s,o))||n.enumerable});return e};var c=(e,s,t)=>(t=e!=null?x(S(e)):{},D(s||!e||!e.__esModule?u(t,"default",{value:e,enumerable:!0}):t,e));var h=require("commander"),r=c(require("picocolors")),f=require("child_process"),i=c(require("fs")),a=c(require("path")),g=c(require("dotenv"));g.config();var m=new h.Command;m.name("deesse").description("Deessejs CLI - Zero Config migrations").version("0.1.2");function b(){return i.default.existsSync(a.default.join(process.cwd(),"pnpm-lock.yaml"))?"pnpm exec":"npx"}var l=e=>new Promise(s=>{(0,f.spawn)(e,{stdio:"inherit",shell:!0,env:{...process.env,NODE_PATH:a.default.join(process.cwd(),"node_modules")}}).on("exit",n=>s(n))});function q(e){return e.startsWith("postgres")||e.startsWith("postgresql")?"postgresql":e.startsWith("mysql")?"mysql":"sqlite"}m.command("generate").description("Generate Better Auth schema").option("-o, --output <path>","Where to save","./.deesse/schema.ts").option("-c, --config <path>","Config file","src/deesse.config.ts").option("-y, --yes","Skip prompt",!1).action(async e=>{let s=a.default.dirname(e.output);i.default.existsSync(s)||i.default.mkdirSync(s,{recursive:!0}),console.log(r.default.cyan("\u{1F6E0}\uFE0F Deesse: Preparing schema generation..."));let t=`npx @better-auth/cli@latest generate --output "${e.output}" --config "${e.config}" ${e.yes?"--yes":""}`;await l(t)});m.command("migrate").description("Push schema to database").option("-s, --schema <path>","Your app schema file","./src/db/schema.ts").option("-u, --url <url>","Database URL",process.env.DATABASE_URL).action(async e=>{let s=e.url;s||(console.error(r.default.red(`
|
|
3
|
+
\u274C Error: DATABASE_URL not found in .env`)),process.exit(1));let t=q(s),n="./.deesse/schema.ts";i.default.existsSync(n)||(console.error(r.default.red(`
|
|
4
|
+
\u274C Error: Schema not found. Run 'deesse generate' first.`)),process.exit(1));let o=i.default.existsSync(e.schema)?e.schema:null;console.log(r.default.yellow(`
|
|
5
|
+
\u{1F4E6} Deesse: Syncing to ${r.default.bold(t)}...`));let p=b(),d=`${p} drizzle-kit push --dialect=${t} --url="${s}" --schema="${n}"`;if(o&&(d+=` --schema="${o}"`),await l(d)===0)console.log(r.default.green(`
|
|
6
|
+
\u2705 Database is now in sync.`));else if(p==="pnpm exec"){console.log(r.default.dim(" Local drizzle-kit not found, trying via npx..."));let y=`npx drizzle-kit push --dialect=${t} --url="${s}" --schema="${n}" ${o?`--schema="${o}"`:""}`;await l(y)}});m.parse(process.argv);
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Command as
|
|
3
|
-
\u274C Error: DATABASE_URL not found in .env
|
|
4
|
-
\
|
|
5
|
-
|
|
6
|
-
\u2705 Database is now in sync.`))});
|
|
2
|
+
import{Command as h}from"commander";import t from"picocolors";import{spawn as f}from"child_process";import r from"fs";import m from"path";import*as d from"dotenv";d.config();var c=new h;c.name("deesse").description("Deessejs CLI - Zero Config migrations").version("0.1.2");function g(){return r.existsSync(m.join(process.cwd(),"pnpm-lock.yaml"))?"pnpm exec":"npx"}var a=e=>new Promise(s=>{f(e,{stdio:"inherit",shell:!0,env:{...process.env,NODE_PATH:m.join(process.cwd(),"node_modules")}}).on("exit",n=>s(n))});function y(e){return e.startsWith("postgres")||e.startsWith("postgresql")?"postgresql":e.startsWith("mysql")?"mysql":"sqlite"}c.command("generate").description("Generate Better Auth schema").option("-o, --output <path>","Where to save","./.deesse/schema.ts").option("-c, --config <path>","Config file","src/deesse.config.ts").option("-y, --yes","Skip prompt",!1).action(async e=>{let s=m.dirname(e.output);r.existsSync(s)||r.mkdirSync(s,{recursive:!0}),console.log(t.cyan("\u{1F6E0}\uFE0F Deesse: Preparing schema generation..."));let o=`npx @better-auth/cli@latest generate --output "${e.output}" --config "${e.config}" ${e.yes?"--yes":""}`;await a(o)});c.command("migrate").description("Push schema to database").option("-s, --schema <path>","Your app schema file","./src/db/schema.ts").option("-u, --url <url>","Database URL",process.env.DATABASE_URL).action(async e=>{let s=e.url;s||(console.error(t.red(`
|
|
3
|
+
\u274C Error: DATABASE_URL not found in .env`)),process.exit(1));let o=y(s),n="./.deesse/schema.ts";r.existsSync(n)||(console.error(t.red(`
|
|
4
|
+
\u274C Error: Schema not found. Run 'deesse generate' first.`)),process.exit(1));let i=r.existsSync(e.schema)?e.schema:null;console.log(t.yellow(`
|
|
5
|
+
\u{1F4E6} Deesse: Syncing to ${t.bold(o)}...`));let l=g(),p=`${l} drizzle-kit push --dialect=${o} --url="${s}" --schema="${n}"`;if(i&&(p+=` --schema="${i}"`),await a(p)===0)console.log(t.green(`
|
|
6
|
+
\u2705 Database is now in sync.`));else if(l==="pnpm exec"){console.log(t.dim(" Local drizzle-kit not found, trying via npx..."));let u=`npx drizzle-kit push --dialect=${o} --url="${s}" --schema="${n}" ${i?`--schema="${i}"`:""}`;await a(u)}});c.parse(process.argv);
|