2021-09-18 03:35:53 +08:00
|
|
|
function e(e){return e&&e.__esModule?e.default:e}function t(e,t,r,o){Object.defineProperty(e,t,{get:r,set:o,enumerable:!0,configurable:!0})}function r(e,t,o){if("function"==typeof t&&(o=t,t={}),!o){if("function"!=typeof Promise)throw new TypeError("callback not provided");return new Promise(((o,s)=>{r(e,t||{},((e,t)=>{e?s(e):o(t)}))}))}be(e,t||{},((e,r)=>{e&&("EACCES"===e.code||t&&t.ignoreErrors)&&(e=null,r=!1),o(e,r)}))}function o(t,r,o){if(!["darwin","linux"].includes(process.platform))return;if("string"==typeof _e)return{binDir:_e};const s=e(xe).sync("brew",{nothrow:!0});return null!==s?(_e=ee.dirname(s),{binDir:_e}):(re.execFileSync('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"',{stdio:"inherit"}),_e="/usr/local/bin/",{binDir:_e})}function s(e,t){const r=e.options.env||process.env,o=process.cwd(),s=null!=e.options.cwd,n=s&&void 0!==process.chdir&&!process.chdir.disabled;if(n)try{process.chdir(e.options.cwd)}catch(e){}let i;try{i=xe.sync(e.command,{path:r[Te({env:r})],pathExt:t?ee.delimiter:void 0})}catch(e){}finally{n&&process.chdir(o)}return i&&(i=ee.resolve(s?e.options.cwd:"",i)),i}function n(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function i(e,t){return Ve&&1===e&&!t.file?n(t.original,"spawn"):null}function a(e,t,r){const o=Ae(e,t,r),s=re.spawn(o.command,o.args,o.options);return Ue.hookChildProcess(s,o),s}function l(e){return void 0!==qe||(qe=!!process.env.CI||0===(null===(t=process.getuid)||void 0===t?void 0:t.call(process))),qe?"sudo "+e:e;var t}function c(t,r,o=!0){const s=l("apt-get");let n=0;if("string"==typeof o&&(n=e(Ce).sync(l("add-apt-repository"),["--update",o],{stdio:"inherit"}).status),Ge&&!0!==o||(n=e(Ce).sync(s,["update"],{stdio:"inherit"}).status,Ge=!0),void 0!==r&&""!==r)try{n=e(Ce).sync(s,["install",`${t}=${r}`],{stdio:"inherit"}).status}catch{n=e(Ce).sync(s,["install",`${t}-${r}`],{stdio:"inherit"}).status}else n=e(Ce).sync(s,["install",t],{stdio:"inherit"}).status;if(0!==n)throw Error(`Failed to install ${t} ${r}`);return{binDir:"/usr/bin/"}}function u(t,r){return He&&null!==e(xe).sync("brew",{nothrow:!0})||(o(0,0,process),He=!0),e(Ce).sync("brew",["install",void 0!==r&&""!==r?`${t}@${r}`:t],{stdio:"inherit"}),{binDir:"/usr/local/bin/"}}function p(t,r,o){if("win32"!==process.platform)return;if("string"==typeof Be)return{binDir:Be};const s=e(xe).sync("choco",{nothrow:!0});if(null!==s)return Be=ee.dirname(s),{binDir:Be};if(0!==e(Ce).sync('@"%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString(\'https://community.chocolatey.org/install.ps1\'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\\chocolatey\\bin"',{stdio:"inherit"}).status)throw Error("Failed to install chocolatey");const n=e(xe).sync("choco",{nothrow:!0});return Be=null!==n?ee.dirname(n):"C:/ProgramData/Chocolatey/bin/",te.existsSync(Be)?{binDir:Be}:void 0}async function d(t,r,o=[]){let s;if(Xe&&null!==e(xe).sync("choco",{nothrow:!0})||(await p(0,0,process),Xe=!0),s=void 0!==r&&""!==r?e(Ce).sync("choco",["install","-y",t,"--version="+r,...o],{stdio:"inherit"}).status:e(Ce).sync("choco",["install","-y",t,...o],{stdio:"inherit"}).status,0!==s)throw Error(`Failed to install ${t} ${r}`);const n="C:/ProgramData/Chocolatey/bin/";return ye.addPath(n),{binDir:n}}function h(e,t,r){return ft(this,void 0,void 0,(function*(){const o=mt.argStringToArray(e);if(0===o.length)throw Error("Parameter 'commandLine' cannot be null or empty.");const s=o[0];return t=o.slice(1).concat(t||[]),new mt.ToolRunner(s,t,r).exec()}))}function f(e,t){const r=[];t=t||ot.arch();const o=st.join(w(),e);if(tt.existsSync(o)){const e=tt.readdirSync(o);for(const s of e)if(y(s)){const e=st.join(o,s,t||"");tt.existsSync(e)&&tt.existsSync(e+".complete")&&r.push(s)}}return r}function m(e){return Je(this,void 0,void 0,(function*(){return e||(e=
|