@dashnex/cli 0.5.55 → 0.5.56
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"chalk";import o from"fs-extra";import t from"path";import i from"os";import s from"adm-zip";import r from"ignore";import n from"inquirer";import{debug as a,debugError as c}from"../../lib/debug.js";import{getBusinessApiBase as p}from"../../lib/api.js";import{ensureLoggedIn as l}from"../../services/auth.js";import{createSpinner as d}from"../../lib/spinner.js";import{isUserInterrupt as m,INTERRUPTED_MESSAGE as f}from"../../lib/errors.js";import{DeployCommand as h}from"./deploy.js";import{CheckCommand as u}from"../check.js";const g=[".dashnex",".git",".next",".wrangler"],w=async(e,i)=>{const s=[],r=await o.readdir(e,{withFileTypes:!0});for(const o of r){const r=t.relative(process.cwd(),t.join(e,o.name)).split(t.sep).join("/");if(g.some(e=>r===e||r.startsWith(`${e}/`)))continue;if(i.ignores(r))continue;const n=t.join(e,o.name);if(o.isDirectory()){const e=await w(n,i);s.push(...e)}else o.isFile()&&s.push(n)}return s};class y{async execute(y={}){a("Push flow started");if(!1===y.check)a("Skipping pre-push checks (--no-check)");else{a("Running pre-push checks");const o=new u;await o.run()||(console.error(e.red("Push aborted: checks failed.")),process.exit(1))}const j=await l();if(!j)return;const x=process.cwd(),k=t.join(x,".gitignore")
|
|
1
|
+
import e from"chalk";import o from"fs-extra";import t from"path";import i from"os";import s from"adm-zip";import r from"ignore";import n from"inquirer";import{debug as a,debugError as c}from"../../lib/debug.js";import{getBusinessApiBase as p}from"../../lib/api.js";import{ensureLoggedIn as l}from"../../services/auth.js";import{createSpinner as d}from"../../lib/spinner.js";import{isUserInterrupt as m,INTERRUPTED_MESSAGE as f}from"../../lib/errors.js";import{DeployCommand as h}from"./deploy.js";import{CheckCommand as u}from"../check.js";const g=[".dashnex",".git",".next",".wrangler","wrangler.jsonc"],w=async(e,i)=>{const s=[],r=await o.readdir(e,{withFileTypes:!0});for(const o of r){const r=t.relative(process.cwd(),t.join(e,o.name)).split(t.sep).join("/");if(g.some(e=>r===e||r.startsWith(`${e}/`)||r.endsWith(`/${e}`)))continue;if(i.ignores(r))continue;const n=t.join(e,o.name);if(o.isDirectory()){const e=await w(n,i);s.push(...e)}else o.isFile()&&s.push(n)}return s};class y{async execute(y={}){a("Push flow started");if(!1===y.check)a("Skipping pre-push checks (--no-check)");else{a("Running pre-push checks");const o=new u;await o.run()||(console.error(e.red("Push aborted: checks failed.")),process.exit(1))}const j=await l();if(!j)return;const x=process.cwd(),k=t.join(x,".gitignore"),$=r();if($.add(g),await o.pathExists(k)){const e=await o.readFile(k,"utf8");$.add(e)}a("Building file list");const v=await w(x,$);a(`Including ${v.length} files`);const b=new s;for(const e of v){const o=t.relative(x,e).split(t.sep).join("/"),i="."===t.dirname(o)?"":t.dirname(o),s=t.basename(o);b.addLocalFile(e,i,s)}const F=t.join(i.tmpdir(),`dashnex-push-${Date.now()}-${Math.random().toString(36).slice(2)}.zip`),P=d();try{P.start("Packaging application..."),b.writeZip(F),a(`Zip written to ${F}`);const t=`${p()}/business/v1/cli/push`;a(`POST ${t}`);const i=await o.readFile(F),s=new Blob([i],{type:"application/zip"}),r=new FormData;r.append("file",s,"archive.zip");const c=new Headers;c.set("Authorization",`Bearer ${j.token}`),P.text("Uploading...");const l=await fetch(t,{method:"POST",headers:c,body:r});if(P.stop(),a(`Response: ${l.status}`),!l.ok){const o=l.headers.get("content-type")??"";let t="Failed to push application.";if(401===l.status||403===l.status)t="Please run 'dashnex login' to authenticate.";else if(o.includes("application/json")){const e=(e=>"string"==typeof e.error?e.error:"string"==typeof e.message?e.message:void 0)(await l.json().catch(()=>({})));e&&(t=e)}console.error(e.red(t)),process.exit(1)}let d;if(console.log(e.green("Application pushed successfully.")),void 0!==y.deploy)d=y.deploy,a(`Deploy decided via flag: ${d}`);else{d=(await n.prompt([{type:"confirm",name:"deploy",message:"Deploy the application?",default:!0}])).deploy,a(`User chose to deploy: ${d}`)}if(d){a("Running deploy flow");const e=new h;await e.execute()}}catch(z){if(P.stop(),c(z),z instanceof Error&&z.message.startsWith("EXIT:"))throw z;if(m(z))return void console.log(e.yellow(f));console.error(e.red("Could not reach DashNex API. Check your connection and try again.")),process.exit(1)}finally{await o.remove(F).catch(()=>{}),a("Temp zip removed")}}}export{y as PushCommand};
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="@dashnex/cli",a="0.5.
|
|
1
|
+
const e="@dashnex/cli",a="0.5.56",n="Command-line interface for DashNex framework",o={name:e,version:a,description:n};export{o as default,n as description,e as name,a as version};
|
package/package.json
CHANGED