@deessejs/cli 0.0.2 → 0.0.4
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 -1
- package/dist/index.mjs +5 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
2
|
+
var f=Object.create;var m=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var b=(e,s,o,r)=>{if(s&&typeof s=="object"||typeof s=="function")for(let t of v(s))!D.call(e,t)&&t!==o&&m(e,t,{get:()=>s[t],enumerable:!(r=y(s,t))||r.enumerable});return e};var i=(e,s,o)=>(o=e!=null?f(A(e)):{},b(s||!e||!e.__esModule?m(o,"default",{value:e,enumerable:!0}):o,e));var d=require("commander"),n=i(require("picocolors")),u=require("child_process"),a=i(require("fs")),p=i(require("path")),h=i(require("dotenv"));h.config();var c=new d.Command;c.name("deesse").description("Deessejs CLI - Zero Config migrations").version("0.1.0");var g=(e,s)=>new Promise(o=>{(0,u.spawn)(e,s,{stdio:"inherit",shell:!0}).on("exit",t=>o(t))});function S(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=p.default.dirname(e.output);a.default.existsSync(s)||a.default.mkdirSync(s,{recursive:!0}),console.log(n.default.cyan("\u{1F6E0}\uFE0F Deesse: Proxying generate to Better Auth...")),await g("npx",["@better-auth/cli@latest","generate","--output",e.output,"--config",e.config,e.yes?"--yes":""])});c.command("migrate").description("Push schema to database without drizzle.config.ts").option("-s, --schema <path>","Your app schema file","./src/db/schema.ts").option("-u, --url <url>","Database URL (defaults to DATABASE_URL env)",process.env.DATABASE_URL).action(async e=>{let s=e.url;s||(console.error(n.default.red(`
|
|
3
|
+
\u274C Error: DATABASE_URL not found in .env and no --url provided.`)),process.exit(1));let o=S(s),r="./.deesse/schema.ts",t=a.default.existsSync(e.schema)?e.schema:null;console.log(n.default.yellow(`
|
|
4
|
+
\u{1F4E6} Deesse: Migrating to ${n.default.bold(o)}...`));let l=["drizzle-kit","push",`--dialect=${o}`,`--url=${s}`,`--schema=${r}`];t?(l.push(`--schema=${t}`),console.log(n.default.dim(` Including user schema: ${t}`))):console.log(n.default.dim(` User schema not found at ${e.schema}, only pushing auth schema.`)),console.log(n.default.dim(` Targeting: ${s.split("@")[1]||"local db"}
|
|
5
|
+
`)),await g("npx",l),console.log(n.default.green(`
|
|
6
|
+
\u2705 Database is now in sync.`))});c.parse(process.argv);
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Command as
|
|
2
|
+
import{Command as d}from"commander";import t from"picocolors";import{spawn as u}from"child_process";import i from"fs";import p from"path";import*as l from"dotenv";l.config();var r=new d;r.name("deesse").description("Deessejs CLI - Zero Config migrations").version("0.1.0");var m=(e,s)=>new Promise(n=>{u(e,s,{stdio:"inherit",shell:!0}).on("exit",o=>n(o))});function h(e){return e.startsWith("postgres")||e.startsWith("postgresql")?"postgresql":e.startsWith("mysql")?"mysql":"sqlite"}r.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=p.dirname(e.output);i.existsSync(s)||i.mkdirSync(s,{recursive:!0}),console.log(t.cyan("\u{1F6E0}\uFE0F Deesse: Proxying generate to Better Auth...")),await m("npx",["@better-auth/cli@latest","generate","--output",e.output,"--config",e.config,e.yes?"--yes":""])});r.command("migrate").description("Push schema to database without drizzle.config.ts").option("-s, --schema <path>","Your app schema file","./src/db/schema.ts").option("-u, --url <url>","Database URL (defaults to DATABASE_URL env)",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 and no --url provided.`)),process.exit(1));let n=h(s),a="./.deesse/schema.ts",o=i.existsSync(e.schema)?e.schema:null;console.log(t.yellow(`
|
|
4
|
+
\u{1F4E6} Deesse: Migrating to ${t.bold(n)}...`));let c=["drizzle-kit","push",`--dialect=${n}`,`--url=${s}`,`--schema=${a}`];o?(c.push(`--schema=${o}`),console.log(t.dim(` Including user schema: ${o}`))):console.log(t.dim(` User schema not found at ${e.schema}, only pushing auth schema.`)),console.log(t.dim(` Targeting: ${s.split("@")[1]||"local db"}
|
|
5
|
+
`)),await m("npx",c),console.log(t.green(`
|
|
6
|
+
\u2705 Database is now in sync.`))});r.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deessejs/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "DeesseJS CLI",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"commander": "^14.0.2",
|
|
22
|
+
"dotenv": "^17.2.3",
|
|
22
23
|
"picocolors": "^1.1.1"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|