dashnex 0.5.58 → 0.5.60
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/README.md +6 -3
- package/dist/commands/app/deploy.js +1 -1
- package/dist/commands/app/index.js +1 -1
- package/dist/commands/app/pull.js +1 -1
- package/dist/commands/app/push.js +1 -1
- package/dist/commands/check.js +1 -1
- package/dist/commands/dev.js +1 -1
- package/dist/commands/index.js +1 -1
- package/dist/commands/install.js +1 -1
- package/dist/commands/secrets/index.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/src/commands/check.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,15 +24,15 @@ dashnex <command> [options]
|
|
|
24
24
|
| `login` | Log in to your DashNex account |
|
|
25
25
|
| `logout` | Log out and remove local credentials |
|
|
26
26
|
| `whoami` | Show current logged-in business and user |
|
|
27
|
+
| `dev` | Run the development server (run in DashNex application folder) |
|
|
28
|
+
| `check` | Run build-time validations (run in DashNex application folder) |
|
|
29
|
+
| `install` | Install dependencies using pnpm or npm (run in DashNex application folder) |
|
|
27
30
|
| `app create` | Create a new DashNex application |
|
|
28
31
|
| `app pull` | Pull existing application to specified folder |
|
|
29
32
|
| `app push` | Push local application to DashNex |
|
|
30
33
|
| `app delete` | Delete application from DashNex |
|
|
31
34
|
| `app deploy` | Deploy application to DashNex |
|
|
32
35
|
| `app status` | Show current application status |
|
|
33
|
-
| `app install` | Install dependencies using pnpm or npm |
|
|
34
|
-
| `app dev` | Run the development server |
|
|
35
|
-
| `app check` | Run build-time validations |
|
|
36
36
|
| `secrets list` | List all secret names bound to the worker |
|
|
37
37
|
| `secrets set` | Create or update a secret |
|
|
38
38
|
| `secrets delete` | Delete a secret |
|
|
@@ -45,6 +45,9 @@ dashnex <command> [options]
|
|
|
45
45
|
- `--code <code>` — 2FA code
|
|
46
46
|
- `--business <id>` — Business ID to select
|
|
47
47
|
|
|
48
|
+
**dev**:
|
|
49
|
+
- `--https` — Run dev server with HTTPS
|
|
50
|
+
|
|
48
51
|
**app create**:
|
|
49
52
|
- `--subdomain <subdomain>` — Subdomain
|
|
50
53
|
- `-t, --template <template>` — Template, optional (name@branch-or-tag)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"chalk";import{debug as t,debugError as o}from"../../lib/debug.js";import{getDeployerBase as s,getBusinessApiBase as r}from"../../lib/api.js";import{ensureLoggedIn as n}from"../../services/auth.js";import{createSpinner as a}from"../../lib/spinner.js";import{isUserInterrupt as i,INTERRUPTED_MESSAGE as c}from"../../lib/errors.js";import{getApplicationUrl as l}from"../../lib/app-url.js";import{ensureAgreements as p}from"../../services/agreements.js";const d=3e5,m=99,f=e=>new Promise(t=>setTimeout(t,e)),u=async(s,r,n,a)=>{const i=await fetch(s,{method:"GET",headers:{Authorization:`Bearer ${r}`,Accept:"text/event-stream"}});if(t(`SSE connection opened: ${i.status}`),!i.ok){const t=i.status;let o="Failed to start deployment.";if(401===t||403===t)o="Please run 'dashnex login' to authenticate.";else try{const e=await i.text(),t=JSON.parse(e);"string"==typeof t.error?o=t.error:"string"==typeof t.message&&(o=t.message)}catch{}throw console.error(e.red(o)),new Error(`HTTP ${t}: ${o}`)}if(!i.body)throw new Error("Response body is null");t("SSE connection established successfully"),a?.();const c=i.body.getReader();try{for await(const e of async function*(e){const t=new TextDecoder("utf-8");let o="";for(;;){const{value:s,done:r}=await e.read();if(r)break;o+=t.decode(s,{stream:!0});const n=o.split("\n");o=n.pop()||"";let a="";for(const e of n)e.startsWith("data: ")?a=e.slice(6):""===e&&a&&(yield{data:a},a="")}if(o.startsWith("data: ")){const e=o.slice(6);e&&(yield{data:e})}}(c))try{if(!e.data){t("Received empty SSE event");continue}const o=JSON.parse(e.data);t(`SSE message received: ${JSON.stringify(o)}`),n(o)}catch(l){o(l),t(`Failed to parse SSE event data: ${e.data}`)}}finally{c.releaseLock()}};class y{async execute(){t("Deploy flow started");const r=await n();if(!r)return;if(!(await p(r.token,{ciMode:!0})))return;const l=`${s()}/business/v1/applications/deploy`;t(`GET ${l} (SSE)`);let y=0,h="",g=!1,w=0,S=!1;const $=a();let b=0,v=0,x=null;const E=(e,t)=>{const o=Math.round(e);$.text(`[${o}%] ${t}`)},D=()=>{k();const e=y,t=Date.now(),o=d*((m-e)/m);x=setInterval(()=>{const s=Date.now()-t;let r;if(v>t){const e=Date.now()-v,t=m-b,o=t*3030.3030303030305;r=Math.min(b+e/o*t,m)}else r=Math.min(e+s/o*(m-e),m);r>y&&(y=r,E(y,h))},200)},k=()=>{x&&(clearInterval(x),x=null)};let T=!1;const j=t=>{if(S=!0,"string"==typeof t.error)return k(),$.stop(),console.error(e.red(t.error)),g=!0,void(T=!0);
|
|
1
|
+
import e from"chalk";import{debug as t,debugError as o}from"../../lib/debug.js";import{getDeployerBase as s,getBusinessApiBase as r}from"../../lib/api.js";import{ensureLoggedIn as n}from"../../services/auth.js";import{createSpinner as a}from"../../lib/spinner.js";import{isUserInterrupt as i,INTERRUPTED_MESSAGE as c}from"../../lib/errors.js";import{getApplicationUrl as l}from"../../lib/app-url.js";import{ensureAgreements as p}from"../../services/agreements.js";const d=3e5,m=99,f=e=>new Promise(t=>setTimeout(t,e)),u=async(s,r,n,a)=>{const i=await fetch(s,{method:"GET",headers:{Authorization:`Bearer ${r}`,Accept:"text/event-stream"}});if(t(`SSE connection opened: ${i.status}`),!i.ok){const t=i.status;let o="Failed to start deployment.";if(401===t||403===t)o="Please run 'dashnex login' to authenticate.";else try{const e=await i.text(),t=JSON.parse(e);"string"==typeof t.error?o=t.error:"string"==typeof t.message&&(o=t.message)}catch{}throw console.error(e.red(o)),new Error(`HTTP ${t}: ${o}`)}if(!i.body)throw new Error("Response body is null");t("SSE connection established successfully"),a?.();const c=i.body.getReader();try{for await(const e of async function*(e){const t=new TextDecoder("utf-8");let o="";for(;;){const{value:s,done:r}=await e.read();if(r)break;o+=t.decode(s,{stream:!0});const n=o.split("\n");o=n.pop()||"";let a="";for(const e of n)e.startsWith("data: ")?a=e.slice(6):""===e&&a&&(yield{data:a},a="")}if(o.startsWith("data: ")){const e=o.slice(6);e&&(yield{data:e})}}(c))try{if(!e.data){t("Received empty SSE event");continue}const o=JSON.parse(e.data);t(`SSE message received: ${JSON.stringify(o)}`),n(o)}catch(l){o(l),t(`Failed to parse SSE event data: ${e.data}`)}}finally{c.releaseLock()}};class y{async execute(){t("Deploy flow started");const r=await n();if(!r)return;if(!(await p(r.token,{ciMode:!0})))return;const l=`${s()}/business/v1/applications/deploy`;t(`GET ${l} (SSE)`);let y=0,h="",g=!1,w=0,S=!1;const $=a();let b=0,v=0,x=null;const E=(e,t)=>{const o=Math.round(e);$.text(`[${o}%] ${t}`)},D=()=>{k();const e=y,t=Date.now(),o=d*((m-e)/m);x=setInterval(()=>{const s=Date.now()-t;let r;if(v>t){const e=Date.now()-v,t=m-b,o=t*3030.3030303030305;r=Math.min(b+e/o*t,m)}else r=Math.min(e+s/o*(m-e),m);r>y&&(y=r,E(y,h))},200)},k=()=>{x&&(clearInterval(x),x=null)};let T=!1;const j=t=>{if(S=!0,"string"==typeof t.error)return k(),$.stop(),console.error(e.red(t.error)),g=!0,void(T=!0);"string"==typeof t.message&&(h=t.message),"number"==typeof t.progress&&(b=t.progress,v=Date.now(),t.progress>y&&(y=t.progress)),"string"!=typeof t.message&&"number"!=typeof t.progress||(y>=100?(k(),$.stop(),g=!0):E(y,h))};for(;w<=5;)try{return S?E(y,h):$.start("Connecting..."),D(),await u(l,r.token,j,()=>{S||($.text(`[${Math.round(y)}%] Deployment in progress...`),h="Deployment in progress...")}),k(),$.stop(),t("SSE connection closed"),T&&process.exit(1),void(g&&await this.showDeployedUrl(r.token))}catch(M){if(k(),o(M),t(`SSE connection error: ${M}`),g)return $.stop(),void(T&&process.exit(1));if(i(M))return $.stop(),void console.log(e.yellow(c));M instanceof Error&&M.message.startsWith("HTTP")&&($.stop(),console.error(e.red("Could not complete deployment. Check your connection and try again.")),process.exit(1)),w++,w>5&&($.stop(),console.error(e.red("Deployment failed. Maximum reconnection attempts exceeded.")),process.exit(1));const s=Math.min(1e3*Math.pow(2,w-1),3e4);t(`Connection error. Reconnecting in ${s/1e3}s... (attempt ${w}/5)`),await f(s)}}async showDeployedUrl(s){try{const o=`${r()}/business/v1/applications`;t(`GET ${o} (for deployed URL)`);const n=await fetch(o,{headers:{Authorization:`Bearer ${s}`}});if(!n.ok)return;const a=await n.json().catch(()=>({})),i=l({subdomain:a.subdomain,appFullCustomDomain:a.appFullCustomDomain});i&&console.log(`Application is deployed to ${e.cyan(i)}`)}catch(n){o(n)}}}export{y as DeployCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CreateCommand as e}from"./create.js";import{PullCommand as o}from"./pull.js";import{PushCommand as
|
|
1
|
+
import{CreateCommand as e}from"./create.js";import{PullCommand as o}from"./pull.js";import{PushCommand as p}from"./push.js";import{DeleteCommand as i}from"./delete.js";import{DeployCommand as a}from"./deploy.js";import{StatusCommand as t}from"./status.js";const s={name:"app",description:"Manage DashNex applications (should be executed in application folder)",handler:{execute:async()=>{}},options:[],subcommands:[{name:"create",description:"Create a new DashNex application",handler:new e,options:[{flags:"-t, --template <template>",description:"Template (name@branch-or-tag)",defaultValue:"webapp-base@live"},{flags:"--subdomain <subdomain>",description:"Subdomain (CI mode, skip prompts)"}]},{name:"pull",description:"Pull existing application to specified folder",handler:new o,options:[{flags:"-y, --yes",description:"Skip prompts and child commands (CI mode)"}]},{name:"push",description:"Push local application to DashNex",handler:new p,options:[{flags:"--deploy",description:"Auto-deploy after push (skip prompt)"},{flags:"--no-deploy",description:"Skip deploy prompt"},{flags:"--no-check",description:"Skip pre-push checks"}]},{name:"delete",description:"Delete application from DashNex",handler:new i,options:[{flags:"-y, --yes",description:"Skip confirmation prompt"}]},{name:"deploy",description:"Deploy application to DashNex",handler:new a,options:[]},{name:"status",description:"Show current application status",handler:new t,options:[]}]};export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"chalk";import t from"fs-extra";import
|
|
1
|
+
import e from"chalk";import t from"fs-extra";import r from"path";import o from"os";import{spawn as i}from"child_process";import s from"inquirer";import a from"adm-zip";import{debug as n,debugError as l}from"../../lib/debug.js";import{getBusinessApiBase as c}from"../../lib/api.js";import{ensureLoggedIn as d}from"../../services/auth.js";import{createSpinner as p}from"../../lib/spinner.js";import{isUserInterrupt as m,INTERRUPTED_MESSAGE as f}from"../../lib/errors.js";import{runInstallInDir as u}from"../install.js";import{runDevInDir as g}from"../dev.js";const h=async(t,o)=>{const{install:a}=await s.prompt([{type:"confirm",name:"install",message:"Install dependencies?",default:!0}]);if(!a){if(r.resolve(t)!==r.resolve(o)){const i=r.relative(o,t);console.log(e.cyan(`Run "cd ${i}" to change to the application folder.`))}return}try{const e=p();e.start("Installing dependencies...");try{const r=await u(t);if(e.stop(),0!==r)return void n(`install exited with code ${r}`)}catch(m){throw e.stop(),m}}catch(m){return l(m),void console.error(e.red(m instanceof Error?m.message:"Failed to run install."))}const{migrate:c}=await s.prompt([{type:"confirm",name:"migrate",message:"Create or update database?",default:!0}]);if(!c)return;n(`Running dashnex db migrate in ${t}`);try{const e=p();e.start("Creating or updating database...");try{const r=await((e,t)=>new Promise((r,o)=>{const s=i(t,{cwd:e,shell:!0,stdio:"inherit",env:void 0});s.on("error",e=>{l(e),o(e)}),s.on("close",e=>{r(null===e?0:e)})}))(t,"dashnex db migrate");if(e.stop(),0!==r)return void n(`dashnex db migrate exited with code ${r}`)}catch(m){throw e.stop(),m}}catch(m){return l(m),void console.error(e.red("Failed to run dashnex db migrate."))}const{dev:d}=await s.prompt([{type:"confirm",name:"dev",message:"Run development server?",default:!0}]);if(d)try{await g(t)}catch(m){l(m),console.error(e.red(m instanceof Error?m.message:"Failed to run dev server."))}},w=(e,t)=>{if(r.resolve(e)===r.resolve(t))return"Application is successfully pulled.";return`Application is successfully pulled into ${r.relative(t,e)}.`};class v{async execute(i={}){n("Pull flow started");const u=await d();if(!u)return;const g=process.cwd();let v;if(i.folder)v=i.folder.trim()||".",n(`Folder argument provided: ${v}`);else{n("No folder argument, prompting user");const{folder:e}=await s.prompt([{type:"input",name:"folder",message:"Which folder to pull the application to?",default:"."}]);v=e.trim()||"."}const y=r.resolve(g,v);n(`Target folder resolved: ${y}`);const x=await t.pathExists(y);let $=!1;if(x)try{$=(await t.readdir(y)).length>0,n(`Folder exists: ${x}, has files: ${$}`)}catch(C){n(`Error reading folder: ${C}`)}if($&&!i.yes){const{confirm:t}=await s.prompt([{type:"confirm",name:"confirm",message:"Existing files will be overwritten. Continue?",default:!0}]);if(!t)return n("User declined confirmation, exiting"),void console.log(e.yellow("Pull cancelled."));n("User confirmed overwrite")}await t.ensureDir(y),n(`Target folder ensured: ${y}`);const b=`${c()}/business/v1/cli/pull`;n(`GET ${b}`);const j=r.join(o.tmpdir(),`dashnex-pull-${Date.now()}-${Math.random().toString(36).slice(2)}.zip`),E=p();E.start("Pulling application...");try{const o=await fetch(b,{headers:{Authorization:`Bearer ${u.token}`}});if(n(`Response: ${o.status}`),!o.ok){E.stop();const t=o.headers.get("content-type")??"";let r="Failed to pull application.";if(401===o.status||403===o.status)r="Please run 'dashnex login' to authenticate.";else if(404===o.status)r="Business has no application. Run 'dashnex app create' to create one.";else if(t.includes("application/json")){const e=(e=>"string"==typeof e.error?e.error:"string"==typeof e.message?e.message:void 0)(await o.json().catch(()=>({})));e&&(r=e)}console.error(e.red(r)),process.exit(1)}E.text("Downloading...");const s=Buffer.from(await o.arrayBuffer());await t.writeFile(j,s),n("Zip written to temp file"),E.text("Extracting...");new a(j).extractAllTo(y,!0),E.stop(),n("Extracted to target folder"),r.resolve(y)!==r.resolve(g)?(console.log(e.green(w(y,g))),process.chdir(y),n(`Changed working directory to ${y}`)):console.log(e.green(w(y,g))),i.yes?n("CI mode (--yes), skipping post-pull child commands"):await h(y,g)}catch(C){if(E.stop(),l(C),C instanceof Error&&C.message.startsWith("EXIT:"))throw C;if(m(C))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 t.remove(j).catch(()=>{}),n("Temp zip removed")}}}export{v as PullCommand};
|
|
@@ -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","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
|
|
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=d();o.start("Running checks...");const t=new u,i=await t.run(!0);o.stop(),i||(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/commands/check.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{spawn as e}from"child_process";import o from"chalk";import{debug as
|
|
1
|
+
import{spawn as e}from"child_process";import o from"path";import n from"fs-extra";import r from"chalk";import{debug as s,debugError as c}from"../lib/debug.js";const t="Run this command in a DashNex Web application folder.",i=e=>{const r=o.join(e,"dashnex.json");return n.pathExistsSync(r)},a=(o,n,r={})=>{const t=`${o} ${n.join(" ")}`,i=!0===r.silent;return new Promise((n,r)=>{s(`Running: ${t}`);const a=e(t,{stdio:i?["ignore","pipe","pipe"]:"inherit",cwd:process.cwd(),shell:!0});a.on("error",e=>{c(e),r(e)}),a.on("close",e=>{s(`${o} exited with code ${e}`),n(null===e?1:e)})})},l=o=>new Promise(n=>{const r=e(`${o} --version`,{stdio:"ignore",shell:!0});r.on("error",()=>n(!1)),r.on("close",e=>n(0===e))}),d=[{name:"TypeScript",command:"npx",args:["tsc","--noEmit"],notFoundMessage:"TypeScript is not available. Please install it with: npm install -D typescript"}];class p{async execute(){s("Check flow started"),i(process.cwd())||(console.error(r.red(t)),process.exit(1)),s(`Running ${d.length} check(s)`);for(const o of d){s(`Running check: ${o.name}`);await l(o.command)||(console.error(r.red(o.notFoundMessage)),process.exit(1));try{0!==await a(o.command,o.args)&&(console.error(r.red("Check failed.")),process.exit(1))}catch(e){c(e),console.error(r.red(o.notFoundMessage)),process.exit(1)}}console.log(r.green("All checks passed."))}async run(e=!1){if(s("Running checks (called from push)"),!i(process.cwd()))return e||console.error(r.red(t)),!1;const o=e?{silent:!0}:void 0;for(const t of d){s(`Running check: ${t.name}`);if(!(await l(t.command)))return console.error(r.red(t.notFoundMessage)),!1;try{if(0!==await a(t.command,t.args,o))return!1}catch(n){return c(n),console.error(r.red(t.notFoundMessage)),!1}}return e||console.log(r.green("All checks passed.")),!0}}export{p as CheckCommand};
|
package/dist/commands/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{spawn as e}from"child_process";import r from"path";import t from"fs-extra";import n from"chalk";import{debug as o,debugError as s}from"../lib/debug.js";const i=["Using vars defined in \\.env","\\(node:\\d+\\) MaxListenersExceededWarning:","\\(Use `node --trace-warnings","\\[WARNING\\].*You have defined bindings to the following internal Durable Objects","You have defined bindings to the following internal Durable Objects",'\\{"name":".+","class_name":".+"\\}',"These will not work in local development, but they should work in production","If you want to develop these locally, you can define your DO in a separate Worker","For detailed instructions, refer to the Durable Objects section here:","developers.cloudflare.com/workers/wrangler/api#supported-bindings","workerd/server/server\\.c\\+\\+.*warning:.*DurableObjectNamespace"],a=(e,r)=>r.length>0&&r.some(r=>r.test(e)),c=(e,r)=>{let t="";return{write:n=>{const s="string"==typeof n?n:n.toString();t+=s;const i=t.split(/\r?\n/);t=i.pop()??"";for(const t of i){const n=t.trim();n?a(n,r)?o(`Filtered: ${n}`):e.write(t+"\n"):o("Filtered: <empty line>")}},flush:()=>{const n=t.trim();if(n){if(a(n,r))return o(`Filtered: ${n}`),void(t="");e.write(t),t=""}else t=""}}},l=async(n,a={})=>{const l=r.join(n,"dashnex.json"),d=r.join(n,"package.json");if(o(`Checking for dashnex.json at: ${l}`),!(await t.pathExists(l)))throw new Error("
|
|
1
|
+
import{spawn as e}from"child_process";import r from"path";import t from"fs-extra";import n from"chalk";import{debug as o,debugError as s}from"../lib/debug.js";const i=["Using vars defined in \\.env","\\(node:\\d+\\) MaxListenersExceededWarning:","\\(Use `node --trace-warnings","\\[WARNING\\].*You have defined bindings to the following internal Durable Objects","You have defined bindings to the following internal Durable Objects",'\\{"name":".+","class_name":".+"\\}',"These will not work in local development, but they should work in production","If you want to develop these locally, you can define your DO in a separate Worker","For detailed instructions, refer to the Durable Objects section here:","developers.cloudflare.com/workers/wrangler/api#supported-bindings","workerd/server/server\\.c\\+\\+.*warning:.*DurableObjectNamespace"],a=(e,r)=>r.length>0&&r.some(r=>r.test(e)),c=(e,r)=>{let t="";return{write:n=>{const s="string"==typeof n?n:n.toString();t+=s;const i=t.split(/\r?\n/);t=i.pop()??"";for(const t of i){const n=t.trim();n?a(n,r)?o(`Filtered: ${n}`):e.write(t+"\n"):o("Filtered: <empty line>")}},flush:()=>{const n=t.trim();if(n){if(a(n,r))return o(`Filtered: ${n}`),void(t="");e.write(t),t=""}else t=""}}},l=async(n,a={})=>{const l=r.join(n,"dashnex.json"),d=r.join(n,"package.json");if(o(`Checking for dashnex.json at: ${l}`),!(await t.pathExists(l)))throw new Error("Run this command in a DashNex Web application folder.");if(o("dashnex.json found, checking for package.json"),!(await t.pathExists(d)))throw new Error("package.json is missing.");let p;o("package.json found, checking for dev script");try{p=await t.readJson(d)}catch(u){throw s(u),new Error("Failed to read package.json.")}if(!p.scripts||!p.scripts.dev)throw new Error('The "dev" script is missing from package.json. Please add a "dev" script to package.json.');o("dev script found, checking for npm availability");const h=await(async r=>new Promise(t=>{const n=e(`${r} --version`,{stdio:"ignore",shell:!0});n.on("error",()=>{t(!1)}),n.on("close",e=>{t(0===e)})}))("npm");if(o(`npm available: ${h}`),!h)throw new Error("npm is not available. Please install npm to continue.");const f=a.https?["--","--experimental-https"]:[];o(`npm available, executing: npm run dev in ${n}${a.https?" -- --experimental-https":""}`);return(async(r,t=[],n=process.cwd(),o=[])=>{const i=t.length?`${r} ${t.join(" ")}`:r,a=o.length>0;return new Promise((r,t)=>{const l=e(i,{stdio:a?["inherit","pipe","pipe"]:"inherit",cwd:n,shell:!0,env:{...process.env,NODE_ENV:"development"}});if(l.on("error",e=>{s(e),t(e)}),a&&l.stdout&&l.stderr){const e=c(process.stdout,o),t=c(process.stderr,o);l.stdout.on("data",r=>e.write(r)),l.stderr.on("data",e=>t.write(e)),l.on("close",n=>{e.flush(),t.flush(),r(null===n?0:n)})}else l.on("close",e=>{r(null===e?0:e)})})})("npm run dev",f,n,(()=>{const e=[];for(const r of i)try{e.push(new RegExp(r))}catch{o(`Invalid dev output filter pattern ignored: ${r}`)}return e})())};class d{async execute(e={}){o("Dev flow started");try{const r=await l(process.cwd(),e);process.exit(r)}catch(r){if(r instanceof Error&&r.message.startsWith("EXIT:"))throw r;s(r),r instanceof Error?console.error(n.red(r.message)):console.error(n.red("Failed to run npm run dev")),process.exit(1)}}}export{d as DevCommand,l as runDevInDir};
|
package/dist/commands/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"./version.js";import{LoginCommand as
|
|
1
|
+
import o from"./version.js";import{LoginCommand as e}from"./login.js";import{LogoutCommand as i}from"./logout.js";import{WhoamiCommand as n}from"./whoami.js";import{DevCommand as s}from"./dev.js";import{CheckCommand as r}from"./check.js";import{InstallCommand as t}from"./install.js";import p from"./app/index.js";import a from"./secrets/index.js";const d=[{name:"version",description:"Display the version of the CLI",handler:new o,options:[]},{name:"login",description:"Log in to your DashNex account",handler:new e,options:[{flags:"--email <email>",description:"Email address (skip prompt)"},{flags:"--password <password>",description:"Password (skip prompt)"},{flags:"--code <code>",description:"2FA code (skip prompt)"},{flags:"--business <id>",description:"Business ID to select (skip prompt)"}]},{name:"logout",description:"Log out and remove local credentials",handler:new i,options:[]},{name:"whoami",description:"Show current logged-in business and user",handler:new n,options:[]},{name:"dev",description:"Run the development server (run in DashNex application folder)",handler:new s,options:[{flags:"--https",description:"Run dev server with HTTPS"}]},{name:"check",description:"Run build-time validations (run in DashNex application folder)",handler:new r,options:[]},{name:"install",description:"Install dependencies using pnpm or npm (run in DashNex application folder)",handler:new t,options:[]},p,a];export{d as default};
|
package/dist/commands/install.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{spawn as e}from"child_process";import
|
|
1
|
+
import{spawn as e}from"child_process";import o from"path";import s from"fs-extra";import n from"chalk";import{debug as r,debugError as t}from"../lib/debug.js";import{createSpinner as i}from"../lib/spinner.js";const c=async o=>new Promise(s=>{const n=e(`${o} --version`,{stdio:"ignore",shell:!0});n.on("error",()=>{s(!1)}),n.on("close",e=>{s(0===e)})}),a=async o=>{const s=await(async()=>await c("pnpm")?"pnpm":await c("npm")?"npm":null)();if(!s)throw new Error("Neither pnpm nor npm is available. Please install pnpm (recommended) or npm to continue.");const n=`${s} ${["install","--ignore-scripts"].join(" ")}`;return r(`Using package manager: ${s}`),r(`Executing: ${n} in ${o}`),new Promise((s,r)=>{const i=[],c=[],a=e(n,{stdio:["ignore","pipe","pipe"],cwd:o,shell:!0,env:{...process.env,NPM_CONFIG_LOGLEVEL:"error"}});a.stdout&&a.stdout.on("data",e=>i.push(e)),a.stderr&&a.stderr.on("data",e=>c.push(e)),a.on("error",e=>{t(e),r(e)}),a.on("close",e=>{const o=null===e?0:e;0!==o&&(i.length&&process.stdout.write(Buffer.concat(i)),c.length&&process.stderr.write(Buffer.concat(c))),s(o)})})};class l{async execute(){r("Install flow started");const c=o.join(process.cwd(),"dashnex.json");await s.pathExists(c)||(console.error(n.red("Run this command in a DashNex Web application folder.")),process.exit(1));const l=process.cwd(),p=i();p.start("Installing dependencies...");try{const o=await a(l);0!==o&&(p.stop(),process.exit(o)),p.text("Building module registry...");const s=await(async o=>new Promise((s,n)=>{r(`Running: npx dashnex build --with-config in ${o}`);const i=e("npx dashnex build --with-config",{stdio:"ignore",cwd:o,shell:!0});i.on("error",e=>{t(e),n(e)}),i.on("close",e=>{s(null===e?1:e)})}))(l);p.stop(),0!==s&&(t(new Error(`dashnex build --with-config exited with code ${s}`)),console.error(n.red("Install completed but module registry build failed.")),process.exit(1)),process.exit(0)}catch(d){p.stop(),t(d),d instanceof Error?console.error(n.red(d.message)):console.error(n.red("Failed to run install")),process.exit(1)}}}export{l as InstallCommand,a as runInstallInDir};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ListSecretsCommand as e}from"./list.js";import{SetSecretCommand as t}from"./set.js";import{DeleteSecretCommand as s}from"./delete.js";const n={name:"secrets",description:"Manage
|
|
1
|
+
import{ListSecretsCommand as e}from"./list.js";import{SetSecretCommand as t}from"./set.js";import{DeleteSecretCommand as s}from"./delete.js";const n={name:"secrets",description:"Manage DashNex secrets",handler:{execute:async()=>{}},options:[],subcommands:[{name:"list",description:"List all secret names bound to the worker",handler:new e,options:[]},{name:"set",description:"Create or update a secret",handler:new t,options:[{flags:"--name <name>",description:"Secret name"},{flags:"--value <value>",description:"Secret value"}]},{name:"delete",description:"Delete a secret",handler:new s,options:[{flags:"--name <name>",description:"Secret name"}]}]};export{n as default};
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="@dashnex/cli",a="0.5.
|
|
1
|
+
const e="@dashnex/cli",a="0.5.60",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