setup-cpp/dist/setup_cpp.js

3 lines
138 KiB
JavaScript
Raw Normal View History

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,n)=>{r(e,t||{},((e,t)=>{e?n(e):o(t)}))}))}Ie(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 ke)return{binDir:ke};const n=e(Ce).sync("brew",{nothrow:!0});return null!==n?(ke=le.dirname(n),{binDir:ke}):(pe.execFileSync('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"',{stdio:"inherit"}),ke="/usr/local/bin/",{binDir:ke})}function n(e,t){const r=e.options.env||process.env,o=process.cwd(),n=null!=e.options.cwd,s=n&&void 0!==process.chdir&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd)}catch(e){}let i;try{i=Ce.sync(e.command,{path:r[Be({env:r})],pathExt:t?le.delimiter:void 0})}catch(e){}finally{s&&process.chdir(o)}return i&&(i=le.resolve(n?e.options.cwd:"",i)),i}function s(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 Ke&&1===e&&!t.file?s(t.original,"spawn"):null}function a(e,t,r){const o=Ue(e,t,r),n=pe.spawn(o.command,o.args,o.options);return Je.hookChildProcess(n,o),n}function c(){Tt&&(Tt=!1,_t.forEach((e=>{try{process.removeListener(e,Ct[e])}catch(e){}})),process.emit=It,process.reallyExit=At,Ot.count-=1)}function l(e,t,r){Ot.emitted[e]||(Ot.emitted[e]=!0,Ot.emit(e,t,r))}function u(){Tt||(Tt=!0,Ot.count+=1,_t=_t.filter((e=>{try{return process.on(e,Ct[e]),!0}catch(e){return!1}})),process.emit=d,process.reallyExit=p)}function p(e){process.exitCode=e||0,l("exit",process.exitCode,null),l("afterexit",process.exitCode,null),At.call(process,process.exitCode)}function d(e,t){if("exit"===e){void 0!==t&&(process.exitCode=t);var r=It.apply(this,arguments);return l("exit",process.exitCode,null),l("afterexit",process.exitCode,null),r}return It.apply(this,arguments)}async function h(e,t){if(!e)throw Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:r}=t,o=Bt(t);return await new Promise(((t,n)=>{const s=e=>{e&&o.getBufferedLength()<=qt.MAX_LENGTH&&(e.bufferedData=o.getBufferedValue()),n(e)};(async()=>{try{await Xt(e,o),t()}catch(e){s(e)}})(),o.on("data",(()=>{o.getBufferedLength()>r&&s(new Wt)}))})),o.getBufferedValue()}async function f(t,r,o=!0){const n="apt-get";if("string"==typeof o&&await e(Fe)("add-apt-repository",["--update","-y",o]),vr&&!0!==o||(await e(Fe)(n,["update","-y"]),vr=!0),void 0!==r&&""!==r)try{await e(Fe)(n,["install","-y",`${t}=${r}`])}catch{await e(Fe)(n,["install","-y",`${t}-${r}`])}else await e(Fe)(n,["install","-y",t]);return{binDir:"/usr/bin/"}}function m(t,r){return gr&&null!==e(Ce).sync("brew",{nothrow:!0})||(o(0,0,process),gr=!0),e(Fe).sync("brew",["install",void 0!==r&&""!==r?`${t}@${r}`:t]),{binDir:"/usr/local/bin/"}}async function v(t){try{Re.addPath(t)}catch(r){switch(Re.error(r),process.platform){case"win32":await e(Fe)(`setx PATH=${t};%PATH%`);break;case"linux":case"darwin":await e(Fe).command(`echo "export PATH=${t}:$PATH" >> ~/.profile`),await e(Fe).command("source ~/.profile"),Re.info(t+" was added to ~/.profile");break;default:Re.error(`Failed to add ${t} to the percistent PATH. You should add it manually.`),process.env.PATH=`${t}${le.delimiter}${process.env.PATH}`}}}function g(t,r,o){if("win32"!==process.platform)return;if("string"==typeof yr)return{binDir:yr};const n=e(Ce).sync("choco",{nothrow:!0});if(null!==n)return yr=le.dirname(n),{binDir:yr};e(Fe).commandSync('@"%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%;
2021-09-18 04:00:26 +08:00
//# sourceMappingURL=setup_cpp.js.map