jja 2.3.4 → 2.3.6

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/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "jja",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.3.6",
5
5
  "description": "一些在终端的执行动作 🥜",
6
6
  "license": "MIT",
7
7
  "dependencies": {
8
8
  "@color-pen/static": "^1.0.0",
9
- "@qqi/copy-text": "^1.0.0",
10
- "@qqi/dev-log": "^1.0.1",
11
- "a-command": "^2.2.5",
9
+ "@qqi/copy-text": "^1.0.1",
10
+ "@qqi/dev-log": "^1.0.2",
11
+ "a-command": "^2.3.2",
12
12
  "a-js-tools": "^1.0.0",
13
- "a-node-tools": "^4.2.1",
14
- "a-type-of-js": "^1.0.0",
15
- "color-pen": "^2.0.10"
13
+ "a-node-tools": "^4.2.5",
14
+ "a-type-of-js": "^1.0.1",
15
+ "color-pen": "^2.0.10",
16
+ "colored-table": "^0.0.2"
16
17
  },
17
18
  "author": {
18
19
  "name": "🥜",
package/src/dog.mjs CHANGED
@@ -1 +1 @@
1
- import e from"@qqi/dev-log";const o=new e({name:"jja",type:!1});export{o as dog};
1
+ import o from"@qqi/dev-log";import{isFalse as e}from"a-type-of-js";const t=new o({name:"jja",type:!1});e(t.type);export{t as dog};
@@ -1 +1 @@
1
- import{isUndefined as t}from"a-type-of-js";import{command as o}from"../command.mjs";import{tagCommit as m}from"./tagCommit.mjs";async function a(){const a=await o.question({text:"请输入待标记的信息",private:!0});t(a)||await m(a)}export{a as beforeTagCommit};
1
+ import{isUndefined as t}from"a-type-of-js";import{command as o}from"../command.mjs";import{tagCommit as m}from"./tagCommit.mjs";async function a(){const a=await o.question({text:"请输入待标记的信息"});t(a)||await m(a)}export{a as beforeTagCommit};
@@ -1 +1 @@
1
- import{command as o}from"../command.mjs";import{getDirectoryBy as t,_p as r,runOtherCode as e}from"a-node-tools";import{hexPen as i}from"color-pen";import{tagCommit as c}from"./tagCommit.mjs";async function n(n="版本维护",s=!1){const a=t(".git","directory");if(null==a)return r(i("#ff0")("not a git repository(当前目录非 git 储存库)"));const m=await e({code:"git add .",cwd:a});if(!m.success)return null!=console.log(m.error);const l=await e({code:"git status",cwd:a});if(!/nothing to commit, working tree clean/.test(l.data||"")){const t=await e({code:"git add .",cwd:a});if(!t.success)return null!=console.log(t.error);""==n.trim()&&(n=await o.question({text:"请输入提交信息",private:!0})||"");const r=await e({code:`git commit -m "${n}"`,cwd:a});return r.success?(r.error&&console.log(r.error),await e({code:"git push",cwd:a}),s&&await c(n),!0):null!=console.log(r.error)}return!1}export{n as gitCommit};
1
+ import{command as o}from"../command.mjs";import{getDirectoryBy as t,_p as r,runOtherCode as c}from"a-node-tools";import{hexPen as e}from"color-pen";import{tagCommit as i}from"./tagCommit.mjs";async function n(n="版本维护",s=!1){const a=t(".git","directory");if(null==a)return r(e("#ff0")("not a git repository(当前目录非 git 储存库)"));const m=await c({code:"git add .",cwd:a});if(!m.success)return null!=console.log(m.error);const l=await c({code:"git status",cwd:a});if(!/nothing to commit, working tree clean/.test(l.data||"")){const t=await c({code:"git add .",cwd:a});if(!t.success)return null!=console.log(t.error);""==n.trim()&&(n=await o.question({text:"请输入提交信息"})??"");const r=await c({code:`git commit -m "${n}"`,cwd:a});return r.success?(r.error&&console.log(r.error),await c({code:"git push",cwd:a}),s&&await i(n),!0):null!=console.log(r.error)}return!1}export{n as gitCommit};
@@ -1 +1 @@
1
- import{runOtherCode as a}from"a-node-tools";import{command as t}from"../command.mjs";async function o(o){if(""==o){const i=await a("git branch -a");console.log(i.data),o=await t.question({text:"请输入要合并分支的名称",private:!0})||""}const i=await t.selection({data:["正常快进合并","非快进合并 (--no-ff)","多提交记录合并为一条 (--squash)"],private:!0},"number");await a(`git merge ${o} ${["","--no-ff","--squash"][i]}`)}export{o as gitMerge};
1
+ import{runOtherCode as a}from"a-node-tools";import{command as t}from"../command.mjs";import{isBusinessEmptyString as o,isUndefined as e}from"a-type-of-js";async function i(i){if(o(i)){const o=await a("git branch -a");console.log(o.data),i=await t.question({text:"请输入要合并分支的名称"})??""}if(o(i))return t.ERROR("没有获取到要合并的分支");const n=await t.selection({data:[{label:"正常快进合并",value:""},{label:"非快进合并 (--no-ff)",value:"--no-ff"},{label:"多提交记录合并为一条 (--squash)",value:"--squash",tip:"适用于将众多小的提交合并成一个提交"}]});e(n)?t.ERROR("您选择退出合并"):await a(`git merge ${i} ${n}`)}export{i as gitMerge};
package/src/main.mjs CHANGED
@@ -1 +1 @@
1
- import{dog as a}from"./dog.mjs";import{command as r}from"./command.mjs";import{remove as t}from"./remove/index.mjs";import i from"./update/index.mjs";import{packageManage as e}from"./package/index.mjs";import{clearScreen as n}from"./clearScreen.mjs";import m from"./git/index.mjs";import{isUndefined as o}from"a-type-of-js";import{dns as p}from"./dns/index.mjs";const s=r.args.$arrMap;0===r.args.$only.length&&(a("没有匹配到子命令,打印帮助信息并退出"),r.help(),r.end());try{await async function c(){0===s.length&&r.end();const d=s.shift();if(o(d))return await c();"remove"in d?(a("执行文件移除"),await t(d.remove)):"clearScreen"in d||"clear"in d?(a("执行清屏"),await n()):"git"in d?(a("执行 git 相关命令"),await m(d.git)):"package"in d?(a("执行 package 相关命令"),await e(d.package)):"update"in d?(a("执行 update 相关命令"),await i(d.update)):"dns"in d&&(a("执行 dns 相关的命令"),await p(d.dns));try{await c()}catch(r){a.error("执行 run 报错",r)}}()}catch(r){a.error("执行 run 报错",r)}
1
+ import{dog as r}from"./dog.mjs";import{command as t}from"./command.mjs";import{remove as a}from"./remove/index.mjs";import i from"./update/index.mjs";import{packageManage as e}from"./package/index.mjs";import{clearScreen as o}from"./clearScreen.mjs";import n from"./git/index.mjs";import{isUndefined as m}from"a-type-of-js";import{dns as p}from"./dns/index.mjs";import{runOther as s}from"./runOther.mjs";import{colorLine as d}from"a-node-tools";const c=t.args.$arrMap;0===t.args.$only.length&&(r("没有匹配到子命令,打印帮助信息并退出"),t.help(),t.end());try{await async function t(){if(0===c.length)return;const d=c.shift();if(m(d))return await t();"remove"in d?(r("执行文件移除"),await a(d.remove)):"clearScreen"in d||"clear"in d?(r("执行清屏"),await o()):"git"in d?(r("执行 git 相关命令"),await n(d.git)):"package"in d?(r("执行 package 相关命令"),await e(d.package)):"update"in d?(r("执行 update 相关命令"),await i(d.update)):"dns"in d?(r("执行 dns 相关的命令"),await p(d.dns)):"runOtherCode"in d&&(r("执行运行其他命令"),await s(d.runOtherCode));try{await t()}catch(t){r.error("执行 run 报错",t)}}(),d(" 终结分割线 ",!0)}catch(t){r.error("执行 run 报错",t)}
@@ -1 +1 @@
1
- import{pen666 as e,pen399 as t}from"../../pen.mjs";import{_p as n}from"a-node-tools";import{diffVersion as i}from"./diffVersion.mjs";import{redPen as a,pen as o,strInTerminalLength as r,boldPen as s,italicPen as m,hexPen as p,cyanPen as l,magentaPen as d}from"color-pen";import{diffData as g}from"./data-store.mjs";import{isNull as c}from"a-type-of-js";import{installation as h}from"./installation.mjs";import{latestPen as f}from"./latestPen.mjs";import{tagPen as b}from"./tagPen.mjs";import{printInOneLine as u}from"../../printInOneLine.mjs";async function j(){const{local:j,preReleaseDependence:y,latestDependence:$,dependenceList:E,timeoutDependence:M}=g;if(c(j))return;const{dependencies:V,devDependencies:v}=j;if(g.binning(V),g.binning(v,!0),await i(),0===y.length&&0===$.length&&0===M.length)return void n(e`看起来似乎没有依赖版本差异`);if(0===y.length&&0===$.length)return void n(a`看起来网络不太好讷,所有的包线上版本的请求都出错了。或者是还没有执行 npm install 呐`);n(o.brightGreen`\n版本差异的依赖为:\n`);const w=[...$,...y],x=[0,0,0];w.forEach((e=>{const{latestVersion:t,time:n,onlineVersion:i}=E[e];x[0]=Math.max(x[0],r(e)),x[1]=Math.max(x[1],r(n)),x[2]=Math.max(x[2],r(t||i))})),n(w.reduce(((e,t)=>{const{type:n,latestVersion:i,time:a,onlineVersion:o}=E[t],r=t.padEnd(x[0]," "),l=a.padEnd(x[1]," ");return`${e}${"dependencies"===n?s(r):m(r)} \t ${p("#066")(l)} \t ${i||m(o)}\n`}),`${l("包名".padEnd(x[0],""))} \t ${d("发布时间".padEnd(x[1]," "))} \t ${t("最新版本".padEnd(x[2],"+"))}\n`)),n(o.brightRed(`\n目前仅关注版本号是否为最新 ${o.brightMagenta("latest")}`)),n("使用 npm install --save 命令安装更新\n"),M.length>0&&(u(a`有一些包没有返回结果,请注意:`),console.table(M.map((e=>({"包名":e})))));const D=[...$.filter((e=>!1===y.includes(e))).map((e=>o.bold(e).concat("@latest"))),...y.map((e=>b(e,E[e].tag)))],R=$.map((e=>f(e))),G=[...$.map((e=>f(e))),...y.filter((e=>!1===$.includes(e))).map((e=>b(e,E[e].tag)))],L=D.length<y.length+$.length,P=y.length>0,I=$.length>0;P&&(L&&await h({msg:"‼️ 预发布版本优先:",list:D,type:"brightRed"}),await h({msg:"⚠️ latest 版本优先:",list:G,type:"brightMagenta",copy:!I})),I&&await h({msg:"🎉 最佳安装:",list:R,type:"brightGreen",copy:!0})}export{j as dependencies};
1
+ import{pen666 as e}from"../../pen.mjs";import{_p as t}from"a-node-tools";import{diffVersion as n}from"./diffVersion.mjs";import{redPen as i,pen as o,cyanPen as r,boldPen as a,italicPen as m,randomPen as s,greenPen as l}from"color-pen";import{diffData as p}from"./data-store.mjs";import{isNull as g}from"a-type-of-js";import{installation as c}from"./installation.mjs";import{latestPen as d}from"./latestPen.mjs";import{tagPen as f}from"./tagPen.mjs";import{printInOneLine as h}from"../../printInOneLine.mjs";import{Table as b}from"colored-table";async function y(){const{local:y,preReleaseDependence:j,latestDependence:u,dependenceList:w,timeoutDependence:v}=p;if(g(y))return;const{dependencies:D,devDependencies:R}=y;if(p.binning(D),p.binning(R,!0),await n(),0===j.length&&0===u.length&&0===v.length)return void t(e`看起来似乎没有依赖版本差异`);if(0===j.length&&0===u.length)return void t(i`看起来网络不太好讷,所有的包线上版本的请求都出错了。或者是还没有执行 npm install 呐`);t(o.brightGreen`\n版本差异的依赖为:\n`);const V=[...u,...j];new b({header:[r("包名"),{content:"发布时间",color:"#f26"},l`最新版本`],body:[...V.map((e=>{const{type:t,latestVersion:n,time:i,onlineVersion:o}=w[e];return["dependencies"===t?a(e):m(e),s(i),n||m(o)]}))]})(),t(o.brightRed(`\n目前仅关注版本号是否为最新 ${o.brightMagenta("latest")}`)),t("使用 npm install --save 命令安装更新\n"),v.length>0&&(h(i`有一些包没有返回结果,请注意:`),new b([...v.map((e=>[e]))])());const G=[...u.filter((e=>!1===j.includes(e))).map((e=>o.bold(e).concat("@latest"))),...j.map((e=>f(e,w[e].tag)))],L=u.map((e=>d(e))),M=[...u.map((e=>d(e))),...j.filter((e=>!1===u.includes(e))).map((e=>f(e,w[e].tag)))],P=G.length<j.length+u.length,x=j.length>0,I=u.length>0;x&&(P&&await c({msg:"‼️ 预发布版本优先:",list:G,type:"brightRed"}),await c({msg:"⚠️ latest 版本优先:",list:M,type:"brightMagenta",copy:!I})),I&&await c({msg:"🎉 最佳安装:",list:L,type:"brightGreen",copy:!0})}export{y as dependencies};
@@ -1 +1 @@
1
- import{command as e}from"../../command.mjs";import{pen399 as n}from"../../pen.mjs";import{cursorMoveUp as o,cursorLineClear as t,cursorAfterClear as s}from"a-node-tools";import{getInstallVersion as i}from"./getInstallVersion.mjs";import{getLatestVersion as r}from"./getLatestVersion.mjs";import{diffData as m}from"./data-store.mjs";import{printInOneLine as l}from"../../printInOneLine.mjs";import{greenPen as p}from"color-pen";async function a(){const{dependenceList:a,timeoutDependence:c}=m,f=Object.keys(a);let V=!1;for(let $=0,u=f.length;$<u;$++){const u=f[$],d=a[u],j=a[u].version;await r(u);const h=i(u);if(V&&(o(),t(),s(!0)),""===d.onlineVersion&&""===d.latestVersion){c.push(u),e.ERROR(`${u} 本地 ${d.localVersion} 请求错误`),V=!1;continue}if(h===d.onlineVersion){let e=`${u} 的本地${j} 安装版本为 ${h} 最新是 ${d.onlineVersion} `;if(""===d.latestVersion){l(e),V=!0;continue}V=!1,m.preReleaseDependence.push(u),e+=`;最新预发布版本为 ${p(d.latestVersion)}`,l(e);continue}if(V=!1,h===d.latestVersion)continue;let R=`${u} 的本地 ${p(j)} 安装版本为 ${p(h)} 最新是 ${n(d.onlineVersion)} `;m.latestDependence.push(u),""!==d.latestVersion?(m.preReleaseDependence.push(u),R+=`;最新预发布版本为 ${p(d.latestVersion)}`,l(R)):l(R)}!0===V&&(o(),t(),s(!0),V=!1)}export{a as diffVersion};
1
+ import{command as e}from"../../command.mjs";import{pen399 as o}from"../../pen.mjs";import{cursorMoveUp as t,cursorLineClear as n,cursorAfterClear as i}from"a-node-tools";import{getInstallVersion as s}from"./getInstallVersion.mjs";import{getLatestVersion as r}from"./getLatestVersion.mjs";import{diffData as a}from"./data-store.mjs";import{strInOneLineOnTerminal as l,greenPen as m}from"color-pen";import{sleep as p}from"a-js-tools";async function c(){const{dependenceList:c,timeoutDependence:$}=a,f=Object.keys(c);let V=!1;const u=()=>{t(),n(!0),i(!0)};for(let t=0,n=f.length;t<n;t++){const n=f[t],i=c[n],d=c[n].version;V&&u(),e.CURRENT(l(`获取 ${n} 的本地安装信息`)),await p(36),u();const w=s(n);if(e.SUCCESS(l(`${n} 的本地安装版本:${i.localVersion}`)),await p(36),await r(n),u(),""===i.onlineVersion&&""===i.latestVersion){$.push(n),e.ERROR(`${n} 本地 ${i.localVersion} 请求错误`),V=!1;continue}if(w===i.onlineVersion){let o=`${n} 的本地${d} 安装版本为 ${w} 最新是 ${i.onlineVersion} `;if(""===i.latestVersion){e.INFO(l(o)),V=!0,await p(36);continue}V=!1,a.preReleaseDependence.push(n),o+=`;最新预发布版本为 ${m(i.latestVersion)}`,e.INFO(o),await p(36);continue}if(V=!1,w===i.latestVersion){e.INFO(`${n} 的本地版本${d} 安装版本为 ${w}`),await p(36);continue}let j=`${n} 的本地 ${m(d)} 安装版本为 ${m(w)} 最新是 ${o(i.onlineVersion)} `;a.latestDependence.push(n),""!==i.latestVersion?(a.preReleaseDependence.push(n),j+=`;最新预发布版本为 ${m(i.latestVersion)}`,e.INFO(j),await p(36)):(e.INFO(j),await p(36))}!0===V&&(u(),V=!1)}export{c as diffVersion};
@@ -1 +1 @@
1
- import{dog as o}from"../../dog.mjs";import{getVersion as t}from"./getVersion.mjs";import{_p as e}from"a-node-tools";import{isNull as r}from"a-type-of-js";import{dependencies as i}from"./dependencies.mjs";import{diffData as n}from"./data-store.mjs";import{orangePen as m,pen399 as s}from"../../pen.mjs";async function a(){await t();const{local:a,online:p}=n,f=a?.version||"",c=p?.version||"";if(r(a))return o("未找到包 package.json 文件退出"),e(m("未找到当前包 package.json"));const j=m(`当前包本地版本为: ${f}`);if(e(j),r(p))e(s("未获取当前包的线上信息"));else{const o=" ".repeat(6);e(s(`${o}线上版本为:${c}@latest`));const t=new Date(p&&p.time.modified||"").toLocaleString();e(t.toString())}await i()}export{a as diffPackage};
1
+ import{dog as o}from"../../dog.mjs";import{getVersion as t}from"./getVersion.mjs";import{_p as r}from"a-node-tools";import{isNull as e}from"a-type-of-js";import{dependencies as m}from"./dependencies.mjs";import{diffData as s}from"./data-store.mjs";import{orangePen as n,pen399 as i}from"../../pen.mjs";import{command as a}from"../../command.mjs";import{randomPen as p}from"color-pen";async function c(){await t();const{local:c,online:f}=s,j=c?.version||"",d=f?.version||"";if(e(c))return o("未找到包 package.json 文件退出"),r(n("未找到当前包 package.json"));const l=n(`当前包本地版本为: ${j}`);if(f){r(l);const o=" ".repeat(6);r(i(`${o}线上版本为:${d}@latest`));const t=new Date(f&&f.time.modified||"").toLocaleString();a.INFO(`最后的发布时间为: ${t.toString()}`),r([..."-".repeat(process.stdout.columns)].map((o=>p(o))).join("")),r(),r([..."-".repeat(process.stdout.columns)].map((o=>p(o))).join(""))}await m()}export{c as diffPackage};
@@ -1 +1 @@
1
- import{removeData as r}from"./removeData.mjs";import{_p as e,isWindows as o,runOtherCode as s}from"a-node-tools";import{removeResult as c}from"./removeResult.mjs";import{hexPen as t}from"color-pen";async function i(i,a){r.log||e(t("#aaa")(` ${i} 文件/夹存在,准备删除`));let l={error:null};return o?a.isDirectory()?(l=await s({code:`rd /q /s ${i.replace(/\//,"\\")}`,printLog:!1}),c(i,l.success)):a.isFile()&&(l=await s({code:`del ${r.subdirectories?"/s":""} /q ${i.replace(/\//,"\\")}`,printLog:!1}),c(i,l.success)):(l=await s({code:`rm -rf ${i.replace(/\\/,"/")}`,printLog:!1}),c(i,l.success)),!!l.success||(console.log(l.error),!1)}export{i as removeFileOrDirectory};
1
+ import{removeData as r}from"./removeData.mjs";import{_p as e,isWindows as o,runOtherCode as s}from"a-node-tools";import{removeResult as c}from"./removeResult.mjs";import{hexPen as a}from"color-pen";async function t(t,i){r.log||e(a("#aaa")(` ${t} 文件/夹存在,准备删除`));let l={error:null};return o?i.isDirectory()?(l=await s(`rd /q /s ${t.replace(/\//,"\\")}`),c(t,l.success)):i.isFile()&&(l=await s(`del ${r.subdirectories?"/s":""} /q ${t.replace(/\//,"\\")}`),c(t,l.success)):(l=await s(`rm -rf ${t.replace(/\\/,"/")}`),c(t,l.success)),!!l.success||(console.log(l.error),!1)}export{t as removeFileOrDirectory};
@@ -0,0 +1 @@
1
+ import{readFileToJsonSync as o,runOtherCode as t}from"a-node-tools";import{isUndefined as i,isZero as r}from"a-type-of-js";import{command as n}from"./command.mjs";async function s(s){const{value:c}=s;if(i(c)||r(c.length))return;const e=o("package.json")??{scripts:{}},a=e?.scripts??{},p=c[0].toString();let m,S=`npm run ${c.join(" ")}`;if(a[p]){if(m=await t({code:S,printLog:!0,waiting:!0}),m.success)return void n.SUCCESS(`执行 ${S} ✅`);n.ERROR(`执行 ${S} ☹️`),n.error()}S=`npx ${c.join(" ")}`,m=await t({code:S,waiting:!0}),m.success?n.SUCCESS(`执行 ${S} ✅`):(S=c.join(" "),m=await t({code:S,printLog:!0}),m.success?n.SUCCESS(`执行 ${S} ✅`):(n.ERROR(`执行 ${S} ☹️`),n.error()))}export{s as runOther};