jja 2.3.5 → 2.3.7

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 CHANGED
@@ -1,4 +1,4 @@
1
- # jja
1
+ # jolly job aid (开心工作助手)
2
2
 
3
3
  [![version](<https://img.shields.io/npm/v/jja.svg?logo=npm&logoColor=rgb(0,0,0)&label=版本号&labelColor=rgb(73,73,228)&color=rgb(0,0,0)>)](https://www.npmjs.com/package/jja) [![issues 提交](<https://img.shields.io/badge/issues-提交-rgb(255,0,63)?logo=github>)](https://github.com/earthnutDev/jja/issues)
4
4
 
@@ -38,6 +38,13 @@ npx jja rm -i filename
38
38
  npx jja package --diff
39
39
  # 或者使用缩写
40
40
  npx jjs pkg -d
41
+ # 指定源
42
+ npx jjs pkg -d=淘宝
43
+ npx jjs pkg -d=腾讯
44
+ npx jjs pkg -d=中科大
45
+ npx jjs pkg -d=yarn
46
+ # 默认源 (指定值不存在则默认使用 `官方`)
47
+ npx jjs pkg -d=官方
41
48
  ```
42
49
 
43
50
  ### `update`
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "jja",
3
3
  "type": "module",
4
- "version": "2.3.5",
4
+ "version": "2.3.7",
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.2",
10
+ "@qqi/dev-log": "^1.0.3",
11
+ "a-command": "2.3.4",
12
12
  "a-js-tools": "^1.0.0",
13
- "a-node-tools": "^4.2.1",
13
+ "a-node-tools": "^4.2.5",
14
14
  "a-type-of-js": "^1.0.1",
15
15
  "color-pen": "^2.0.10",
16
16
  "colored-table": "^0.0.2"
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 a}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 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{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 n={local:null,online:null,dependenceList:{},updateDependence:[],latestDependence:[],binning:function(n,t=!1){if(!e(n))for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const o=n[e];this.dependenceList[e]={type:t?"devDependencies":"dependencies",version:o,localVersion:"",latestVersion:"",onlineVersion:"",tag:"",time:""}}},preReleaseDependence:[],timeoutDependence:[]};export{n as diffData};
1
+ import{isUndefined as e}from"a-type-of-js";const n={local:null,online:null,dependenceList:{},updateDependence:[],latestDependence:[],binning:function(n,t=!1){if(!e(n))for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const i=n[e];this.dependenceList[e]={type:t?"devDependencies":"dependencies",version:i,localVersion:"",latestVersion:"",onlineVersion:"",tag:"",time:""}}},preReleaseDependence:[],timeoutDependence:[],registry:void 0};export{n as diffData};
@@ -1 +1 @@
1
- import{dog as t}from"../../dog.mjs";import{getNpmPkgInfo as o}from"a-node-tools";import{isNull as e}from"a-type-of-js";import{diffData as a}from"./data-store.mjs";async function n(n){const s=await o(n,"官方",4567);if("timeout"===s.status)return void t.warn("请求超时");if(e(s.data))return void t.warn("获取包信息失败");const r=a.dependenceList[n],{"dist-tags":i,time:m,version:c}=s.data;let d=c,f="latest";r.onlineVersion=d,r.tag=f;const l=Object.keys(i);for(let t=0,o=l.length;t<o;t++){const o=l[t],e=i[o];m[e]>m[d]&&(d=e,f=o)}"latest"!==f&&(t(n,"最新版本为:",d,"tag为:",f),r.tag=f,r.latestVersion=d);const g=new Date(m[d]).toLocaleString();r.time=g,t(`${n} 的最后发布时间为:${g}`)}export{n as getLatestVersion};
1
+ import{dog as t}from"../../dog.mjs";import{getNpmPkgInfo as o}from"a-node-tools";import{isNull as e}from"a-type-of-js";import{diffData as s}from"./data-store.mjs";async function a(a){const n=await o(a,s.registry,4567);if("timeout"===n.status)return void t.warn("请求超时");if(e(n.data))return void t.warn("获取包信息失败");const r=s.dependenceList[a],{"dist-tags":i,time:m,version:c}=n.data;let d=c,f="latest";r.onlineVersion=d,r.tag=f;const l=Object.keys(i);for(let t=0,o=l.length;t<o;t++){const o=l[t],e=i[o];m[e]>m[d]&&(d=e,f=o)}"latest"!==f&&(t(a,"最新版本为:",d,"tag为:",f),r.tag=f,r.latestVersion=d);const g=new Date(m[d]).toLocaleString();r.time=g,t(`${a} 的最后发布时间为:${g}`)}export{a as getLatestVersion};
@@ -1 +1 @@
1
- import{dog as o}from"../../dog.mjs";import{getDirectoryBy as a,readFileToJsonSync as r,pathJoin as n,getNpmPkgInfo as t}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(n(m,"package.json"));if(s(c))return void o.error("未找到当前包的 package.json 文件,改事件发生的概率极低");const p=c.name||"",f=await t(p,"淘宝");i.local=c,i.online=f.data}export{m as getVersion};
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};
@@ -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 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(r(c))return o("未找到包 package.json 文件退出"),e(n("未找到当前包 package.json"));const l=n(`当前包本地版本为: ${j}`);if(e(l),r(f))e(i("未获取当前包的线上信息"));else{const o=" ".repeat(6);e(i(`${o}线上版本为:${d}@latest`));const t=new Date(f&&f.time.modified||"").toLocaleString();a.INFO(`最后的发布时间为: ${t.toString()}`),e([..."-".repeat(process.stdout.columns)].map((o=>p(o))).join("")),e(),e([..."-".repeat(process.stdout.columns)].map((o=>p(o))).join(""))}await m()}export{c as diffPackage};
1
+ import{dog as o}from"../../dog.mjs";import{getVersion as t}from"./getVersion.mjs";import{_p as r,colorLine as e}from"a-node-tools";import{isNull as m}from"a-type-of-js";import{dependencies as i}from"./dependencies.mjs";import{diffData as n}from"./data-store.mjs";import{orangePen as s,pen399 as a}from"../../pen.mjs";import{command as p}from"../../command.mjs";async function f(f){n.registry=f[0]?.toString(),await t();const{local:c,online:j}=n,d=c?.version||"",g=j?.version||"";if(m(c))return o("未找到包 package.json 文件退出"),r(s("未找到当前包 package.json"));const l=s(`当前包本地版本为: ${d}`);if(j){r(l);const o=" ".repeat(6);r(a(`${o}线上版本为:${g}@latest`));const t=new Date(j&&j.time.modified||"").toLocaleString();p.INFO(`最后的发布时间为: ${t.toString()}`),e(),e()}await i()}export{f as diffPackage};
@@ -1 +1 @@
1
- import{command as e}from"../command.mjs";import{diffPackage as m}from"./diff/index.mjs";import{updateDependence as i}from"./updateDependence.mjs";async function p(p){p["--upDependencies"]?await i(!0):p["--diff"]?await m():e.help("package")}export{p as wheel};
1
+ import{command as e}from"../command.mjs";import{diffPackage as i}from"./diff/index.mjs";import{updateDependence as m}from"./updateDependence.mjs";async function f(f){f["--upDependencies"]?await m(!0):f["--diff"]?await i(f["--diff"]):e.help("package")}export{f as wheel};
@@ -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};