UNPKG

@bring-it/cli

Version:
1 lines 7.73 kB
export const __webpack_id__=425;export const __webpack_ids__=[425];export const __webpack_modules__={425:(e,r,t)=>{t.r(r),t.d(r,{action:()=>z});var n=t(421),o=t(24),i=t(760);t(455);const s=(e=0)=>r=>`\x1b[${r+e}m`,l=(e=0)=>r=>`\x1b[${38+e};5;${r}m`,c=(e=0)=>(r,t,n)=>`\x1b[${38+e};2;${r};${t};${n}m`,a={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(a.modifier),Object.keys(a.color),Object.keys(a.bgColor);const u=function(){const e=new Map;for(const[r,t]of Object.entries(a)){for(const[r,n]of Object.entries(t))a[r]={open:`\x1b[${n[0]}m`,close:`\x1b[${n[1]}m`},t[r]=a[r],e.set(n[0],n[1]);Object.defineProperty(a,r,{value:t,enumerable:!1})}return Object.defineProperty(a,"codes",{value:e,enumerable:!1}),a.color.close="\x1b[39m",a.bgColor.close="\x1b[49m",a.color.ansi=s(),a.color.ansi256=l(),a.color.ansi16m=c(),a.bgColor.ansi=s(10),a.bgColor.ansi256=l(10),a.bgColor.ansi16m=c(10),Object.defineProperties(a,{rgbToAnsi256:{value:(e,r,t)=>e===r&&r===t?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(t/255*5),enumerable:!1},hexToRgb:{value(e){const r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!r)return[0,0,0];let[t]=r;3===t.length&&(t=[...t].map((e=>e+e)).join(""));const n=Number.parseInt(t,16);return[n>>16&255,n>>8&255,255&n]},enumerable:!1},hexToAnsi256:{value:e=>a.rgbToAnsi256(...a.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let r,t,n;if(e>=232)r=(10*(e-232)+8)/255,t=r,n=r;else{const o=(e-=16)%36;r=Math.floor(e/36)/5,t=Math.floor(o/6)/5,n=o%6/5}const o=2*Math.max(r,t,n);if(0===o)return 30;let i=30+(Math.round(n)<<2|Math.round(t)<<1|Math.round(r));return 2===o&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(e,r,t)=>a.ansi256ToAnsi(a.rgbToAnsi256(e,r,t)),enumerable:!1},hexToAnsi:{value:e=>a.ansi256ToAnsi(a.hexToAnsi256(e)),enumerable:!1}}),a}(),g=u;var b=t(708),h=t(161),f=t(66);function d(e,r=(globalThis.Deno?globalThis.Deno.args:b.argv)){const t=e.startsWith("-")?"":1===e.length?"-":"--",n=r.indexOf(t+e),o=r.indexOf("--");return-1!==n&&(-1===o||n<o)}const{env:m}=b;let p;function O(e,r={}){return 0!==(t=function(e,{streamIsTTY:r,sniffFlags:t=!0}={}){const n=function(){if("FORCE_COLOR"in m)return"true"===m.FORCE_COLOR?1:"false"===m.FORCE_COLOR?0:0===m.FORCE_COLOR.length?1:Math.min(Number.parseInt(m.FORCE_COLOR,10),3)}();void 0!==n&&(p=n);const o=t?p:n;if(0===o)return 0;if(t){if(d("color=16m")||d("color=full")||d("color=truecolor"))return 3;if(d("color=256"))return 2}if("TF_BUILD"in m&&"AGENT_NAME"in m)return 1;if(e&&!r&&void 0===o)return 0;const i=o||0;if("dumb"===m.TERM)return i;if("win32"===b.platform){const e=h.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in m)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((e=>e in m))?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((e=>e in m))||"codeship"===m.CI_NAME?1:i;if("TEAMCITY_VERSION"in m)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(m.TEAMCITY_VERSION)?1:0;if("truecolor"===m.COLORTERM)return 3;if("xterm-kitty"===m.TERM)return 3;if("TERM_PROGRAM"in m){const e=Number.parseInt((m.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(m.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(m.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(m.TERM)||"COLORTERM"in m?1:i}(e,{streamIsTTY:e&&e.isTTY,...r}))&&{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3};var t}d("no-color")||d("no-colors")||d("color=false")||d("color=never")?p=0:(d("color")||d("colors")||d("color=true")||d("color=always"))&&(p=1);const T={stdout:O({isTTY:f.isatty(1)}),stderr:O({isTTY:f.isatty(2)})};function v(e,r,t){let n=e.indexOf(r);if(-1===n)return e;const o=r.length;let i=0,s="";do{s+=e.slice(i,n)+r+t,i=n+o,n=e.indexOf(r,i)}while(-1!==n);return s+=e.slice(i),s}const{stdout:y,stderr:R}=T,_=Symbol("GENERATOR"),E=Symbol("STYLER"),A=Symbol("IS_EMPTY"),C=["ansi","ansi","ansi256","ansi16m"],M=Object.create(null);function w(e){return(e=>{const r=(...e)=>e.join(" ");return((e,r={})=>{if(r.level&&!(Number.isInteger(r.level)&&r.level>=0&&r.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const t=y?y.level:0;e.level=void 0===r.level?t:r.level})(r,e),Object.setPrototypeOf(r,w.prototype),r})(e)}Object.setPrototypeOf(w.prototype,Function.prototype);for(const[e,r]of Object.entries(g))M[e]={get(){const t=N(this,j(r.open,r.close,this[E]),this[A]);return Object.defineProperty(this,e,{value:t}),t}};M.visible={get(){const e=N(this,this[E],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const I=(e,r,t,...n)=>"rgb"===e?"ansi16m"===r?g[t].ansi16m(...n):"ansi256"===r?g[t].ansi256(g.rgbToAnsi256(...n)):g[t].ansi(g.rgbToAnsi(...n)):"hex"===e?I("rgb",r,t,...g.hexToRgb(...n)):g[t][e](...n),x=["rgb","hex","ansi256"];for(const e of x)M[e]={get(){const{level:r}=this;return function(...t){const n=j(I(e,C[r],"color",...t),g.color.close,this[E]);return N(this,n,this[A])}}},M["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:r}=this;return function(...t){const n=j(I(e,C[r],"bgColor",...t),g.bgColor.close,this[E]);return N(this,n,this[A])}}};const B=Object.defineProperties((()=>{}),{...M,level:{enumerable:!0,get(){return this[_].level},set(e){this[_].level=e}}}),j=(e,r,t)=>{let n,o;return void 0===t?(n=e,o=r):(n=t.openAll+e,o=r+t.closeAll),{open:e,close:r,openAll:n,closeAll:o,parent:t}},N=(e,r,t)=>{const n=(...e)=>S(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,B),n[_]=e,n[E]=r,n[A]=t,n},S=(e,r)=>{if(e.level<=0||!r)return e[A]?"":r;let t=e[E];if(void 0===t)return r;const{openAll:n,closeAll:o}=t;if(r.includes("\x1b"))for(;void 0!==t;)r=v(r,t.close,t.open),t=t.parent;const i=r.indexOf("\n");return-1!==i&&(r=function(e,r,t,n){let o=0,i="";do{const s="\r"===e[n-1];i+=e.slice(o,s?n-1:n)+r+(s?"\r\n":"\n")+t,o=n+1,n=e.indexOf("\n",o)}while(-1!==n);return i+=e.slice(o),i}(r,o,n,i)),n+r+o};Object.defineProperties(w.prototype,M);const k=w(),P=(w({level:R?R.level:0}),k),{red:$,cyan:G,green:L,yellow:Y,magenta:F}=P;L("[okay]"),$("[fail]"),Y("[warn]");const D=["**/.{cache,git,svn,ssh,yarn}/**","**/.{npm,yarn}rc","**/.env.*","**/.env","**/.git{keep,ignore}","**/{node,web}_modules/**","**/*.{pem,ppk}","**/id_{d,r}sa","**/.obsidian/**","**/.docusaurus/**","**/miniprogram_npm/**","**/ssh*config","**/sshd*config"];var V=t(373);async function z({pattern:e,name:r,dir:t,cwd:s}){const l=function(e,r){if(0===e.length)throw new Error("Error: no pattern input");const t=(0,V.globbySync)(e,{dot:!0,ignore:D,cwd:r});if(t.length>0)return console.log(t),t;throw new Error("Error: no files targeting")}(e,s),c=(0,i.resolve)(process.cwd(),t,r);try{(0,n.execFileSync)("ls",[t])}catch{(0,o.mkdirSync)(t,{recursive:!0})}function a(e,r){(0,n.execFileSync)(e,r,{cwd:s})}a("tar",["-c","-f",`${c}.tar`,...l]),a("tar",["-c","-f",`${c}.tar.gz`,"-z",...l]),a("zip",["-r","-FS","-q",`${c}.zip`,...l])}}};