@jerryc05/hi-tools 0.2.0 → 0.2.1
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/bin/cli.mjs +0 -0
- package/dist/index.js +2 -1
- package/package.json +5 -2
package/bin/cli.mjs
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
@@ -17,4 +17,5 @@ Go to https://luban.bytedance.net/npm/publish and get your personal SCM username
|
|
|
17
17
|
desc=${u.desc}`);let f=await fetch("https://scm.byted.org/api/v2/npm_versions/",{method:"POST",headers:{Authorization:`Basic ${Buffer.from(`${s}:${i}`).toString("base64")}`,Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(u)});if(!f.ok){let v=await f.text();$.error(`HTTP ${f.status} Error: ${v}`),process.exit(1)}let R=await f.json();$.success("\u{1F389} Successfully published:",R)}catch(p){$.error("Execution Failed:"),console.error(p),process.exit(1)}}var he={"by-hash":{alias:"h",desc:"Publish pkg by hash (default)",string:!0,conflicts:["by-branch"]},"by-branch":{alias:"b",desc:"Publish pkg by branch",string:!0,conflicts:["by-hash"]}},W=[{command:"luban <repoId>",describe:"Publish current repo pkg to Luban",builder:he,handler(e){let{byHash:n,byBranch:t}=e,o=Number(e.repoId);ye({repoId:o,hash:n,branch:t})}}];var z=[{command:"tt",describe:"TT/BD internal toolset",builder:e=>e.command([...A,...H,...K,...W]).demandCommand(1),handler(){}}];import{lstatSync as we}from"node:fs";import{log as V,note as Ie,spinner as h}from"@clack/prompts";var $e=e=>new Promise(n=>setTimeout(n,e));async function Re(e){let n=d.version,t=`${d.name}@${n}`,o=1e4,r=[...e.installCmdPrefix.split(" "),t];Ie(`\u{1F680} Monitoring ${t}...
|
|
18
18
|
\u{1F4C2} Target: ${e.target}
|
|
19
19
|
\u{1F6E0} Install cmd: ${r.join(" ")}`);let{execa:s}=await import("execa");try{let i=h();i.start("Pulling latest changes in target repo..."),await s({cwd:e.target,stdio:"inherit",env:{GIT_TRACE:"1"}})`git pull`,i.stop("Latest commit pulled"),i=h();let c=Date.now();for(let p=1;;p++){i.start(`Waiting for ${t}, attempt ${p}`);let{exitCode:a}=await s({reject:!1,stdio:"inherit"})`npm view ${t} version`;if(a===0){i.stop(`${t} is live! Found it \u2705`);try{i=h(),i.start(`Installing ${t} via ${r}`),await s({cwd:e.target,stdio:"inherit"})`${r}`,i.stop(`${t} installed! \u2705`);break}catch{i.stop(`${t} not installed`),V.error("Registry updated but failed to install")}}(Date.now()-c)/1e3>=e.timeout&&(i.stop(`Didn't find ${t} in ${e.timeout} sec(s)`),process.exit(1)),await $e(o)}i=h(),i.start("Committing changes..."),await s({stdio:"inherit"})`git commit -am 'chore: upd ${t}`,i.stop("Committed \u2705"),i=h(),i.start("Pushing to remote..."),await s({stdio:"inherit"})`git push`,i.stop("Pushed \u2705"),V.success("\u{1F389} DONE!")}catch(i){console.error(`
|
|
20
|
-
\u274C Task failed:`,i),process.exit(1)}}var Q={target:{alias:"t",desc:"Target repository path",demandOption:!0,normalize:!0},"install-cmd-prefix":{alias:"cmd",desc:"Pkg install command prefix",default:"pnpm add"},timeout:{desc:"Timeout checking new pkg version in sec",default:300}},X=[{command:"wup",describe:"[W]ait for pkg publish, [U]pdate target repo, and [P]ush",builder:e=>e.options(Q).example('$0 wup -t "/tmp/..." -c "emo add"',"Install w/ eden-mono").example('$0 wup -t "/tmp/..." -c "rush add --make-consistent -p"',"Install w/ @microsoft/rush"),handler(e){let{target:n,installCmdPrefix:t=Q["install-cmd-prefix"].default,verbose:o}=e,r=Number(e.timeout),s=`Path ${n} is not a directory.`;try{if(!n||!we(n).isDirectory())throw new Error(s);Re({target:n,installCmdPrefix:t,timeout:r,verbose:o})}catch(i){throw new Error(s,{cause:i})}}}];var d=JSON.parse(await ve(Ce(import.meta.dirname,"../package.json"),"utf8"));ke(`\u{1F44B} ${d.name} v${d.version}`);var _e=[...P,...T,...X,...k,...x,...z];xe().scriptName("hi").version(d.version).option("verbose",{type:"boolean",description:"Run with verbose logging",global:!0}).command(_e).help().parse(Se(process.argv));export{d as PKG};
|
|
20
|
+
\u274C Task failed:`,i),process.exit(1)}}var Q={target:{alias:"t",desc:"Target repository path",demandOption:!0,normalize:!0},"install-cmd-prefix":{alias:"cmd",desc:"Pkg install command prefix",default:"pnpm add"},timeout:{desc:"Timeout checking new pkg version in sec",default:300}},X=[{command:"wup",describe:"[W]ait for pkg publish, [U]pdate target repo, and [P]ush",builder:e=>e.options(Q).example('$0 wup -t "/tmp/..." -c "emo add"',"Install w/ eden-mono").example('$0 wup -t "/tmp/..." -c "rush add --make-consistent -p"',"Install w/ @microsoft/rush"),handler(e){let{target:n,installCmdPrefix:t=Q["install-cmd-prefix"].default,verbose:o}=e,r=Number(e.timeout),s=`Path ${n} is not a directory.`;try{if(!n||!we(n).isDirectory())throw new Error(s);Re({target:n,installCmdPrefix:t,timeout:r,verbose:o})}catch(i){throw new Error(s,{cause:i})}}}];var d=JSON.parse(await ve(Ce(import.meta.dirname,"../package.json"),"utf8"));ke(`\u{1F44B} ${d.name} v${d.version}`);var _e=[...P,...T,...X,...k,...x,...z];xe().scriptName("hi").version(d.version).option("verbose",{type:"boolean",description:"Run with verbose logging",global:!0}).strict().command(_e).help().parse(Se(process.argv));export{d as PKG};
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jerryc05/hi-tools",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "A collection of my everyday SDE tools.",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"pub": "npm run build && npm version patch && export NPM_CONFIG_REGISTRY=https://registry.npmjs.org &&{ npm whoami || npm login;
|
|
6
|
+
"pub": "npm run build && npm version patch && export NPM_CONFIG_REGISTRY=https://registry.npmjs.org &&{ npm whoami || npm login ;} && npm publish --access public && git push",
|
|
7
7
|
"build": "node build.js"
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
@@ -26,11 +26,14 @@
|
|
|
26
26
|
"optionalDependencies": {
|
|
27
27
|
"@byted/aipaas-auth": "^0.1.0",
|
|
28
28
|
"@clack/prompts": "^1.3.0",
|
|
29
|
+
"bignumber.js": "^9.3.1",
|
|
29
30
|
"execa": "^9.6.1",
|
|
31
|
+
"json-bigint": "^1.0.0",
|
|
30
32
|
"qrcode": "^1.5.4"
|
|
31
33
|
},
|
|
32
34
|
"devDependencies": {
|
|
33
35
|
"@types/cli-progress": "^3.11.6",
|
|
36
|
+
"@types/json-bigint": "^1.0.4",
|
|
34
37
|
"@types/node": "^25.6.0",
|
|
35
38
|
"@types/qrcode": "^1.5.6",
|
|
36
39
|
"@types/yargs": "^17.0.35",
|