jja 2.3.7 → 2.3.9
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 +11 -8
- package/src/dns/checkIp.mjs +1 -1
- package/src/dns/data-store.mjs +1 -1
- package/src/dns/getIdByDnsServer.mjs +1 -1
- package/src/dns/getIp.mjs +1 -1
- package/src/dns/getLocalIp.mjs +1 -1
- package/src/dog.mjs +1 -1
- package/src/git/index.mjs +1 -1
- package/src/main.mjs +1 -1
- package/src/package/diff/data-store.mjs +1 -1
- package/src/package/diff/dependencies.mjs +1 -1
- package/src/package/diff/everyThreePlusBackslash.mjs +1 -1
- package/src/package/diff/getVersion.mjs +1 -1
- package/src/remove/index.mjs +1 -1
- package/src/update/index.mjs +1 -1
package/package.json
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jja",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.9",
|
|
5
5
|
"description": "一些在终端的执行动作 🥜",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"overrides": {
|
|
8
|
+
"@types/jest": "29.5.14"
|
|
9
|
+
},
|
|
7
10
|
"dependencies": {
|
|
8
11
|
"@color-pen/static": "^1.0.0",
|
|
9
|
-
"@qqi/copy-text": "^1.0.
|
|
10
|
-
"@qqi/
|
|
11
|
-
"a-command": "2.3.
|
|
12
|
-
"a-js-tools": "^1.0.
|
|
13
|
-
"a-node-tools": "^4.2.
|
|
14
|
-
"a-type-of-js": "^1.0.
|
|
15
|
-
"color-pen": "^2.0.
|
|
12
|
+
"@qqi/copy-text": "^1.0.3",
|
|
13
|
+
"@qqi/log": "^0.0.0",
|
|
14
|
+
"a-command": "^2.3.9",
|
|
15
|
+
"a-js-tools": "^1.0.1",
|
|
16
|
+
"a-node-tools": "^4.2.9",
|
|
17
|
+
"a-type-of-js": "^1.0.2",
|
|
18
|
+
"color-pen": "^2.0.11",
|
|
16
19
|
"colored-table": "^0.0.2"
|
|
17
20
|
},
|
|
18
21
|
"author": {
|
package/src/dns/checkIp.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dog as o}from"../dog.mjs";import t from"node:net";import{dataStore as e}from"./data-store.mjs";async function r(r,n=3e3){const{ips:s,port:m}=e;if(void 0===s[r])return o(`校验 ${r} 的联通性`),new Promise(
|
|
1
|
+
import{dog as o}from"../dog.mjs";import t from"node:net";import{dataStore as e}from"./data-store.mjs";async function r(r,n=3e3){const{ips:s,port:m}=e;if(void 0===s[r])return o(`校验 ${r} 的联通性`),new Promise(e=>{const s=new t.Socket;s.setTimeout(n),s.on("connect",()=>{s.destroy(),e(!0)}),s.on("timeout",()=>{s.destroy(),e(!1)}),s.on("error",()=>{s.destroy(),e(!1)}),o("测试的接口为:",m),s.connect(m,r)});o(`${r} 联通性已校验过 ${s[r]?"🔥":"⛓️💥"}`)}export{r as checkIp};
|
package/src/dns/data-store.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isUndefined as t}from"a-type-of-js";import{intersection as o}from"a-js-tools";const r=["A","AAAA","ANY","CAA","CNAME","MX","NAPTR","NS","PTR","SOA","SRV","TLSA","TXT"],e={domain:"github.com",port:443,notCovered:!1,dnsServers:["1.1.1.1","8.8.8.8","8.8.4.4","9.9.9.9","208.67.222.222","114.114.115.115","223.5.5.5","180.76.76.76"],ips:{},rrtype:["A"],reset(e){this.ips={},this.domain="github.com",this.port=443,this.notCovered=!1,this.rrtype=[],t(e)||e.forEach(
|
|
1
|
+
import{isUndefined as t}from"a-type-of-js";import{intersection as o}from"a-js-tools";const r=["A","AAAA","ANY","CAA","CNAME","MX","NAPTR","NS","PTR","SOA","SRV","TLSA","TXT"],e={domain:"github.com",port:443,notCovered:!1,dnsServers:["1.1.1.1","8.8.8.8","8.8.4.4","9.9.9.9","208.67.222.222","114.114.115.115","223.5.5.5","180.76.76.76"],ips:{},rrtype:["A"],reset(e){this.ips={},this.domain="github.com",this.port=443,this.notCovered=!1,this.rrtype=[],t(e)||e.forEach(e=>{const s=e["--domain"];!t(s)&&s.length>0&&(this.domain=s[0].toString());const i=e["--port"];!t(i)&&i.length>0&&(this.port=Number(i[0]));const n=e["--not-covered"];t(n)||!1===n[0]||(this.notCovered=!0);const h=e["--rrtype"];if(!t(h)&&h.length>0){const t=o(r,h);t.length>0&&(this.rrtype=t)}})}};export{e as dataStore,r as rrtypeList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dog as r}from"../dog.mjs";import{Resolver as o}from"node:dns";import{checkIp as e}from"./checkIp.mjs";import{isUndefined as t}from"a-type-of-js";import{dataStore as i}from"./data-store.mjs";async function s(s="1.1.1.1"){const n=new o;n.setServers([s]);const{domain:m,ips:a}=i;try{const o=await new Promise(
|
|
1
|
+
import{dog as r}from"../dog.mjs";import{Resolver as o}from"node:dns";import{checkIp as e}from"./checkIp.mjs";import{isUndefined as t}from"a-type-of-js";import{dataStore as i}from"./data-store.mjs";async function s(s="1.1.1.1"){const n=new o;n.setServers([s]);const{domain:m,ips:a}=i;try{const o=await new Promise(o=>{n.resolve4(m,(e,t)=>{if(e)return r.error(`使用 ${s} 获取 ${m} 的 ip 出错`,e),void o(void 0);r(`使用 ${s} 获取 ${m} 的 ip 值为 ${t.join(" --- ")}`),o(t)})});if(t(o))return{dnsServer:s,error:"获取 ip 错误"};const i=await Promise.all(o.map(async r=>{const o=await e(r);return t(o)||(a[r]=o),{ip:r.padEnd(16," "),isAlive:t(o)?a[r]:o}}));return{dnsServer:s,results:i}}catch(o){return r.error("获取 ip 错误",o),{dnsServer:s,error:o}}}export{s as getIdByDnsServer};
|
package/src/dns/getIp.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_p as o,cursorMoveUp as r,cursorAfterClear as t}from"a-node-tools";import{dataStore as e}from"./data-store.mjs";import{isUndefined as s}from"a-type-of-js";import{getIdByDnsServer as m}from"./getIdByDnsServer.mjs";import{pen as n,greenPen as i,redPen as p,strInOneLineOnTerminal as f}from"color-pen";import{dog as a}from"../dog.mjs";import{orangePen as d,pen666 as c}from"../pen.mjs";async function $(){const{domain:$,dnsServers:l,notCovered:v}=e;let j=0;o(`${$} ip 列表:`);for(const e of l){const{dnsServer:$,results:l}=await m(e);s(l)?a.warn(`${$} 获取 ip 失败`):(v||0===j||(r(j),t(!0)),o(),o(n.reversed`DNS: ${$}`),o(),l.forEach((
|
|
1
|
+
import{_p as o,cursorMoveUp as r,cursorAfterClear as t}from"a-node-tools";import{dataStore as e}from"./data-store.mjs";import{isUndefined as s}from"a-type-of-js";import{getIdByDnsServer as m}from"./getIdByDnsServer.mjs";import{pen as n,greenPen as i,redPen as p,strInOneLineOnTerminal as f}from"color-pen";import{dog as a}from"../dog.mjs";import{orangePen as d,pen666 as c}from"../pen.mjs";async function $(){const{domain:$,dnsServers:l,notCovered:v}=e;let j=0;o(`${$} ip 列表:`);for(const e of l){const{dnsServer:$,results:l}=await m(e);s(l)?a.warn(`${$} 获取 ip 失败`):(v||0===j||(r(j),t(!0)),o(),o(n.reversed`DNS: ${$}`),o(),l.forEach(({ip:r,isAlive:t})=>{const e=t?`${i(r)} ${d`->`} ✅`:`${c(r)} ${p`⛓️💥`} ❌`;o(f(e))}),j=3+l.length)}v||(r(j+1),t(!0))}export{$ as getIp};
|
package/src/dns/getLocalIp.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dog as r}from"../dog.mjs";import o from"node:dns";import{dataStore as i}from"./data-store.mjs";import{isUndefined as t}from"a-type-of-js";import{checkIp as m}from"./checkIp.mjs";import{_p as e}from"a-node-tools";import{orangePen as n,pen666 as p}from"../pen.mjs";import{cyanPen as s}from"color-pen";async function a(){const{domain:a,ips:f}=i;try{const i=await new Promise(
|
|
1
|
+
import{dog as r}from"../dog.mjs";import o from"node:dns";import{dataStore as i}from"./data-store.mjs";import{isUndefined as t}from"a-type-of-js";import{checkIp as m}from"./checkIp.mjs";import{_p as e}from"a-node-tools";import{orangePen as n,pen666 as p}from"../pen.mjs";import{cyanPen as s}from"color-pen";async function a(){const{domain:a,ips:f}=i;try{const i=await new Promise(i=>{o.lookup(a,{all:!0,family:4},(o,t)=>{if(o)return r.error(`获取本地 ${a} 的 ip 出错`,o),void i(void 0);r(`获取本地 ${a} 的 ip 值为 ${t.join(" --- ")}`),i(t.map(r=>r.address))})});if(t(i))return{error:"获取 ip 错误"};const c=await Promise.all(i.map(async r=>{const o=await m(r);return t(o)||(f[r]=o),{ip:r.padEnd(16," "),isAlive:t(o)?f[r]:o}}));return c.length>0&&(e(n`本地配置 ${a} 的 ip 地址及联通性为:\n`),c.forEach(r=>{e(s`- ${r.ip}`,!1),e(r.isAlive?n` -> ✅`:p` -> ❌`)}),e()),{results:c}}catch(o){return r.error(o),{error:o}}}export{a as getLocalIp};
|
package/src/dog.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import o
|
|
1
|
+
import{Dog as o}from"@qqi/log";import{isFalse as t}from"a-type-of-js";const e=new o({name:"jja",type:!1});t(e.type);export{e as dog};
|
package/src/git/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dog as o}from"../dog.mjs";import{command as t}from"../command.mjs";import{isPlainObject as m,isUndefined as r}from"a-type-of-js";import{wheel as n}from"./wheel.mjs";async function
|
|
1
|
+
import{dog as o}from"../dog.mjs";import{command as t}from"../command.mjs";import{isPlainObject as m,isUndefined as r}from"a-type-of-js";import{wheel as n}from"./wheel.mjs";async function i(i){if(m(i)&&(i={value:[]}),r(i.options)||0===i.options.length)return o.warn("没有配置项,直接返回的帮助文档"),t.help("git");const e=i.options;for(let t=0,m=e.length;t<m;t++)o("本次执行",e[t]),await n(e[t])}export{i as git};
|
package/src/main.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dog as r}from"./dog.mjs";import{command as a}from"./command.mjs";import{remove as t}from"./remove/index.mjs";import i
|
|
1
|
+
import{dog as r}from"./dog.mjs";import{command as a}from"./command.mjs";import{remove as t}from"./remove/index.mjs";import{update as i}from"./update/index.mjs";import{packageManage as e}from"./package/index.mjs";import{clearScreen as o}from"./clearScreen.mjs";import{git as n}from"./git/index.mjs";import{isUndefined as m}from"a-type-of-js";import{dns as p}from"./dns/index.mjs";import{colorLine as s}from"a-node-tools";const c=a.args.$arrMap;0===a.args.$only.length&&(r("没有匹配到子命令,打印帮助信息并退出"),a.help(),a.end());try{await async function a(){if(0===c.length)return;const s=c.shift();if(m(s))return await a();"remove"in s?(r("执行文件移除"),await t(s.remove)):"clearScreen"in s||"clear"in s?(r("执行清屏"),await o()):"git"in s?(r("执行 git 相关命令"),await n(s.git)):"package"in s?(r("执行 package 相关命令"),await e(s.package)):"update"in s?(r("执行 update 相关命令"),await i(s.update)):"dns"in s?(r("执行 dns 相关的命令"),await p(s.dns)):"runOtherCode"in s&&r("执行运行其他命令");try{await a()}catch(a){r.error("执行 run 报错",a)}}(),s(" 终结分割线 ",!0)}catch(a){r.error("执行 run 报错",a)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isUndefined as e}from"a-type-of-js";const
|
|
1
|
+
import{isUndefined as e,isEmptyObject as n,isNull as i,isString as o}from"a-type-of-js";import{command as t}from"../../command.mjs";const s={local:null,online:null,dependenceList:{},updateDependence:[],latestDependence:[],binning:function(s,c=!1){if(e(s)||n(s)||i(this.local))return;const{overrides:l}=this.local;for(const e in s){if(o(l[e])){t.WARN(`${e} 被锁定在 ${l[e]}`);continue}const n=s[e];this.dependenceList[e]={type:c?"devDependencies":"dependencies",version:n,localVersion:"",latestVersion:"",onlineVersion:"",tag:"",time:""}}},preReleaseDependence:[],timeoutDependence:[],registry:void 0};export{s as diffData};
|
|
@@ -1 +1 @@
|
|
|
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:
|
|
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:D}=p;if(g(y))return;const{dependencies:R,devDependencies:V}=y;if(p.binning(R),p.binning(V,!0),await n(),0===j.length&&0===u.length&&0===D.length)return t(e`看起来似乎没有依赖版本差异`);if(0===j.length&&0===u.length)return 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"),D.length>0&&(h(i`有一些包没有返回结果,请注意:`),new b([...D.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{isArray as o,isString as r}from"a-type-of-js";function n(n){if(!o(n)||n.some(
|
|
1
|
+
import{isArray as o,isString as r}from"a-type-of-js";function n(n){if(!o(n)||n.some(o=>!r(o)))throw new TypeError("参数必须为字符串数组");return n.map((o,r)=>r%3==2&&r!==n.length-1?`${o} \\\n`:o.concat(" ")).join("")}export{n as everyThreePlusBackslash};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dog as o}from"../../dog.mjs";import{getDirectoryBy as a,readFileToJsonSync as r,pathJoin as t,getNpmPkgInfo as n}from"a-node-tools";import{isUndefined as e,isNull as s}from"a-type-of-js";import{diffData as i}from"./data-store.mjs";async function m(){const m=a("package.json","file");if(e(m))return void o.warn("未找到当前包的 package.json 文件的位置");const c=r(t(m,"package.json"));if(s(c))return void o.error("未找到当前包的 package.json
|
|
1
|
+
import{dog as o}from"../../dog.mjs";import{getDirectoryBy as a,readFileToJsonSync as r,pathJoin as t,getNpmPkgInfo as n}from"a-node-tools";import{isUndefined as e,isNull as s}from"a-type-of-js";import{diffData as i}from"./data-store.mjs";async function m(){const m=a("package.json","file");if(e(m))return void o.warn("未找到当前包的 package.json 文件的位置");const c=r(t(m,"package.json"));if(s(c))return void o.error("未找到当前包的 package.json 文件,该事件发生的概率极低");const p=c.name||"",f=await n(p,i.registry);i.local=c,i.online=f.data}export{m as getVersion};
|
package/src/remove/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dog as o}from"../dog.mjs";import{pen as r}from"color-pen";import{_p as t,isWindows as n}from"a-node-tools";import{removeData as e}from"./removeData.mjs";import{beforeRemove as i}from"./beforeRemove.mjs";async function m(m){const a=m.value||[],c=m.options;for(c?.forEach(
|
|
1
|
+
import{dog as o}from"../dog.mjs";import{pen as r}from"color-pen";import{_p as t,isWindows as n}from"a-node-tools";import{removeData as e}from"./removeData.mjs";import{beforeRemove as i}from"./beforeRemove.mjs";async function m(m){const a=m.value||[],c=m.options;for(c?.forEach(o=>{const r=o["--ignore"];r&&(e.log=!0,a.concat(r));const t=o["--subdirectories"];t&&(e.subdirectories=!0,a.concat(t))}),e.log||t(r.brightCyan`当前系统为: ${n?"windows":"linux/mac"}`),0==a.length&&(o.warn("待删除列表",a),t(r.random`没有待清理的文件/文件夹`));a.length;){let o=a.pop();o=void 0===o?"undefined":o.toString(),await i(o)}}export{m as remove};
|
package/src/update/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dog as o}from"../dog.mjs";import{command as t}from"../command.mjs";import{isUndefined as m}from"a-type-of-js";import{wheel as r}from"./wheel.mjs";import{data as
|
|
1
|
+
import{dog as o}from"../dog.mjs";import{command as t}from"../command.mjs";import{isUndefined as m}from"a-type-of-js";import{wheel as r}from"./wheel.mjs";import{data as n}from"./data.mjs";async function e(e){if(m(e.options)||0==e.options.length)return o.warn("没有匹配到选项,自动抛出帮助文档"),t.help("update");const i=e.options;n.log=!i.some(o=>o["--ignore"]);for(let o=0,t=i.length;o<t;o++)await r(i[o])}export{e as update};
|