jja 1.0.1 → 1.0.3

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.
@@ -1 +1 @@
1
- import{isWindows as e}from"a-node-tools";import{execSync as r}from"node:child_process";const c={"clearScreen <cls> (清理终端显示屏幕,同 clearTerminal )":"","clearTerminal <clear> (清理终端显示屏幕,同 clearScreen )":""};async function o(){r(e?"cls":"clear",{stdio:[0,1,2]})}export{o as clearScreen,c as clearScreenBind};
1
+ import{isTTY as e,isWindows as r,_p as c}from"a-node-tools";import{execSync as o}from"node:child_process";const l={"clearScreen <cls> (清理终端显示屏幕,同 clearTerminal )":"","clearTerminal <clear> (清理终端显示屏幕,同 clearScreen )":""};async function a(){e()?o(r?"cls":"clear",{stdio:[0,1,2]}):c("当前环境不支持 ")}export{a as clearScreen,l as clearScreenBind};
@@ -1 +1 @@
1
- import{runOtherCode as t,_p as n,getDirectoryBy as e}from"a-node-tools";import{question as i,selection as a}from"a-command";import o from"./command.mjs";import{gitCommit as r}from"./git.mjs";import{updateDependence as p,diffPackage as m}from"./package.mjs";import c from"color-pen";const s=c.green,l={"update <up> (做一个简单的 npm 升级程序,对,简单的)":["--ignore <-i> (不建议你这么用,你会发现你像个傻子一样在那等结果)",`--dependencies <-d> (更新依赖,跟 ${c.random("npm update")} 一样)`,"--npm-publish <-n> (用于 npm 包的升级(自带 git 清理,不三克))"]},u={npmUpdate:!1,log:!0,gitCommit:!1};async function $(l){if(0==Object.keys(l).length)return o.help("update");const $=l["--npm-publish"],f=Boolean(l["--dependencies"]);if(u.log=!l["--ignore"],$)return u.npmUpdate=!0,await async function(){g(c.hex("#9ff")("开始初始化")),"更新"==await i({text:"更新依赖",tip:["跳过","更新"],private:!0})&&await p(u.log),g(c.hex("#666")("请等待更新包(你的 package.json 的 scripts 最好有 build 命令)"));const l=await t("npm run build");l.success||(console.log(l.error),o.end);g(s("打包完成")),await async function(){if(null==e("package.json","file"))return n("当前工作目录下或父级存在 package.json");const i=await m();if(i.length<2)return 1==i.length;if(i[0]!=i[1])return n(`当前版本为:${c.cyan(i[0])}\n线上版本为: ${c.brightRed(i[1])}\n请保持一致`);g("请选择本次更新版本的类型");const o=i[0];let r,p=0,l=0,u=0;i[0].includes("-")?[p,r]=o.split("-"):p=o;[p,l,u]=p.split("."),p=Number(p),l=Number(l),u=Number(u);const $=await a([`bug (patch) v${o} -> ${p}.${l}.${null==r?u+1:u}`,`新内容 (minor) v${o} -> ${p}.${l+1}.0`,`大换代 (major) v${o} -> ${p+1}.0.0`,`测试版本 (prepatch) v${o} -> ${p}.${l}.${u+1}-0`,`内测版本 (preminor) v${o} -> ${p}.${l+1}.0-0`,`公测版本 (premajor) v${o} -> ${p+1}.0.0-0`,`测试迭代 (prerelease) v${o} -> ${p}.${l}.${null==r?u+1:u}-${null==r?0:Number(r)+1}`]);return g(s("请等待整理版本内容")),await t(`npm version ${$.replace(/.*\((.*)\).*/,"$1")} --no-git-tag-version --force`),!0}()||o.end;if(g(s("版本整理完毕,准备上到 npm")),"提交"==await i({text:"是否需要提交代码?",tip:["跳过","提交"]})){const t=await i({text:"提交说明",private:!0});await async function(t){g(c.cyan("正在整理 git 内容")),await r(t,!0)?(u.gitCommit=!0,g(s("git 内容整理完毕"))):g("git 工作区很干净")}(t)}await t("npm publish"),g(s("上推 npm 包完毕"))}();f&&await p(u.log)}function g(t){return u.log&&n(t),!0}export{$ as default,l as updateBind};
1
+ import{runOtherCode as t,_p as n,getDirectoryBy as e}from"a-node-tools";import{question as i,selection as a}from"a-command";import o from"./command.mjs";import{gitCommit as r}from"./git.mjs";import{updateDependence as p,diffPackage as m}from"./package.mjs";import c from"color-pen";const s=c.green,l={"update <up> (做一个简单的 npm 升级程序,对,简单的)":["--ignore <-i> (不建议你这么用,你会发现你像个傻子一样在那等结果)",`--dependencies <-d> (更新依赖,跟 ${c.random("npm update")} 一样)`,"--npm-publish <-n> (用于 npm 包的升级(自带 git 清理,不三克))"]},u={npmUpdate:!1,log:!0,gitCommit:!1};async function $(l){if(0==Object.keys(l).length)return o.help("update");const $=l["--npm-publish"],f=Boolean(l["--dependencies"]);if(u.log=!l["--ignore"],$)return u.npmUpdate=!0,await async function(){g(c.hex("#9ff")("开始初始化")),"更新"==await i({text:"更新依赖",tip:["跳过","更新"],private:!0})&&await p(u.log),g(c.hex("#666")("请等待更新包(你的 package.json 的 scripts 最好有 build 命令)"));const l=await t("npm run build");l.success||(console.log(l.error),o.end);g(s("打包完成")),await async function(){if(null==e("package.json","file"))return n("当前工作目录下或父级不存在 package.json");const i=await m();if(i.length<2)return 1==i.length;if(i[0]!=i[1])return n(`当前版本为:${c.cyan(i[0])}\n线上版本为: ${c.brightRed(i[1])}\n请保持一致`);g("请选择本次更新版本的类型");const o=i[0];let r,p=0,l=0,u=0;i[0].includes("-")?[p,r]=o.split("-"):p=o;[p,l,u]=p.split("."),p=Number(p),l=Number(l),u=Number(u);const $=await a([`bug (patch) v${o} -> ${p}.${l}.${null==r?u+1:u}`,`新内容 (minor) v${o} -> ${p}.${l+1}.0`,`大换代 (major) v${o} -> ${p+1}.0.0`,`测试版本 (prepatch) v${o} -> ${p}.${l}.${u+1}-0`,`内测版本 (preminor) v${o} -> ${p}.${l+1}.0-0`,`公测版本 (premajor) v${o} -> ${p+1}.0.0-0`,`测试迭代 (prerelease) v${o} -> ${p}.${l}.${null==r?u+1:u}-${null==r?0:Number(r)+1}`]);return g(s("请等待整理版本内容")),await t(`npm version ${$.replace(/.*\((.*)\).*/,"$1")} --no-git-tag-version --force`),!0}()||o.error;if(g(s("版本整理完毕,准备上到 npm")),"提交"==await i({text:"是否需要提交代码?",tip:["跳过","提交"]})){const t=await i({text:"提交说明",private:!0});await async function(t){g(c.cyan("正在整理 git 内容")),await r(t,!0)?(u.gitCommit=!0,g(s("git 内容整理完毕"))):g("git 工作区很干净")}(t)}await t("npm publish"),g(s("上推 npm 包完毕"))}();f&&await p(u.log)}function g(t){return u.log&&n(t),!0}export{$ as default,l as updateBind};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jja",
3
3
  "type": "module",
4
- "version": "1.0.1",
4
+ "version": "1.0.3",
5
5
  "author": {
6
6
  "name": "earthnut",
7
7
  "email": "earthnut.dev@outlook.com",
@@ -31,7 +31,7 @@
31
31
  "registry": "https://registry.npmjs.org/"
32
32
  },
33
33
  "dependencies": {
34
- "a-command": ">=0.1.0 <1.0.0",
34
+ "a-command": ">=0.1.1 <1.0.0",
35
35
  "a-js-tools": ">=0.1.3 <1.0.0",
36
36
  "a-node-tools": ">=0.1.2 <1.0.0",
37
37
  "a-type-of-js": ">=0.1.6",