dashnex 0.5.75 → 0.5.76
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/bin/dashnex +10 -2
- package/dist/cli.js +1 -1
- package/dist/package.js +1 -1
- package/package.json +4 -1
package/bin/dashnex
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const MIN_NODE_MAJOR = 22
|
|
4
|
+
const current = process.versions.node
|
|
5
|
+
const currentMajor = Number.parseInt(current.split('.')[0], 10)
|
|
6
|
+
if (!Number.isFinite(currentMajor) || currentMajor < MIN_NODE_MAJOR) {
|
|
7
|
+
console.error(`dashnex requires Node.js >= ${MIN_NODE_MAJOR}. You are running Node ${current}.`)
|
|
8
|
+
console.error('Upgrade Node: https://nodejs.org/')
|
|
9
|
+
process.exit(1)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
await import('../dist/cli.js')
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import o from"./package.js";import{INTERRUPTED_MESSAGE as n,isUserInterrupt as e}from"./lib/errors.js";import{Command as s}from"commander";import
|
|
2
|
+
import o from"./package.js";import{INTERRUPTED_MESSAGE as n,isUserInterrupt as e}from"./lib/errors.js";import{Command as s}from"commander";import c from"chalk";import i from"fs-extra";import t from"path";import{fileURLToPath as r,pathToFileURL as a}from"url";import{execSync as d}from"child_process";import l from"dotenv";var m=new s,{version:p,description:f}=o;m.name("dashnex").description(f).version(p).option("--ci","Disable spinner and interactive prompts (CI mode)").arguments("[command...]").action(o=>{if(o&&o.length>0){const n=o[0];if(!m.commands.map(o=>o.name()).includes(n)){console.error(c.red(`Unknown command: ${n}`));const o=process.cwd(),e=i.existsSync(t.join(o,"dashnex.json")),s=i.existsSync(t.join(o,"node_modules"));["build","router","bindings","env","db"].includes(n)?e&&!s?console.log(c.yellow(`\`${n}\` is provided by installed modules. Run \`dashnex install\` first.`)):e?console.log(c.green("Run `dashnex` to see available commands.")):console.log(c.yellow(`\`${n}\` must be run inside a DashNex application folder (containing dashnex.json).`)):console.log(c.green("Run `dashnex` to see available commands.")),process.exit(1)}}!function(o){const n=[];n.push("Usage: dashnex [options] [command]"),n.push(""),n.push(o.description()),n.push(""),n.push("Options:"),o.options.forEach(o=>{const e=o.flags.padEnd(20);n.push(` ${e} ${o.description}`)}),n.push(""),n.push("Commands:"),o.commands.forEach(o=>{const e=` ${o.name().padEnd(20)} ${o.description()}`;n.push(e),o.commands.length>0&&o.commands.forEach(o=>{const e=` ${o.name().padEnd(20)} ${o.description()}`;n.push(e)})}),console.log(n.join("\n"))}(m)});var u=null;async function h(o,n){const e=[];try{const s=function(o,n){const e=t.join(n,"package.json");if(i.existsSync(e))try{const s=JSON.parse(i.readFileSync(e,"utf8"));if(s.name===o)return n;const c={...s.dependencies,...s.devDependencies}[o];if(c&&(c.startsWith("link:")||c.startsWith("file:"))){const o=t.resolve(n,c.replace(/^(link:|file:)/,""));if(i.existsSync(o))return o}}catch{}const s=t.join(n,"node_modules",o);if(i.existsSync(s))return i.realpathSync(s);if(u){const n=t.join(u,o);if(i.existsSync(n))return n}return s}(o,n),c=[t.join(s,"dist","commands","index.js"),t.join(s,"src","commands","index.ts"),t.join(s,"src","commands","index.js")].find(o=>i.existsSync(o));if(c){const o=await import(a(c).href);let n=[];o.default?n=Array.isArray(o.default)?o.default:[]:o.commands&&(n=Array.isArray(o.commands)?o.commands:[]),n.length>0&&e.push(...n)}}catch(s){if(process.env.DEBUG){const n=s instanceof Error?s.message:String(s);console.log(c.yellow(`Module ${o} has no commands or failed to load: ${n}`))}}return e}function y(o,s,i={}){const t=o.command(s.name).description(s.description);"pull"===s.name&&t.arguments("[folder]"),t.option("--ci","Disable spinner (CI mode)"),s.options&&s.options.forEach(o=>{void 0!==o.defaultValue?"number"==typeof o.defaultValue?t.option(o.flags,o.description,String(o.defaultValue)):t.option(o.flags,o.description,o.defaultValue):t.option(o.flags,o.description)}),s.subcommands&&s.subcommands.forEach(o=>{y(t,o,{...i,...s.options})});const r=s.subcommands&&s.subcommands.length>0;"pull"===s.name?t.action(async(o,t,r)=>{try{const n={...i,...t};o&&(n.folder=o),await s.handler.execute(n)}catch(a){if(e(a))return void console.log(c.yellow(n));console.error(c.red(`❌ Command failed in ${s.name}:`),a),process.exit(1)}}):r?t.action(async()=>{t.outputHelp()}):t.action(async(o,t)=>{try{const n={...i,...o};await s.handler.execute(n)}catch(r){if(e(r))return void console.log(c.yellow(n));console.error(c.red(`❌ Command failed in ${s.name}:`),r),process.exit(1)}})}(async function(){l.config({quiet:!0}),process.env.DASHNEX_CLI="1",function(){try{u=d("npm root -g",{encoding:"utf8"}).trim()}catch{u=null}}(),process.argv.includes("--ci")&&(process.env.DASHNEX_CI="1");let o=process.cwd();const n=t.dirname(r(import.meta.url)),e=t.resolve(n,"..");process.env.DEBUG&&(console.log(`CLI started from directory: ${o}`),console.log(`CLI package directory: ${e}`),console.log(`Global node_modules: ${u??"not found"}`));const s=await async function(o){try{const e=[],s=/* @__PURE__ */new Set,c=o=>{s.has(o)||(s.add(o),e.push(o))},r=t.join(o,"dashnex.json");if(i.existsSync(r)){const n=t.join(o,"package.json");if(i.existsSync(n)){const o=JSON.parse(i.readFileSync(n,"utf8"));o.name&&c(o.name)}}const a=t.join(o,"package.json");if(i.existsSync(a)){const n=JSON.parse(i.readFileSync(a,"utf8")),e={...n.dependencies,...n.devDependencies,...n.optionalDependencies};for(const[s,r]of Object.entries(e)){if("string"==typeof r&&(r.startsWith("link:")||r.startsWith("file:"))){const n=t.resolve(o,r.replace(/^(link:|file:)/,""));if(i.existsSync(t.join(n,"dashnex.json"))){c(s);continue}}const n=t.join(o,"node_modules",s);i.existsSync(t.join(n,"dashnex.json"))&&c(s)}}if(u&&i.existsSync(u))try{const o=i.readdirSync(u);for(const n of o)if(n.startsWith("@")){const o=t.join(u,n);try{if(i.statSync(o).isDirectory()){const e=i.readdirSync(o);for(const o of e){const e=`${n}/${o}`,s=t.join(u,e);i.existsSync(t.join(s,"dashnex.json"))&&c(e)}}}catch{}}else{const o=t.join(u,n);i.existsSync(t.join(o,"dashnex.json"))&&c(n)}}catch(n){if(process.env.DEBUG){const o=n instanceof Error?n.message:String(n);console.log("⚠ Error scanning global node_modules:",o)}}return e}catch(n){if(process.env.DEBUG){const o=n instanceof Error?n.message:String(n);console.log("⚠ Error reading app package.json:",o)}return[]}}(o);s.includes("@dashnex/cli")||s.push("@dashnex/cli"),process.env.DEBUG&&(console.log(`CLI package directory: ${e}`),console.log(`Discovered modules: ${s.join(", ")}`));for(const r of s){let n=[];if("@dashnex/cli"===r)try{const o=t.join(e,"dist","commands","index.js");if(process.env.DEBUG&&console.log(`Loading @dashnex/cli commands from: ${o}`),await i.pathExists(o)){const e=await import(a(o).href);e.default?n=Array.isArray(e.default)?e.default:[]:e.commands&&(n=Array.isArray(e.commands)?e.commands:[]),process.env.DEBUG&&console.log(`Loaded ${n.length} commands from @dashnex/cli`)}}catch(p){if(process.env.DEBUG){const o=p instanceof Error?p.message:String(p);console.log(c.yellow(`Failed to load @dashnex/cli commands: ${o}`))}}else n=await h(r,o);for(const o of n)y(m,o)}try{const{default:n}=await import(a(t.join(o,"dist","commands","index.js")).href);if(n&&Array.isArray(n))for(const o of n)y(m,o)}catch(p){process.env.DEBUG&&console.error(c.yellow("⚠ Failed to discover application commands"))}m.parse(process.argv)})().catch(o=>{e(o)&&(console.log(c.yellow(n)),process.exit(0)),console.error(c.red("❌ CLI failed:"),o),process.exit(1)});
|
package/dist/package.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={$schema:"https://json.schemastore.org/package",name:"@dashnex/cli",version:"0.5.
|
|
1
|
+
var e={$schema:"https://json.schemastore.org/package",name:"@dashnex/cli",version:"0.5.76",description:"Command-line interface for DashNex framework",homepage:"https://dashnex.io",type:"module",bin:{dashnex:"bin/dashnex"},engines:{node:">=22"},exports:{".":{types:"./dist/server.d.ts",default:"./dist/server.js"},"./client":{types:"./dist/client.d.ts",default:"./dist/client.js"}},scripts:{build:"vite build",dev:"vite build --watch --mode development",test:"vitest run"},keywords:["dashnex","cli"],author:"Dashnex Team",license:"UNLICENSED",dependencies:{"adm-zip":"^0.5.17",chalk:"^5.6.2",commander:"^14.0.3",dotenv:"^17.4.2","fs-extra":"^11.3.4",ignore:"^7.0.5",inquirer:"^13.4.1"},devDependencies:{"@dashnex/types":"^1.0.2","@types/adm-zip":"^0.5.8","@types/fs-extra":"^11.0.4","@types/inquirer":"^9.0.9","@types/node":"^25.6.0",eslint:"^9.39.4","rollup-plugin-preserve-directives":"^0.4.0",terser:"^5.46.1",typescript:"^5.9.3",vite:"^8.0.8","vite-plugin-dts":"5.0.0-beta.6",vitest:"^4.1.4"},publishConfig:{registry:"https://npm.dashnex.com/"},files:["dist","bin"]};export{e as default};
|
package/package.json
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "dashnex",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.76",
|
|
5
5
|
"description": "Command-line interface for DashNex framework",
|
|
6
6
|
"homepage": "https://dashnex.io",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"bin": {
|
|
9
9
|
"dashnex": "bin/dashnex"
|
|
10
10
|
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=22"
|
|
13
|
+
},
|
|
11
14
|
"exports": {
|
|
12
15
|
".": {
|
|
13
16
|
"types": "./dist/server.d.ts",
|