setup-pnpm/dist/index.js

10 lines
266 KiB
JavaScript
Raw Normal View History

(()=>{var e={9450:function(e,r,t){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:true});const i=t(8829);const n=a(t(8436));const s=a(t(2191));const o=a(t(3326));const l=a(t(9150));const u=a(t(9268));async function main(){const e=(0,n.default)();const r=(0,i.getState)("is_post");if(r==="true")return(0,u.default)(e);(0,i.saveState)("is_post","true");await(0,s.default)(e);console.log("Installation Completed!");(0,o.default)(e);(0,l.default)(e)}main().catch((e=>{console.error(e);(0,i.setFailed)(e)}))},8436:function(e,r,t){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:true});r.getInputs=void 0;const i=t(8829);const n=a(t(6906));const s=t(4264);const o={required:true};const parseInputPath=e=>(0,n.default)((0,i.getInput)(e,o));const getInputs=()=>({version:(0,i.getInput)("version"),dest:parseInputPath("dest"),runInstall:(0,s.parseRunInstall)("run_install"),packageJsonFile:parseInputPath("package_json_file")});r.getInputs=getInputs;r["default"]=r.getInputs},4264:function(e,r,t){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:true});r.parseRunInstall=void 0;const i=t(8829);const n=a(t(4376));const s=t(1236);const o=a(t(7282));const l=a(t(5379));const u={required:true};function parseRunInstall(e){const r=(0,s.load)((0,i.getInput)(e,u));const t=new n.default({allErrors:true});const a=t.compile(l.default);if(!a(r)){for(const e of a.errors){(0,i.error)(`with.run_install${e.dataPath}: ${e.message}`)}return o.default.exit(1)}if(!r)return[];if(r===true)return[{recursive:true}];if(Array.isArray(r))return r;return[r]}r.parseRunInstall=parseRunInstall},2191:function(e,r,t){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:true});r.install=r.runSelfInstaller=void 0;const i=t(8829);const n=a(t(5907));r.runSelfInstaller=n.default;async function install(e){(0,i.startGroup)("Running self-installer...");const r=await(0,n.default)(e);(0,i.endGroup)();if(r){return(0,i.setFailed)(`Something went wrong, self-installer exits with code ${r}`)}}r.install=install;r["default"]=install},5907:function(e,r,t){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:true});r.runSelfInstaller=void 0;const i=t(8829);const n=t(2081);const s=t(1690);const o=a(t(1017));const l=t(7282);async function runSelfInstaller(e){const{version:r,dest:t,packageJsonFile:a}=e;await(0,s.remove)(t);const u=o.default.join(t,"package.json");await(0,s.ensureFile)(u);await(0,s.writeFile)(u,JSON.stringify({private:true}));const c=await readTarget(a,r);const f=(0,n.spawn)(l.execPath,[o.default.join(__dirname,"pnpm.js"),"install",c,"--no-lockfile"],{cwd:t,stdio:["pipe","inherit","inherit"]});const p=await new Promise(((e,r)=>{f.on("error",r);f.on("close",e)}));if(p===0){const e=o.default.join(t,"node_modules/.bin");(0,i.addPath)(e);(0,i.exportVariable)("PNPM_HOME",e)}return p}r.runSelfInstaller=runSelfInstaller;async function readTarget(e,r){if(r)return`pnpm@${r}`;const{GITHUB_WORKSPACE:t}=process.env;if(!t){throw new Error(`No workspace is found.\nIf you're intended to let pnpm/action-setup read preferred pnpm version from the "packageManager" field in the package.json file,\nplease run the actions/checkout before pnpm/action-setup.\nOtherwise, please specify the pnpm version in the action configuration.`)}const{packageManager:a}=JSON.parse(await(0,s.readFile)(o.default.join(t,e),"utf8"));if(typeof a!=="string"){throw new Error(`No pnpm version is specified.\nPlease specify it by one of the following ways:\n - in the GitHub Action config with the key "version"\n - in the package.json with the key "packageManager" (See https://nodejs.org/api/corepack.html)`)}if(!a.startsWith("pnpm@")){throw new Error("Invalid packageManager field in p
2022-02-22 12:26:05 +08:00
/*!
* expand-tilde <https://github.com/jonschlinkert/expand-tilde>
*
* Copyright (c) 2015 Jon Schlinkert.
* Licensed under the MIT license.
*/
2022-10-16 02:12:13 +08:00
var a=t(3554);var i=t(1017);e.exports=function expandTilde(e){var r=a();if(e.charCodeAt(0)===126){if(e.charCodeAt(1)===43){return i.join(process.cwd(),e.slice(2))}return r?i.join(r,e.slice(1)):e}return e}},2155:e=>{"use strict";e.exports=function equal(e,r){if(e===r)return true;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return false;var t,a,i;if(Array.isArray(e)){t=e.length;if(t!=r.length)return false;for(a=t;a--!==0;)if(!equal(e[a],r[a]))return false;return true}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();i=Object.keys(e);t=i.length;if(t!==Object.keys(r).length)return false;for(a=t;a--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[a]))return false;for(a=t;a--!==0;){var n=i[a];if(!equal(e[n],r[n]))return false}return true}return e!==e&&r!==r}},7822:e=>{"use strict";e.exports=function(e,r){if(!r)r={};if(typeof r==="function")r={cmp:r};var t=typeof r.cycles==="boolean"?r.cycles:false;var a=r.cmp&&function(e){return function(r){return function(t,a){var i={key:t,value:r[t]};var n={key:a,value:r[a]};return e(i,n)}}}(r.cmp);var i=[];return function stringify(e){if(e&&e.toJSON&&typeof e.toJSON==="function"){e=e.toJSON()}if(e===undefined)return;if(typeof e=="number")return isFinite(e)?""+e:"null";if(typeof e!=="object")return JSON.stringify(e);var r,n;if(Array.isArray(e)){n="[";for(r=0;r<e.length;r++){if(r)n+=",";n+=stringify(e[r])||"null"}return n+"]"}if(e===null)return"null";if(i.indexOf(e)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var s=i.push(e)-1;var o=Object.keys(e).sort(a&&a(e));n="";for(r=0;r<o.length;r++){var l=o[r];var u=stringify(e[l]);if(!u)continue;if(n)n+=",";n+=JSON.stringify(l)+":"+u}i.splice(s,1);return"{"+n+"}"}(e)}},2168:(e,r,t)=>{"use strict";const a=t(9113);const i=t(1017);const n=t(8695).mkdirsSync;const s=t(8223).utimesMillisSync;const o=t(5513);function copySync(e,r,t){if(typeof t==="function"){t={filter:t}}t=t||{};t.clobber="clobber"in t?!!t.clobber:true;t.overwrite="overwrite"in t?!!t.overwrite:t.clobber;if(t.preserveTimestamps&&process.arch==="ia32"){process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n"+"\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0002")}const{srcStat:a,destStat:i}=o.checkPathsSync(e,r,"copy",t);o.checkParentPathsSync(e,a,r,"copy");return handleFilterAndCopy(i,e,r,t)}function handleFilterAndCopy(e,r,t,s){if(s.filter&&!s.filter(r,t))return;const o=i.dirname(t);if(!a.existsSync(o))n(o);return getStats(e,r,t,s)}function startCopy(e,r,t,a){if(a.filter&&!a.filter(r,t))return;return getStats(e,r,t,a)}function getStats(e,r,t,i){const n=i.dereference?a.statSync:a.lstatSync;const s=n(r);if(s.isDirectory())return onDir(s,e,r,t,i);else if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return onFile(s,e,r,t,i);else if(s.isSymbolicLink())return onLink(e,r,t,i);else if(s.isSocket())throw new Error(`Cannot copy a socket file: ${r}`);else if(s.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${r}`);throw new Error(`Unknown file: ${r}`)}function onFile(e,r,t,a,i){if(!r)return copyFile(e,t,a,i);return mayCopyFile(e,t,a,i)}function mayCopyFile(e,r,t,i){if(i.overwrite){a.unlinkSync(t);return copyFile(e,r,t,i)}else if(i.errorOnExist){throw new Error(`'${t}' already exists`)}}function copyFile(e,r,t,i){a.copyFileSync(r,t);if(i.preserveTimestamps)handleTimestamps(e.mode,r,t);return setDestMode(t,e.mode)}function handleTimestamps(e,r,t){if(fileIsNotWritable(e))makeFileWritable(t,e);return setDestTimestamps(r,t)}function fileIsNotWritable(e){return(e&128)===0}function makeFileWritable(e,r){return setDestMode(e,r|128)}function setDestMode(e,r){return a.chmodSync(e,r)}function setDestTimestamps(e,r){const t=a.statSync(e);return s(r,t.atime,t.mtime)}function onDir(e,r,t,a,i){if(!r)return mkDirAndCopy(e.mode,t,a,i);return copyDir(t,a,i)}fu
2022-02-22 12:26:05 +08:00
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
2022-10-16 02:12:13 +08:00
(function(e,t){true?t(r):0})(this,(function(e){"use strict";function merge(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++){r[t]=arguments[t]}if(r.length>1){r[0]=r[0].slice(0,-1);var a=r.length-1;for(var i=1;i<a;++i){r[i]=r[i].slice(1,-1)}r[a]=r[a].slice(1);return r.join("")}else{return r[0]}}function subexp(e){return"(?:"+e+")"}function typeOf(e){return e===undefined?"undefined":e===null?"null":Object.prototype.toString.call(e).split(" ").pop().split("]").shift().toLowerCase()}function toUpperCase(e){return e.toUpperCase()}function toArray(e){return e!==undefined&&e!==null?e instanceof Array?e:typeof e.length!=="number"||e.split||e.setInterval||e.call?[e]:Array.prototype.slice.call(e):[]}function assign(e,r){var t=e;if(r){for(var a in r){t[a]=r[a]}}return t}function buildExps(e){var r="[A-Za-z]",t="[\\x0D]",a="[0-9]",i="[\\x22]",n=merge(a,"[A-Fa-f]"),s="[\\x0A]",o="[\\x20]",l=subexp(subexp("%[EFef]"+n+"%"+n+n+"%"+n+n)+"|"+subexp("%[89A-Fa-f]"+n+"%"+n+n)+"|"+subexp("%"+n+n)),u="[\\:\\/\\?\\#\\[\\]\\@]",c="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",f=merge(u,c),p=e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",d=e?"[\\uE000-\\uF8FF]":"[]",h=merge(r,a,"[\\-\\.\\_\\~]",p),m=subexp(r+merge(r,a,"[\\+\\-\\.]")+"*"),v=subexp(subexp(l+"|"+merge(h,c,"[\\:]"))+"*"),y=subexp(subexp("25[0-5]")+"|"+subexp("2[0-4]"+a)+"|"+subexp("1"+a+a)+"|"+subexp("[1-9]"+a)+"|"+a),g=subexp(subexp("25[0-5]")+"|"+subexp("2[0-4]"+a)+"|"+subexp("1"+a+a)+"|"+subexp("0?[1-9]"+a)+"|0?0?"+a),w=subexp(g+"\\."+g+"\\."+g+"\\."+g),S=subexp(n+"{1,4}"),b=subexp(subexp(S+"\\:"+S)+"|"+w),E=subexp(subexp(S+"\\:")+"{6}"+b),P=subexp("\\:\\:"+subexp(S+"\\:")+"{5}"+b),_=subexp(subexp(S)+"?\\:\\:"+subexp(S+"\\:")+"{4}"+b),x=subexp(subexp(subexp(S+"\\:")+"{0,1}"+S)+"?\\:\\:"+subexp(S+"\\:")+"{3}"+b),O=subexp(subexp(subexp(S+"\\:")+"{0,2}"+S)+"?\\:\\:"+subexp(S+"\\:")+"{2}"+b),k=subexp(subexp(subexp(S+"\\:")+"{0,3}"+S)+"?\\:\\:"+S+"\\:"+b),C=subexp(subexp(subexp(S+"\\:")+"{0,4}"+S)+"?\\:\\:"+b),R=subexp(subexp(subexp(S+"\\:")+"{0,5}"+S)+"?\\:\\:"+S),A=subexp(subexp(subexp(S+"\\:")+"{0,6}"+S)+"?\\:\\:"),F=subexp([E,P,_,x,O,k,C,R,A].join("|")),D=subexp(subexp(h+"|"+l)+"+"),I=subexp(F+"\\%25"+D),j=subexp(F+subexp("\\%25|\\%(?!"+n+"{2})")+D),T=subexp("[vV]"+n+"+\\."+merge(h,c,"[\\:]")+"+"),$=subexp("\\["+subexp(j+"|"+F+"|"+T)+"\\]"),N=subexp(subexp(l+"|"+merge(h,c))+"*"),L=subexp($+"|"+w+"(?!"+N+")"+"|"+N),M=subexp(a+"*"),q=subexp(subexp(v+"@")+"?"+L+subexp("\\:"+M)+"?"),U=subexp(l+"|"+merge(h,c,"[\\:\\@]")),H=subexp(U+"*"),B=subexp(U+"+"),z=subexp(subexp(l+"|"+merge(h,c,"[\\@]"))+"+"),V=subexp(subexp("\\/"+H)+"*"),W=subexp("\\/"+subexp(B+V)+"?"),Q=subexp(z+V),Y=subexp(B+V),K="(?!"+U+")",J=subexp(V+"|"+W+"|"+Q+"|"+Y+"|"+K),G=subexp(subexp(U+"|"+merge("[\\/\\?]",d))+"*"),Z=subexp(subexp(U+"|[\\/\\?]")+"*"),X=subexp(subexp("\\/\\/"+q+V)+"|"+W+"|"+Y+"|"+K),ee=subexp(m+"\\:"+X+subexp("\\?"+G)+"?"+subexp("\\#"+Z)+"?"),re=subexp(subexp("\\/\\/"+q+V)+"|"+W+"|"+Q+"|"+K),te=subexp(re+subexp("\\?"+G)+"?"+subexp("\\#"+Z)+"?"),ae=subexp(ee+"|"+te),ie=subexp(m+"\\:"+X+subexp("\\?"+G)+"?"),ne="^("+m+")\\:"+subexp(subexp("\\/\\/("+subexp("("+v+")@")+"?("+L+")"+subexp("\\:("+M+")")+"?)")+"?("+V+"|"+W+"|"+Y+"|"+K+")")+subexp("\\?("+G+")")+"?"+subexp("\\#("+Z+")")+"?$",se="^(){0}"+subexp(subexp("\\/\\/("+subexp("("+v+")@")+"?("+L+")"+subexp("\\:("+M+")")+"?)")+"?("+V+"|"+W+"|"+Q+"|"+K+")")+subexp("\\?("+G+")")+"?"+subexp("\\#("+Z+")")+"?$",oe="^("+m+")\\:"+subexp(subexp("\\/\\/("+subexp("("+v+")@")+"?("+L+")"+subexp("\\:("+M+")")+"?)")+"?("+V+"|"+W+"|"+Y+"|"+K+")")+subexp("\\?("+G+")")+"?$",le="^"+subexp("\\#("+Z+")")+"?$",ue="^"+subexp("("+v+")@")+"?("+L+")"+subexp("\\:("+M+")")+"?$";return{NOT_SCHEME:new RegExp(merge("[^]",r,a,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(merge("[^\\%\\:]",h,c),"g"),NOT_HOST:new RegExp(merge("[^\\%\\[\\]\\:]",h,c),"g"),NOT_PATH:new RegExp(merge("[^\\%\\/\\:\\@]",h,c),"g"),NOT_PATH_NOSCHEME:new RegExp(merge("[^\\%\\/\\@]",h,c),"g"),NOT_QUERY:new RegExp(merge("[^\\%]",h,c,"[\\:\\@\\/\\?]",d),"g"),NOT_FRAGMENT:new RegExp(merge("