gitpick 4.14.0-canary.0 → 4.14.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.mjs +2 -2
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import e from"node:fs";import t from"node:path";import{parseArgs as n,stripVTControlCharacters as r}from"node:util";import i from"node:os";import a from"node:process";import{fileURLToPath as o}from"node:url";import{spawn as s}from"node:child_process";import{on as c,once as l}from"node:events";import{stat as u}from"node:fs/promises";import{pipeline as d}from"node:stream/promises";import f from"node:tty";import p from"process";var m=Object.defineProperty,h=(e,t)=>{let n={};for(var r in e)m(n,r,{get:e[r],enumerable:!0});return t||m(n,Symbol.toStringTag,{value:`Module`}),n};const g=async(n,r)=>{let i=await e.promises.readdir(n,{withFileTypes:!0});await e.promises.mkdir(r,{recursive:!0});for(let a of i){if(a.name===`.git`)continue;let i=t.join(n,a.name),o=t.join(r,a.name);a.isDirectory()
|
|
2
|
+
import e from"node:fs";import t from"node:path";import{parseArgs as n,stripVTControlCharacters as r}from"node:util";import i from"node:os";import a from"node:process";import{fileURLToPath as o}from"node:url";import{spawn as s}from"node:child_process";import{on as c,once as l}from"node:events";import{stat as u}from"node:fs/promises";import{pipeline as d}from"node:stream/promises";import f from"node:tty";import p from"process";var m=Object.defineProperty,h=(e,t)=>{let n={};for(var r in e)m(n,r,{get:e[r],enumerable:!0});return t||m(n,Symbol.toStringTag,{value:`Module`}),n};const g=async(n,r)=>{let i=await e.promises.readdir(n,{withFileTypes:!0});await e.promises.mkdir(r,{recursive:!0});for(let a of i){if(a.name===`.git`)continue;let i=t.join(n,a.name),o=t.join(r,a.name);if(a.isDirectory())await g(i,o);else if(a.isSymbolicLink()){let t=await e.promises.readlink(i);await e.promises.symlink(t,o)}else await e.promises.copyFile(i,o)}},ee=e=>({start:a.hrtime.bigint(),command:e.map(e=>te(r(e))).join(` `),state:{stdout:``,stderr:``,output:``}}),te=e=>/[^\w./-]/.test(e)?`'${e.replaceAll(`'`,`'\\''`)}'`:e,ne=({stdin:e,stdout:n,stderr:r,stdio:i=[e,n,r],env:s,preferLocal:c,cwd:l=`.`,...u})=>{let d=l instanceof URL?o(l):t.resolve(l),f=s?{...a.env,...s}:void 0,p=i[0]?.string;return{...u,input:p,stdio:p===void 0?i:[`pipe`,...i.slice(1)],env:c?re(f??a.env,d):f,cwd:d}},re=({Path:e=``,PATH:n=e,...r},i)=>{let a=n.split(t.delimiter),o=_([],t.resolve(i)).map(e=>t.join(e,`node_modules/.bin`)).filter(e=>!a.includes(e));return{...r,PATH:[...o,n].filter(Boolean).join(t.delimiter)}},_=(e,n)=>e.at(-1)===n?e:_([...e,n],t.resolve(n,`..`)),ie=async(e,t,n)=>await ae(e,n)?[b(e),t.map(e=>ce(e)),{...n,shell:!0}]:[e,t,n],ae=async(e,{shell:t,cwd:n,env:r=a.env})=>a.platform===`win32`&&!t&&!await oe(e,n,r),oe=async(e,t,{Path:n=``,PATH:r=n})=>y.some(t=>e.toLowerCase().endsWith(t))||(se[`${e}\0${t}\0${r}`]??=await v(e,t,r)),se={},v=async(e,n,r)=>{let i=r.split(t.delimiter).filter(Boolean).map(e=>e.replace(/^"(.*)"$/,`$1`));try{await Promise.all(y.flatMap(r=>[n,...i].map(n=>`${t.resolve(n,e)}${r}`)).map(async e=>{try{await u(e)}catch{return}throw 0}))}catch{return!0}return!1},y=[`.exe`,`.com`],ce=e=>b(b(`"${e.replaceAll(/(\\*)"/g,`$1$1\\"`).replace(/(\\*)$/,`$1$1`)}"`)),b=e=>e.replaceAll(/([()\][%!^"`<>&|;, *?])/g,`^$1`),le=async(e,{input:t},n)=>{let r=await e;t!==void 0&&r.stdin.end(t);let i=l(r,`close`);try{return await Promise.race([i,...r.stdio.filter(Boolean).map(e=>ue(e))]),de(n,C(r)),w(n)}catch(e){throw await Promise.allSettled([i]),x(e,r,n)}},ue=async e=>{for await(let[t]of c(e,`error`))if(![`ERR_STREAM_PREMATURE_CLOSE`,`EPIPE`].includes(t?.code))throw t},de=({command:e},{exitCode:t,signalName:n})=>{if(n!==void 0)throw new S(`Command was terminated with ${n}: ${e}`);if(t!==void 0)throw new S(`Command failed with exit code ${t}: ${e}`)},x=(e,t,n)=>Object.assign(fe(e,n),C(t),w(n)),fe=(e,{command:t})=>e instanceof S?e:new S(`Command failed: ${t}`,{cause:e});var S=class extends Error{name=`SubprocessError`};const C=({exitCode:e,signalCode:t})=>({...e<1?{}:{exitCode:e},...t===null?{}:{signalName:t}}),w=({state:{stdout:e,stderr:t,output:n},command:r,start:i})=>({stdout:T(e),stderr:T(t),output:T(n),command:r,durationMs:Number(a.hrtime.bigint()-i)/1e6}),T=e=>e.at(-1)===`
|
|
3
3
|
`?e.slice(0,e.at(-2)===`\r`?-2:-1):e,E=async(e,t,n,r)=>{try{[e,t]=[`node`,`node.exe`].includes(e.toLowerCase())?[a.execPath,[...a.execArgv.filter(e=>!e.startsWith(`--inspect`)),...t]]:[e,t];let i=s(...await ie(e,t,n));return D(i.stdout,r,`stdout`),D(i.stderr,r,`stderr`),i.once(`error`,()=>{}),await l(i,`spawn`),i}catch(e){throw x(e,{},r)}},D=(e,{state:t},n)=>{e&&(e.setEncoding(`utf8`),t.isIterating||(t.isIterating=!1,e.on(`data`,e=>{t[n]+=e,t.output+=e})))},pe=async e=>{let[[t,n]]=await Promise.all([Promise.allSettled(e),me(e)]);if(n.reason)throw n.reason.pipedFrom=t.reason??t.value,n.reason;if(t.reason)throw t.reason;return{...n.value,pipedFrom:t.value}},me=async e=>{try{let[{stdout:t},{stdin:n}]=await Promise.all(e.map(({nodeChildProcess:e})=>e));if(n===null)throw Error(`The "stdin" option must be set on the first "spawn()" call in the pipeline.`);if(t===null)throw Error(`The "stdout" option must be set on the last "spawn()" call in the pipeline.`);d(t,n).catch(()=>{})}catch(t){throw await Promise.allSettled(e.map(({nodeChildProcess:e})=>he(e))),t}},he=async e=>{let{stdin:t}=await e;t.end()},O=async function*(e,{state:t},n){if(t.isIterating===!1)throw Error(`The subprocess must be iterated right away, for example:
|
|
4
4
|
for await (const line of spawn(...)) { ... }`);t.isIterating=!0;try{let{[n]:t}=await e.nodeChildProcess;if(!t)return;let r=``;for await(let e of t.iterator({destroyOnReturn:!1})){let t=`${r}${e}`.split(/\r?\n/);r=t.pop(),yield*t}r&&(yield r)}finally{await e}},ge=async function*(...e){try{let t=[];for(;e.length>0;){t=e.map((e,n)=>t[n]??_e(e));let[{value:n,done:r},i]=await Promise.race(t.map((e,t)=>Promise.all([e,t]))),[a]=e.splice(i,1);t.splice(i,1),r||(e.push(a),yield n)}}finally{await Promise.all(e.map(e=>e.return()))}},_e=async e=>{try{return await e.next()}catch(t){await e.throw(t)}};function k(e,t,n,r){let[i=[],a={}]=Array.isArray(t)?[t,n]:[[],t],o=ee([e,...i]),s=ne(a),c=E(e,i,s,o),l=le(c,s,o);Object.assign(l,{nodeChildProcess:c}),l=r?pe([r,l]):l;let u=O(l,o,`stdout`),d=O(l,o,`stderr`);return Object.assign(l,{nodeChildProcess:c,stdout:u,stderr:d,[Symbol.asyncIterator]:()=>ge(u,d),pipe:(e,t,n)=>k(e,t,n,l)})}var ve=h({bgBlack:()=>ke,bgBlue:()=>Ne,bgBlueBright:()=>Je,bgCyan:()=>Fe,bgCyanBright:()=>Xe,bgGray:()=>Le,bgGreen:()=>je,bgGreenBright:()=>Ke,bgMagenta:()=>Pe,bgMagentaBright:()=>Ye,bgRed:()=>Ae,bgRedBright:()=>Ge,bgWhite:()=>Ie,bgWhiteBright:()=>Ze,bgYellow:()=>Me,bgYellowBright:()=>qe,black:()=>Te,blue:()=>R,blueBright:()=>Ve,bold:()=>M,cyan:()=>z,cyanBright:()=>Ue,dim:()=>N,gray:()=>Oe,green:()=>I,greenBright:()=>ze,hidden:()=>Ce,inverse:()=>Se,italic:()=>P,magenta:()=>Ee,magentaBright:()=>He,overline:()=>xe,red:()=>F,redBright:()=>Re,reset:()=>j,strikethrough:()=>we,underline:()=>be,white:()=>De,whiteBright:()=>We,yellow:()=>L,yellowBright:()=>Be});const ye=f?.WriteStream?.prototype?.hasColors?.()??!1,A=(e,t)=>{if(!ye)return e=>e;let n=`\u001B[${e}m`,r=`\u001B[${t}m`;return e=>{let t=e+``,i=t.indexOf(r);if(i===-1)return n+t+r;let a=n,o=0;for(;i!==-1;)a+=t.slice(o,i)+n,o=i+r.length,i=t.indexOf(r,o);return a+=t.slice(o)+r,a}},j=A(0,0),M=A(1,22),N=A(2,22),P=A(3,23),be=A(4,24),xe=A(53,55),Se=A(7,27),Ce=A(8,28),we=A(9,29),Te=A(30,39),F=A(31,39),I=A(32,39),L=A(33,39),R=A(34,39),Ee=A(35,39),z=A(36,39),De=A(37,39),Oe=A(90,39),ke=A(40,49),Ae=A(41,49),je=A(42,49),Me=A(43,49),Ne=A(44,49),Pe=A(45,49),Fe=A(46,49),Ie=A(47,49),Le=A(100,49),Re=A(91,39),ze=A(92,39),Be=A(93,39),Ve=A(94,39),He=A(95,39),Ue=A(96,39),We=A(97,39),Ge=A(101,49),Ke=A(102,49),qe=A(103,49),Je=A(104,49),Ye=A(105,49),Xe=A(106,49),Ze=A(107,49),B=a.platform!==`win32`||!!a.env.WT_SESSION,Qe=e=>!!(e.isTTY&&a.env.TERM!==`dumb`&&!(`CI`in a.env)),$e=R(B?`ℹ`:`i`),et=I(B?`✔`:`√`),tt=L(B?`⚠`:`‼`),nt=F(B?`✖️`:`×`),rt={frames:B?[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`]:[`-`,`\\`,`|`,`/`],interval:80};var it=class{#e;#t;#n=-1;#r;#i;#a;#o;#s=0;#c;#l;#u=0;constructor(e={}){let t=e.spinner??rt;this.#e=t.frames,this.#t=t.interval,this.#i=e.text??``,this.#a=e.stream??a.stderr,this.#o=e.color??`cyan`,this.#l=Qe(this.#a),this.#c=this.#y.bind(this)}start(e){return e&&(this.#i=e),this.isSpinning?this:(this.#h(),this.#f(),this.#_(),this.#r=setInterval(()=>{this.#f()},this.#t),this)}stop(e){return this.isSpinning?(clearInterval(this.#r),this.#r=void 0,this.#g(),this.clear(),this.#v(),e&&this.#a.write(`${e}\n`),this):this}#d(e,t){return this.stop(`${e} ${t??this.#i}`)}success(e){return this.#d(et,e)}error(e){return this.#d(nt,e)}warning(e){return this.#d(tt,e)}info(e){return this.#d($e,e)}get isSpinning(){return this.#r!==void 0}get text(){return this.#i}set text(e){this.#i=e??``,this.#f()}get color(){return this.#o}set color(e){this.#o=e,this.#f()}clear(){if(!this.#l)return this;this.#a.cursorTo(0);for(let e=0;e<this.#s;e++)e>0&&this.#a.moveCursor(0,-1),this.#a.clearLine(1);return this.#s=0,this}#f(){let e=Date.now();(this.#n===-1||e-this.#u>=this.#t)&&(this.#n=++this.#n%this.#e.length,this.#u=e);let t=ve[this.#o]??z,n=this.#e[this.#n],r=`${t(n)} ${this.#i}`;this.#l||(r+=`
|
|
5
5
|
`),this.clear(),this.#p(r),this.#l&&(this.#s=this.#m(r))}#p(e){this.#a.write(e)}#m(e){let t=this.#a.columns??80,n=r(e).split(`
|
|
6
|
-
`),i=0;for(let e of n)i+=Math.max(1,Math.ceil(e.length/t));return i}#h(){this.#l&&this.#p(`\x1B[?25l`)}#g(){this.#l&&this.#p(`\x1B[?25h`)}#_(){a.once(`SIGINT`,this.#c),a.once(`SIGTERM`,this.#c)}#v(){a.off(`SIGINT`,this.#c),a.off(`SIGTERM`,this.#c)}#y(e){this.isSpinning&&this.stop();let t=e===`SIGINT`?130:e===`SIGTERM`?143:1;a.exit(t)}};function at(e){return new it(e)}const V=async(n,r,a)=>{process.platform===`win32`&&await k(`git`,[`config`,`--global`,`core.longpaths`,`true`]);let o=`https://${n.token?n.token+`@`:n.token}github.com/${n.owner}/${n.repository}.git`,s=t.resolve(i.tmpdir(),`${n.repository}-${Date.now()}${Math.random().toString(16).slice(2,6)}`),c=at(),l=performance.now();r.watch||c.start(`Picking ${n.type}${n.type===`repository`?` without .git`:` from repository`}...`);try{await k(`git`,[`clone`,o,s,`--branch`,n.branch,`--depth`,`1`,`--single-branch`,...r.recursive?[`--recursive`]:[]])}catch{await k(`git`,[`clone`,o,s,...r.recursive?[`--recursive`]:[]]),await k(`git`,[`checkout`,n.branch],{cwd:s})}let u=t.resolve(s,n.path);(await e.promises.stat(u)).isDirectory()?(await e.promises.mkdir(a,{recursive:!0}),await g(u,a)):(await e.promises.mkdir(a.split(`/`).slice(0,-1).join(`/`),{recursive:!0}),await e.promises.copyFile(u,a)),r.watch?console.log(`- Synced at `+new Date().toLocaleTimeString()):c.success(`Picked ${n.type}${n.type===`repository`?` without .git`:` from repository`} in ${((performance.now()-l)/1e3).toFixed(2)} seconds.`),await e.promises.rm(s,{recursive:!0,force:!0})};function H(e){if(typeof e==`number`||/^\d+$/.test(e))return typeof e==`number`?e:parseInt(e,10);let t=/(\d+)([hms])/g,n=0,r;for(;(r=t.exec(e))!==null;){let e=parseInt(r[1],10);switch(r[2]){case`h`:n+=e*36e5;break;case`m`:n+=e*6e4;break;case`s`:n+=e*1e3;break}}return n}const ot=async e=>{let t=(await k(`git`,[`ls-remote`,e])).stdout,n=t.match(/(.+)\s+HEAD/)?.[1],r=t.match(RegExp(`${n}\\s+refs/heads/(.+)`))?.[1];if(!r)throw Error(`Could not determine default branch!`);return r};async function st(e,{branch:t,target:n}){let r=/^https:\/\/([^@]+)@github\.com/,i=e.match(r),a=``;i&&(a=i[1],e=e.replace(r,`https://github.com`));for(let t of[`git@github.com:`,`https://github.com/`,`https://raw.githubusercontent.com/`])if(e.startsWith(t)){e=e.replace(t,``);break}let o=e.split(`/`),s=o[0],c=o[1].endsWith(`.git`)?o[1].slice(0,-4):o[1],l=o[2]===`blob`?`blob`:o[2]===`tree`?`tree`:o[2]+o[3]===`refsheads`?`raw`:`repository`,u=t||(l===`repository`?await ot(`https://${a&&a+`@`}github.com/${s}/${c}`):l===`raw`?o[4]:o[3]),d=l?l===`raw`?o.slice(5).join(`/`):o.slice(4).join(`/`):o.slice(2).join(`/`)||`/`,f=n||(l===`blob`?`.`:d.split(`/`).pop()||c);return{token:a,owner:s,repository:c,type:l,branch:u,path:d,target:f}}const U=globalThis.window?.document!==void 0;globalThis.process?.versions?.node,globalThis.process?.versions?.bun,globalThis.Deno?.version?.deno,globalThis.process?.versions?.electron,globalThis.navigator?.userAgent?.includes(`jsdom`),typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope,typeof DedicatedWorkerGlobalScope<`u`&&globalThis instanceof DedicatedWorkerGlobalScope,typeof SharedWorkerGlobalScope<`u`&&globalThis instanceof SharedWorkerGlobalScope,typeof ServiceWorkerGlobalScope<`u`&&globalThis instanceof ServiceWorkerGlobalScope;const W=globalThis.navigator?.userAgentData?.platform;W===`macOS`||globalThis.navigator?.platform===`MacIntel`||globalThis.navigator?.userAgent?.includes(` Mac `)===!0||globalThis.process?.platform,W===`Windows`||globalThis.navigator?.platform===`Win32`||globalThis.process?.platform,W===`Linux`||globalThis.navigator?.platform?.startsWith(`Linux`)===!0||globalThis.navigator?.userAgent?.includes(` Linux `)===!0||globalThis.process?.platform,W===`iOS`||globalThis.navigator?.platform===`MacIntel`&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),W===`Android`||globalThis.navigator?.platform===`Android`||globalThis.navigator?.userAgent?.includes(` Android `)===!0||globalThis.process?.platform,!U&&a.env.TERM_PROGRAM,!U&&a.platform,U||a.cwd;const ct=(e,t)=>[`\x1B]`,`8`,`;`,`;`,t,`\x07`,e,`\x1B]`,`8`,`;`,`;`,`\x07`].join(``);function G(e,t=globalThis.Deno?globalThis.Deno.args:a.argv){let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}const{env:K}=a;let q;G(`no-color`)||G(`no-colors`)||G(`color=false`)||G(`color=never`)?q=0:(G(`color`)||G(`colors`)||G(`color=true`)||G(`color=always`))&&(q=1);function lt(){if(!(`FORCE_COLOR`in K))return;if(K.FORCE_COLOR===`true`)return 1;if(K.FORCE_COLOR===`false`)return 0;if(K.FORCE_COLOR.length===0)return 1;let e=Math.min(Number.parseInt(K.FORCE_COLOR,10),3);if([0,1,2,3].includes(e))return e}function ut(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function dt(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let r=lt();r!==void 0&&(q=r);let o=n?q:r;if(o===0)return 0;if(n){if(G(`color=16m`)||G(`color=full`)||G(`color=truecolor`))return 3;if(G(`color=256`))return 2}if(`TF_BUILD`in K&&`AGENT_NAME`in K)return 1;if(e&&!t&&o===void 0)return 0;let s=o||0;if(K.TERM===`dumb`)return s;if(a.platform===`win32`){let e=i.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in K)return[`GITHUB_ACTIONS`,`GITEA_ACTIONS`,`CIRCLECI`].some(e=>e in K)?3:[`TRAVIS`,`APPVEYOR`,`GITLAB_CI`,`BUILDKITE`,`DRONE`].some(e=>e in K)||K.CI_NAME===`codeship`?1:s;if(`TEAMCITY_VERSION`in K)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(K.TEAMCITY_VERSION)?1:0;if(K.COLORTERM===`truecolor`||K.TERM===`xterm-kitty`)return 3;if(`TERM_PROGRAM`in K){let e=Number.parseInt((K.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(K.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(K.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(K.TERM)||`COLORTERM`in K?1:s}function J(e,t={}){return ut(dt(e,{streamIsTTY:e&&e.isTTY,...t}))}J({isTTY:f.isatty(1)}),J({isTTY:f.isatty(2)});function Y(e,t=p.argv){let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}function X(e=``){if(/^\d{3,4}$/.test(e)){let t=/(\d{1,2})(\d{2})/.exec(e)??[];return{major:0,minor:Number.parseInt(t[1],10),patch:Number.parseInt(t[2],10)}}let t=(e??``).split(`.`).map(e=>Number.parseInt(e,10));return{major:t[0],minor:t[1],patch:t[2]}}function Z(e){let{CI:t,FORCE_HYPERLINK:n,NETLIFY:r,TEAMCITY_VERSION:i,TERM_PROGRAM:o,TERM_PROGRAM_VERSION:s,VTE_VERSION:c,TERM:l}=a.env;if(n)return!(n.length>0&&Number.parseInt(n,10)===0);if(Y(`no-hyperlink`)||Y(`no-hyperlinks`)||Y(`hyperlink=false`)||Y(`hyperlink=never`))return!1;if(Y(`hyperlink=true`)||Y(`hyperlink=always`)||r)return!0;if(!J(e)||e&&!e.isTTY)return!1;if(`WT_SESSION`in a.env)return!0;if(a.platform===`win32`||t||i)return!1;if(o){let e=X(s);switch(o){case`iTerm.app`:return e.major===3?e.minor>=1:e.major>3;case`WezTerm`:return e.major>=20200620;case`vscode`:return e.major>1||e.major===1&&e.minor>=72;case`ghostty`:return!0}}if(c){if(c===`0.50.0`)return!1;let e=X(c);return e.major>0||e.minor>=50}switch(l){case`alacritty`:return!0}return!1}const Q={stdout:Z(a.stdout),stderr:Z(a.stderr)};function $(e,t,{target:n=`stdout`,...r}={}){return Q[n]?ct(e,t):r.fallback===!1?e:typeof r.fallback==`function`?r.fallback(e,t):`${e} (\u200B${t}\u200B)`}$.isSupported=Q.stdout,$.stderr=(e,t,n={})=>$(e,t,{target:`stderr`,...n}),$.stderr.isSupported=Q.stderr;var ft=`gitpick`,pt=`4.14.0-canary.
|
|
6
|
+
`),i=0;for(let e of n)i+=Math.max(1,Math.ceil(e.length/t));return i}#h(){this.#l&&this.#p(`\x1B[?25l`)}#g(){this.#l&&this.#p(`\x1B[?25h`)}#_(){a.once(`SIGINT`,this.#c),a.once(`SIGTERM`,this.#c)}#v(){a.off(`SIGINT`,this.#c),a.off(`SIGTERM`,this.#c)}#y(e){this.isSpinning&&this.stop();let t=e===`SIGINT`?130:e===`SIGTERM`?143:1;a.exit(t)}};function at(e){return new it(e)}const V=async(n,r,a)=>{process.platform===`win32`&&await k(`git`,[`config`,`--global`,`core.longpaths`,`true`]);let o=`https://${n.token?n.token+`@`:n.token}github.com/${n.owner}/${n.repository}.git`,s=t.resolve(i.tmpdir(),`${n.repository}-${Date.now()}${Math.random().toString(16).slice(2,6)}`),c=at(),l=performance.now();r.watch||c.start(`Picking ${n.type}${n.type===`repository`?` without .git`:` from repository`}...`);try{await k(`git`,[`clone`,o,s,`--branch`,n.branch,`--depth`,`1`,`--single-branch`,...r.recursive?[`--recursive`]:[]])}catch{await k(`git`,[`clone`,o,s,...r.recursive?[`--recursive`]:[]]),await k(`git`,[`checkout`,n.branch],{cwd:s})}let u=t.resolve(s,n.path);(await e.promises.stat(u)).isDirectory()?(await e.promises.mkdir(a,{recursive:!0}),await g(u,a)):(await e.promises.mkdir(a.split(`/`).slice(0,-1).join(`/`),{recursive:!0}),await e.promises.copyFile(u,a)),r.watch?console.log(`- Synced at `+new Date().toLocaleTimeString()):c.success(`Picked ${n.type}${n.type===`repository`?` without .git`:` from repository`} in ${((performance.now()-l)/1e3).toFixed(2)} seconds.`),await e.promises.rm(s,{recursive:!0,force:!0})};function H(e){if(typeof e==`number`||/^\d+$/.test(e))return typeof e==`number`?e:parseInt(e,10);let t=/(\d+)([hms])/g,n=0,r;for(;(r=t.exec(e))!==null;){let e=parseInt(r[1],10);switch(r[2]){case`h`:n+=e*36e5;break;case`m`:n+=e*6e4;break;case`s`:n+=e*1e3;break}}return n}const ot=async e=>{let t=(await k(`git`,[`ls-remote`,e])).stdout,n=t.match(/(.+)\s+HEAD/)?.[1],r=t.match(RegExp(`${n}\\s+refs/heads/(.+)`))?.[1];if(!r)throw Error(`Could not determine default branch!`);return r};async function st(e,{branch:t,target:n}){let r=/^https:\/\/([^@]+)@github\.com/,i=e.match(r),a=``;i&&(a=i[1],e=e.replace(r,`https://github.com`));for(let t of[`git@github.com:`,`https://github.com/`,`https://raw.githubusercontent.com/`])if(e.startsWith(t)){e=e.replace(t,``);break}let o=e.split(`/`),s=o[0],c=o[1].endsWith(`.git`)?o[1].slice(0,-4):o[1],l=o[2]===`blob`?`blob`:o[2]===`tree`?`tree`:o[2]+o[3]===`refsheads`?`raw`:`repository`,u=t||(l===`repository`?await ot(`https://${a&&a+`@`}github.com/${s}/${c}`):l===`raw`?o[4]:o[3]),d=l?l===`raw`?o.slice(5).join(`/`):o.slice(4).join(`/`):o.slice(2).join(`/`)||`/`,f=n||(l===`blob`?`.`:d.split(`/`).pop()||c);return{token:a,owner:s,repository:c,type:l,branch:u,path:d,target:f}}const U=globalThis.window?.document!==void 0;globalThis.process?.versions?.node,globalThis.process?.versions?.bun,globalThis.Deno?.version?.deno,globalThis.process?.versions?.electron,globalThis.navigator?.userAgent?.includes(`jsdom`),typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope,typeof DedicatedWorkerGlobalScope<`u`&&globalThis instanceof DedicatedWorkerGlobalScope,typeof SharedWorkerGlobalScope<`u`&&globalThis instanceof SharedWorkerGlobalScope,typeof ServiceWorkerGlobalScope<`u`&&globalThis instanceof ServiceWorkerGlobalScope;const W=globalThis.navigator?.userAgentData?.platform;W===`macOS`||globalThis.navigator?.platform===`MacIntel`||globalThis.navigator?.userAgent?.includes(` Mac `)===!0||globalThis.process?.platform,W===`Windows`||globalThis.navigator?.platform===`Win32`||globalThis.process?.platform,W===`Linux`||globalThis.navigator?.platform?.startsWith(`Linux`)===!0||globalThis.navigator?.userAgent?.includes(` Linux `)===!0||globalThis.process?.platform,W===`iOS`||globalThis.navigator?.platform===`MacIntel`&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),W===`Android`||globalThis.navigator?.platform===`Android`||globalThis.navigator?.userAgent?.includes(` Android `)===!0||globalThis.process?.platform,!U&&a.env.TERM_PROGRAM,!U&&a.platform,U||a.cwd;const ct=(e,t)=>[`\x1B]`,`8`,`;`,`;`,t,`\x07`,e,`\x1B]`,`8`,`;`,`;`,`\x07`].join(``);function G(e,t=globalThis.Deno?globalThis.Deno.args:a.argv){let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}const{env:K}=a;let q;G(`no-color`)||G(`no-colors`)||G(`color=false`)||G(`color=never`)?q=0:(G(`color`)||G(`colors`)||G(`color=true`)||G(`color=always`))&&(q=1);function lt(){if(!(`FORCE_COLOR`in K))return;if(K.FORCE_COLOR===`true`)return 1;if(K.FORCE_COLOR===`false`)return 0;if(K.FORCE_COLOR.length===0)return 1;let e=Math.min(Number.parseInt(K.FORCE_COLOR,10),3);if([0,1,2,3].includes(e))return e}function ut(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function dt(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let r=lt();r!==void 0&&(q=r);let o=n?q:r;if(o===0)return 0;if(n){if(G(`color=16m`)||G(`color=full`)||G(`color=truecolor`))return 3;if(G(`color=256`))return 2}if(`TF_BUILD`in K&&`AGENT_NAME`in K)return 1;if(e&&!t&&o===void 0)return 0;let s=o||0;if(K.TERM===`dumb`)return s;if(a.platform===`win32`){let e=i.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in K)return[`GITHUB_ACTIONS`,`GITEA_ACTIONS`,`CIRCLECI`].some(e=>e in K)?3:[`TRAVIS`,`APPVEYOR`,`GITLAB_CI`,`BUILDKITE`,`DRONE`].some(e=>e in K)||K.CI_NAME===`codeship`?1:s;if(`TEAMCITY_VERSION`in K)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(K.TEAMCITY_VERSION)?1:0;if(K.COLORTERM===`truecolor`||K.TERM===`xterm-kitty`)return 3;if(`TERM_PROGRAM`in K){let e=Number.parseInt((K.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(K.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(K.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(K.TERM)||`COLORTERM`in K?1:s}function J(e,t={}){return ut(dt(e,{streamIsTTY:e&&e.isTTY,...t}))}J({isTTY:f.isatty(1)}),J({isTTY:f.isatty(2)});function Y(e,t=p.argv){let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}function X(e=``){if(/^\d{3,4}$/.test(e)){let t=/(\d{1,2})(\d{2})/.exec(e)??[];return{major:0,minor:Number.parseInt(t[1],10),patch:Number.parseInt(t[2],10)}}let t=(e??``).split(`.`).map(e=>Number.parseInt(e,10));return{major:t[0],minor:t[1],patch:t[2]}}function Z(e){let{CI:t,FORCE_HYPERLINK:n,NETLIFY:r,TEAMCITY_VERSION:i,TERM_PROGRAM:o,TERM_PROGRAM_VERSION:s,VTE_VERSION:c,TERM:l}=a.env;if(n)return!(n.length>0&&Number.parseInt(n,10)===0);if(Y(`no-hyperlink`)||Y(`no-hyperlinks`)||Y(`hyperlink=false`)||Y(`hyperlink=never`))return!1;if(Y(`hyperlink=true`)||Y(`hyperlink=always`)||r)return!0;if(!J(e)||e&&!e.isTTY)return!1;if(`WT_SESSION`in a.env)return!0;if(a.platform===`win32`||t||i)return!1;if(o){let e=X(s);switch(o){case`iTerm.app`:return e.major===3?e.minor>=1:e.major>3;case`WezTerm`:return e.major>=20200620;case`vscode`:return e.major>1||e.major===1&&e.minor>=72;case`ghostty`:return!0}}if(c){if(c===`0.50.0`)return!1;let e=X(c);return e.major>0||e.minor>=50}switch(l){case`alacritty`:return!0}return!1}const Q={stdout:Z(a.stdout),stderr:Z(a.stderr)};function $(e,t,{target:n=`stdout`,...r}={}){return Q[n]?ct(e,t):r.fallback===!1?e:typeof r.fallback==`function`?r.fallback(e,t):`${e} (\u200B${t}\u200B)`}$.isSupported=Q.stdout,$.stderr=(e,t,n={})=>$(e,t,{target:`stderr`,...n}),$.stderr.isSupported=Q.stderr;var ft=`gitpick`,pt=`4.14.0-canary.1`;const mt=`
|
|
7
7
|
With ${M(`${$(`GitPick`,`https://github.com/nrjdalal/gitpick`)}`)} clone specific directories or files from GitHub!
|
|
8
8
|
|
|
9
9
|
$ gitpick ${L(`<url>`)} ${I(`[target]`)} ${z(`[options]`)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gitpick",
|
|
3
|
-
"version": "4.14.0-canary.
|
|
3
|
+
"version": "4.14.0-canary.1",
|
|
4
4
|
"description": "Clone exactly what you need aka straightforward project scaffolding!",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"clone",
|
|
@@ -17,20 +17,20 @@
|
|
|
17
17
|
],
|
|
18
18
|
"homepage": "https://github.com/nrjdalal/gitpick#readme",
|
|
19
19
|
"bugs": "https://github.com/nrjdalal/gitpick/issues",
|
|
20
|
-
"repository": "nrjdalal/gitpick",
|
|
21
|
-
"funding": "https://github.com/sponsors/nrjdalal",
|
|
22
20
|
"license": "MIT",
|
|
23
21
|
"author": {
|
|
24
22
|
"name": "Neeraj Dalal",
|
|
25
23
|
"email": "admin@nrjdalal.com",
|
|
26
24
|
"url": "https://nrjdalal.com"
|
|
27
25
|
},
|
|
28
|
-
"
|
|
26
|
+
"repository": "nrjdalal/gitpick",
|
|
27
|
+
"funding": "https://github.com/sponsors/nrjdalal",
|
|
29
28
|
"bin": {
|
|
30
29
|
"degit": "./dist/index.mjs",
|
|
31
30
|
"gitpick": "./dist/index.mjs"
|
|
32
31
|
},
|
|
33
32
|
"files": [
|
|
34
33
|
"dist"
|
|
35
|
-
]
|
|
34
|
+
],
|
|
35
|
+
"type": "module"
|
|
36
36
|
}
|