@mxfb/cli 0.0.40 → 0.0.42
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/cli/assets/version.txt +1 -1
- package/cli/index.js +1 -1
- package/package.json +1 -1
package/cli/assets/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.42
|
package/cli/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import d from"node:process";import{promises as e}from"node:fs";import f from"node:url";import i from"node:path";import{spawn as u}from"node:child_process";import{program as t}from"commander";var g=f.fileURLToPath(import.meta.url),a=i.dirname(g);t.name("@mxfb-cli/cli").description("The home of @mxfb/cli's project");t.command("list").description("list all the available commands").action(h);t.command("version").description("print current version of the package").action(b);t.command("*",{hidden:!0}).allowUnknownOption().action(async(...s)=>{let[,o]=s
|
|
2
|
+
import d from"node:process";import{promises as e}from"node:fs";import f from"node:url";import i from"node:path";import{spawn as u}from"node:child_process";import{program as t}from"commander";var g=f.fileURLToPath(import.meta.url),a=i.dirname(g);t.name("@mxfb-cli/cli").description("The home of @mxfb/cli's project");t.command("list").description("list all the available commands").action(h);t.command("version").description("print current version of the package").action(b);t.command("*",{hidden:!0}).allowUnknownOption().action(async(...s)=>{let[,o]=s;console.log(o.args);let[n]=o.args;if(n===void 0)return t.help();if(!(await m()).includes(n))return t.help();let c=o.args.slice(1),l=i.join(a,"../",n,"index.js");u(l,c,{stdio:"inherit"}).on("error",p=>console.error(`Failed to start subprogram '${n}':`,p))});console.log("i am main");t.parse(d.argv);async function m(){let s=i.join(a,"assets/list.txt");return(await e.readFile(s,{encoding:"utf-8"})).split(`
|
|
3
3
|
`).map(n=>n.trim())}async function h(){let o=(await m()).map(n=>{let r=Object.assign(new Array(24).fill(" "),n.split("")).join("");return n==="cli"?`${r} # npx @mxfb/cli --help`:`${r} # npx @mxfb/cli ${n} --help`}).join(`
|
|
4
4
|
`);console.log(o)}async function b(){let s=i.join(a,"assets/version.txt"),o=await e.readFile(s,{encoding:"utf-8"});console.log(o)}
|