gitpick 4.2.1 → 4.3.0-canary.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/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var vt=Object.defineProperty,kt=Object.defineProperties;var Et=Object.getOwnProp
|
|
|
4
4
|
for await (const line of spawn(...)) { ... }`);e.isIterating=!0;try{let{[r]:l}=yield new y(t.nodeChildProcess);if(!l)return;let u="";try{for(var i=S(l.iterator({destroyOnReturn:!1})),a,c,p;a=!(c=yield new y(i.next())).done;a=!1){let w=c.value;let m=`${u}${w}`.split(/\r?\n/);u=m.pop(),yield*q(m)}}catch(c){p=[c]}finally{try{a&&(c=i.return)&&(yield new y(c.call(i)))}finally{if(p)throw p[0]}}u&&(yield u)}finally{yield new y(t)}})},lt=function(...t){return F(this,null,function*(){try{let e=[];for(;t.length>0;){e=t.map((i,a)=>{var c;return(c=e[a])!=null?c:qt(i)});let[{value:r,done:o},n]=yield new y(Promise.race(e.map((i,a)=>Promise.all([i,a])))),[s]=t.splice(n,1);e.splice(n,1),o||(t.push(s),yield r)}}finally{yield new y(Promise.all(t.map(e=>e.return())))}})},qt=async t=>{try{return await t.next()}catch(e){await t.throw(e)}};function b(t,e,r,o){let[n=[],s={}]=Array.isArray(e)?[e,r]:[[],e],i=K([t,...n]),a=Y(s),c=ct(t,n,a,i),p=ot(c,a,i);Object.assign(p,{nodeChildProcess:c}),p=o?pt([o,p]):p;let l=G(p,i,"stdout"),u=G(p,i,"stderr");return Object.assign(p,{nodeChildProcess:c,stdout:l,stderr:u,[Symbol.asyncIterator]:()=>lt(l,u),pipe:(w,m,P)=>b(w,m,P,p)})}var I=async(t,e,r)=>{process.platform==="win32"&&await b("git",["config","--global","core.longpaths","true"]);let o=`https://${t.token?t.token+"@":t.token}github.com/${t.owner}/${t.repository}.git`,n=mt.resolve(zt.tmpdir(),`${t.repository}-${Date.now()}${Math.random().toString(16).slice(2,6)}`);e.watch||console.log(`
|
|
5
5
|
\u{1F50D} Picking ${t.type}${t.type==="repository"?" without .git":" from repository"} ...`);let s=performance.now();try{await b("git",["clone",o,n,"--branch",t.branch,"--depth","1","--single-branch",...e.recursive?["--recursive"]:[]])}catch(c){console.log(`
|
|
6
6
|
\u{1F504} Using robust checkout process ...`),await b("git",["clone",o,n,...e.recursive?["--recursive"]:[]]),await b("git",["checkout",t.branch],{cwd:n})}let i=mt.resolve(n,t.path);(await E.promises.stat(i)).isDirectory()?(await E.promises.mkdir(r,{recursive:!0}),await U(i,r)):(await E.promises.mkdir(r.split("/").slice(0,-1).join("/"),{recursive:!0}),await E.promises.copyFile(i,r)),e.watch?console.log("- Synced at "+new Date().toLocaleTimeString()):console.log(`
|
|
7
|
-
\u2705 Picked ${t.type}${t.type==="repository"?" without .git":" from repository"} in ${((performance.now()-s)/1e3).toFixed(2)} seconds!`),await E.promises.rm(n,{recursive:!0,force:!0})};import Kt from"node:tty";var ht,ut,R,ft,dt,Qt=(dt=(ft=(R=(ut=(ht=Kt)==null?void 0:ht.WriteStream)==null?void 0:ut.prototype)==null?void 0:R.hasColors)==null?void 0:ft.call(R))!=null?dt:!1,h=(t,e)=>{if(!Qt)return n=>n;let r=`\x1B[${t}m`,o=`\x1B[${e}m`;return n=>{let s=n+"",i=s.indexOf(o);if(i===-1)return r+s+o;let a=r,c=0;for(;i!==-1;)a+=s.slice(c,i)+r,c=i+o.length,i=s.indexOf(o,c);return a+=s.slice(c)+o,a}},Ke=h(0,0),f=h(1,22),Qe=h(2,22),Ye=h(3,23),Ze=h(4,24),Xe=h(53,55),tr=h(7,27),er=h(8,28),rr=h(9,29),or=h(30,39),H=h(31,39),A=h(32,39),j=h(33,39),sr=h(34,39),nr=h(35,39),d=h(36,39),ir=h(37,39),ar=h(90,39);function N(t){if(typeof t=="number"||/^\d+$/.test(t))return typeof t=="number"?t:parseInt(t,10);let e=/(\d+)([hms])/g,r=0,o;for(;(o=e.exec(t))!==null;){let n=parseInt(o[1],10);switch(o[2]){case"h":r+=n*36e5;break;case"m":r+=n*6e4;break;case"s":r+=n*1e3;break}}return r}var gt=async t=>{var n,s;let e=(await b("git",["ls-remote",t])).stdout,r=(n=e.match(/(.+)\s+HEAD/))==null?void 0:n[1],o=(s=e.match(new RegExp(`${r}\\s+refs/heads/(.+)`)))==null?void 0:s[1];if(!o)throw new Error("Could not determine default branch!");return o};async function wt(t,{branch:e,target:r}){let o=/^https:\/\/([^@]+)@github\.com/,n=t.match(o),s="";n&&(s=n[1],t=t.replace(o,"https://github.com"));let i=["git@github.com:","https://github.com/","https://raw.githubusercontent.com/"];for(let P of i)if(t.startsWith(P)){t=t.replace(P,"");break}let a=t.split("/"),c=a[0],p=a[1].endsWith(".git")?a[1].slice(0,-4):a[1],l=a[2]==="blob"?"blob":a[2]==="tree"?"tree":a[2]+a[3]==="refsheads"?"raw":"repository",u=e||(l==="repository"?await gt(`https://${s&&s+"@"}github.com/${c}/${p}`):l==="raw"?a[4]:a[3]),w=l?l==="raw"?a.slice(5).join("/"):a.slice(4).join("/"):a.slice(2).join("/")||"/",m=r||(l==="blob"?".":w.split("/").pop()||p);return{token:s,owner:c,repository:p,type:l,branch:u,path:w,target:m}}var bt="gitpick",$t="4.
|
|
7
|
+
\u2705 Picked ${t.type}${t.type==="repository"?" without .git":" from repository"} in ${((performance.now()-s)/1e3).toFixed(2)} seconds!`),await E.promises.rm(n,{recursive:!0,force:!0})};import Kt from"node:tty";var ht,ut,R,ft,dt,Qt=(dt=(ft=(R=(ut=(ht=Kt)==null?void 0:ht.WriteStream)==null?void 0:ut.prototype)==null?void 0:R.hasColors)==null?void 0:ft.call(R))!=null?dt:!1,h=(t,e)=>{if(!Qt)return n=>n;let r=`\x1B[${t}m`,o=`\x1B[${e}m`;return n=>{let s=n+"",i=s.indexOf(o);if(i===-1)return r+s+o;let a=r,c=0;for(;i!==-1;)a+=s.slice(c,i)+r,c=i+o.length,i=s.indexOf(o,c);return a+=s.slice(c)+o,a}},Ke=h(0,0),f=h(1,22),Qe=h(2,22),Ye=h(3,23),Ze=h(4,24),Xe=h(53,55),tr=h(7,27),er=h(8,28),rr=h(9,29),or=h(30,39),H=h(31,39),A=h(32,39),j=h(33,39),sr=h(34,39),nr=h(35,39),d=h(36,39),ir=h(37,39),ar=h(90,39);function N(t){if(typeof t=="number"||/^\d+$/.test(t))return typeof t=="number"?t:parseInt(t,10);let e=/(\d+)([hms])/g,r=0,o;for(;(o=e.exec(t))!==null;){let n=parseInt(o[1],10);switch(o[2]){case"h":r+=n*36e5;break;case"m":r+=n*6e4;break;case"s":r+=n*1e3;break}}return r}var gt=async t=>{var n,s;let e=(await b("git",["ls-remote",t])).stdout,r=(n=e.match(/(.+)\s+HEAD/))==null?void 0:n[1],o=(s=e.match(new RegExp(`${r}\\s+refs/heads/(.+)`)))==null?void 0:s[1];if(!o)throw new Error("Could not determine default branch!");return o};async function wt(t,{branch:e,target:r}){let o=/^https:\/\/([^@]+)@github\.com/,n=t.match(o),s="";n&&(s=n[1],t=t.replace(o,"https://github.com"));let i=["git@github.com:","https://github.com/","https://raw.githubusercontent.com/"];for(let P of i)if(t.startsWith(P)){t=t.replace(P,"");break}let a=t.split("/"),c=a[0],p=a[1].endsWith(".git")?a[1].slice(0,-4):a[1],l=a[2]==="blob"?"blob":a[2]==="tree"?"tree":a[2]+a[3]==="refsheads"?"raw":"repository",u=e||(l==="repository"?await gt(`https://${s&&s+"@"}github.com/${c}/${p}`):l==="raw"?a[4]:a[3]),w=l?l==="raw"?a.slice(5).join("/"):a.slice(4).join("/"):a.slice(2).join("/")||"/",m=r||(l==="blob"?".":w.split("/").pop()||p);return{token:s,owner:c,repository:p,type:l,branch:u,path:w,target:m}}var bt="gitpick",$t="4.3.0-canary.1";var Xt=`
|
|
8
8
|
${f("With GitPick, you can clone precisely what you need.")}
|
|
9
9
|
|
|
10
10
|
${f("gitpick")} ${j("<url>")} ${A("[target]")} ${d("[options]")}
|