@jerryc05/hi-tools 0.0.16 → 0.0.18

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ ${p}`),console.dir(a),c<s.length-1&&console.log(`
11
11
  -----------------
12
12
 
13
13
  `)}catch(p){console.error("Failed to generate QR:",p)}}}async function re(e,t,n){let{response:i,getJson:o}=await S({pipelineId:e,pageSize:1,withoutJob:!1},t,n);i.ok||(f(`[getRunInfoByPipelineID] failed: ${i.status} ${i.statusText}
14
- ${await i.text()}`),process.exit(1));let r=await o();r.pipelineRuns[0]?.runStatus!==I.SUCCESS&&g(`Latest run runId=${r.pipelineRuns[0]?.runId} is not completed or is not successful. Gecko info may be unavailable. (status=${M(r.pipelineRuns[0]?.runStatus)}`);let s=B(r.pipelineRuns);if(s.length)return s;let m=await ae(e,t,n);return await ce(m,t,n)}function se(e){let t=/\bpipelineId=(\d+)\b/,n=e.match(t);if(n?.[1])return n[1];throw new Error(`Invalid URL. Expecting a url containing ${b.bold(b.yellow("pipelineId"))} query param. E.g. `+b.underline(b.gray(`https://b??.net/devops/??/develop/detail/??/flow?devops_space_type=server_fe&${b.bold(b.magenta("pipelineId=1139212901634"))}&stage=dev_gatekeeper_stage`)))}function B(e){return e.flatMap(t=>t.jobs.map(n=>{try{let i=n.jobAtom.output;if(!i)return null;let o=i.GECKO_packageInfo;if(!o)return null;let r=JSON.parse(o),{qrCodeScheme:s,candidatePackage:m,channel:c,updatedAt:a,creator:p,distributeRule:h}=r.package,{scmVersion:y}=m,$=w(Number.parseInt(a,10)*1e3),C=h.envLaneList.flatMap(V=>V.values);return{qrCodeScheme:s,region:i.GECKO_region,scmVersion:y,channel:c,updatedDate:$,creator:p,envs:C,runId:t.runId,runSeq:t.runSeq,pipelineRunUrl:t.pipelineRunUrl}}catch(i){return console.error(i),null}}).filter(n=>n!=null)).filter(t=>!!t)}async function ae(e,t,n){let{response:o,getJson:r}=await S({pipelineId:e,pageSize:10,withoutJob:!0},t,n);o.ok||(f(`[getRunInfoByPipelineID] failed: ${o.status} ${o.statusText}
14
+ ${await i.text()}`),process.exit(1));let r=await o();r.pipelineRuns[0]?.runStatus!==I.SUCCESS&&g(`Latest run (runId=${r.pipelineRuns[0]?.runId} ${M(r.pipelineRuns[0]?.runStatus)}) is still running or not successful. Gecko info may be unavailable.`);let s=B(r.pipelineRuns);if(s.length)return s;let m=await ae(e,t,n);return await ce(m,t,n)}function se(e){let t=/\bpipelineId=(\d+)\b/,n=e.match(t);if(n?.[1])return n[1];throw new Error(`Invalid URL. Expecting a url containing ${b.bold(b.yellow("pipelineId"))} query param. E.g. `+b.underline(b.gray(`https://b??.net/devops/??/develop/detail/??/flow?devops_space_type=server_fe&${b.bold(b.magenta("pipelineId=1139212901634"))}&stage=dev_gatekeeper_stage`)))}function B(e){return e.flatMap(t=>t.jobs.map(n=>{try{let i=n.jobAtom.output;if(!i)return null;let o=i.GECKO_packageInfo;if(!o)return null;let r=JSON.parse(o),{qrCodeScheme:s,candidatePackage:m,channel:c,updatedAt:a,creator:p,distributeRule:h}=r.package,{scmVersion:y}=m,$=w(Number.parseInt(a,10)*1e3),C=h.envLaneList.flatMap(V=>V.values);return{qrCodeScheme:s,region:i.GECKO_region,scmVersion:y,channel:c,updatedDate:$,creator:p,envs:C,runId:t.runId,runSeq:t.runSeq,pipelineRunUrl:t.pipelineRunUrl}}catch(i){return console.error(i),null}}).filter(n=>n!=null)).filter(t=>!!t)}async function ae(e,t,n){let{response:o,getJson:r}=await S({pipelineId:e,pageSize:10,withoutJob:!0},t,n);o.ok||(f(`[getRunInfoByPipelineID] failed: ${o.status} ${o.statusText}
15
15
  ${await o.text()}`),process.exit(1));let s=await r();s.pipelineRuns.length<=0&&(f(`No pipeline runs found in the most recent 10 runs
16
16
  ${JSON.stringify(s,null,1)}`),process.exit(1)),ne("The latest pipeline run may still be running/failed. Please select a historical run to inspect.","Historical run selection required");let m=s.pipelineRuns.map(a=>{let p=M(a.runStatus),h=me(a),y=a.triggerInfo?.triggeredBy||a.createdBy||"?";return{value:a.runId,label:`#${a.runSeq} runId=${a.runId} ${p}`,hint:`${h} by ${y}`}}),c=await oe({message:"Select the run ID to inspect",options:m});return te(c)&&(ee("Run selection cancelled"),process.exit(0)),c}async function ce(e,t,n){let{response:i,getJson:o}=await G(e,t,n);i.ok||(f(`[getRunDetailByRunID] failed: ${i.status} ${i.statusText}
17
17
  ${await i.text()}`),process.exit(1));let r=await o();return B([r.pipelineRun])}function M(e){switch(e){case I.RUNNING:return b.blue("RUNNING");case I.CANCELLED:return b.gray("CANCELLED");case I.SUCCESS:return b.green("SUCCESS")}return`status=${e}`}function me(e){return e.completedAt?`completed @ ${w(e.completedAt)}`:e.startedAt?`started @ ${w(e.startedAt)}`:e.createdAt?`created @ ${w(e.createdAt)}`:"time=?"}var q=[{cmd:{name:"tt-gecko",desc:"Show gecko info by bits URL"},options:[{name:"-p,--pipelineId <pipelineId>",desc:"Pipeline ID (Overrides URL)"},{name:"-u,--url <url>",desc:"Bits URL"},{name:"-r,--region <region>",desc:"Region kw filter"}],examples:[`${d.name} tt-gecko -r us -u 'https://b??.net/devops/??/develop/detail/??/flow?devops_space_type=server_fe&pipelineId=1139212901634&stage=dev_gatekeeper_stage'`],action:ie}];import{access as le,constants as pe}from"node:fs/promises";var K=[{cmd:{name:"tt-i18n",desc:"I18n scan and sort"},action:async()=>{let e="starling.config.js",t="combine-lang.js";for(let o of[e,t])try{await le(o,pe.R_OK)}catch(r){console.error(`tt i18n: Failed to read ${o}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@jerryc05/hi-tools",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "scripts": {
5
- "pub": "npm version patch --no-git-tag-version && npm publish --access public",
5
+ "pub": "npm version patch && npm publish --access public && git push",
6
6
  "build": "node build.js",
7
7
  "prepare": "husky"
8
8
  },