setup-pnpm/dist/index.js

10 lines
249 KiB
JavaScript
Raw Normal View History

(()=>{var e={8243: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(3031);const n=a(t(4694));const s=a(t(1142));const o=a(t(2759));const l=a(t(4207));const c=a(t(5659));async function main(){const e=(0,n.default)();const r=(0,i.getState)("is_post");if(r==="true")return(0,c.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)}))},4694: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(3031);const n=a(t(4790));const s=t(5400);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")});r.getInputs=getInputs;r["default"]=r.getInputs},5400: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(3031);const n=a(t(8438));const s=t(3639);const o=a(t(7282));const l=a(t(5379));const c={required:true};function parseRunInstall(e){const r=(0,s.load)((0,i.getInput)(e,c));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},1142: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(3031);const n=a(t(9536));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},9536: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(3031);const n=t(2081);const s=t(5176);const o=a(t(1017));const l=t(7282);async function runSelfInstaller(e){const{version:r,dest:t}=e;await(0,s.remove)(t);const a=o.default.join(t,"package.json");await(0,s.ensureFile)(a);await(0,s.writeFile)(a,JSON.stringify({private:true}));const c=await readTarget(r);const u=(0,n.spawn)(l.execPath,[o.default.join(__dirname,"pnpm.js"),"install",c,"--no-lockfile"],{cwd:t,stdio:["pipe","inherit","inherit"]});const f=await new Promise(((e,r)=>{u.on("error",r);u.on("close",e)}));if(f===0){const e=o.default.join(t,"node_modules/.bin");(0,i.addPath)(e);(0,i.exportVariable)("PNPM_HOME",e)}return f}r.runSelfInstaller=runSelfInstaller;async function readTarget(e){if(e)return`pnpm@${e}`;const{GITHUB_WORKSPACE:r}=process.env;if(!r){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:t}=JSON.parse(await(0,s.readFile)(o.default.join(r,"package.json"),"utf8"));if(typeof t!=="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(!t.startsWith("pnpm@")){throw new Error("Invalid packageManager field in package.json")}return t}r["default"]=runSelfInstaller},2759:(e
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.
*/
var a=t(2157);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}},3064: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}},4486: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 c=stringify(e[l]);if(!c)continue;if(n)n+=",";n+=JSON.stringify(l)+":"+c}i.splice(s,1);return"{"+n+"}"}(e)}},8593:(e,r,t)=>{"use strict";const a=t(7765);const i=t(1017);const n=t(5443).mkdirsSync;const s=t(7237).utimesMillisSync;const o=t(7169);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"){console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269`)}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)}function mkDirAndCopy(e,r,t,i)
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 */
(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)),c="[\\:\\/\\?\\#\\[\\]\\@]",u="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",f=merge(c,u),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,u,"[\\:]"))+"*"),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),S=subexp(g+"\\."+g+"\\."+g+"\\."+g),w=subexp(n+"{1,4}"),E=subexp(subexp(w+"\\:"+w)+"|"+S),b=subexp(subexp(w+"\\:")+"{6}"+E),P=subexp("\\:\\:"+subexp(w+"\\:")+"{5}"+E),x=subexp(subexp(w)+"?\\:\\:"+subexp(w+"\\:")+"{4}"+E),_=subexp(subexp(subexp(w+"\\:")+"{0,1}"+w)+"?\\:\\:"+subexp(w+"\\:")+"{3}"+E),k=subexp(subexp(subexp(w+"\\:")+"{0,2}"+w)+"?\\:\\:"+subexp(w+"\\:")+"{2}"+E),O=subexp(subexp(subexp(w+"\\:")+"{0,3}"+w)+"?\\:\\:"+w+"\\:"+E),C=subexp(subexp(subexp(w+"\\:")+"{0,4}"+w)+"?\\:\\:"+E),A=subexp(subexp(subexp(w+"\\:")+"{0,5}"+w)+"?\\:\\:"+w),F=subexp(subexp(subexp(w+"\\:")+"{0,6}"+w)+"?\\:\\:"),R=subexp([b,P,x,_,k,O,C,A,F].join("|")),I=subexp(subexp(h+"|"+l)+"+"),D=subexp(R+"\\%25"+I),j=subexp(R+subexp("\\%25|\\%(?!"+n+"{2})")+I),T=subexp("[vV]"+n+"+\\."+merge(h,u,"[\\:]")+"+"),$=subexp("\\["+subexp(j+"|"+R+"|"+T)+"\\]"),N=subexp(subexp(l+"|"+merge(h,u))+"*"),L=subexp($+"|"+S+"(?!"+N+")"+"|"+N),M=subexp(a+"*"),q=subexp(subexp(v+"@")+"?"+L+subexp("\\:"+M)+"?"),U=subexp(l+"|"+merge(h,u,"[\\:\\@]")),H=subexp(U+"*"),z=subexp(U+"+"),B=subexp(subexp(l+"|"+merge(h,u,"[\\@]"))+"+"),V=subexp(subexp("\\/"+H)+"*"),Q=subexp("\\/"+subexp(z+V)+"?"),W=subexp(B+V),Y=subexp(z+V),K="(?!"+U+")",J=subexp(V+"|"+Q+"|"+W+"|"+Y+"|"+K),G=subexp(subexp(U+"|"+merge("[\\/\\?]",d))+"*"),Z=subexp(subexp(U+"|[\\/\\?]")+"*"),X=subexp(subexp("\\/\\/"+q+V)+"|"+Q+"|"+Y+"|"+K),ee=subexp(m+"\\:"+X+subexp("\\?"+G)+"?"+subexp("\\#"+Z)+"?"),re=subexp(subexp("\\/\\/"+q+V)+"|"+Q+"|"+W+"|"+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+"|"+Q+"|"+Y+"|"+K+")")+subexp("\\?("+G+")")+"?"+subexp("\\#("+Z+")")+"?$",se="^(){0}"+subexp(subexp("\\/\\/("+subexp("("+v+")@")+"?("+L+")"+subexp("\\:("+M+")")+"?)")+"?("+V+"|"+Q+"|"+W+"|"+K+")")+subexp("\\?("+G+")")+"?"+subexp("\\#("+Z+")")+"?$",oe="^("+m+")\\:"+subexp(subexp("\\/\\/("+subexp("("+v+")@")+"?("+L+")"+subexp("\\:("+M+")")+"?)")+"?("+V+"|"+Q+"|"+Y+"|"+K+")")+subexp("\\?("+G+")")+"?$",le="^"+subexp("\\#("+Z+")")+"?$",ce="^"+subexp("("+v+")@")+"?("+L+")"+subexp("\\:("+M+")")+"?$";return{NOT_SCHEME:new RegExp(merge("[^]",r,a,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(merge("[^\\%\\:]",h,u),"g"),NOT_HOST:new RegExp(merge("[^\\%\\[\\]\\:]",h,u),"g"),NOT_PATH:new RegExp(merge("[^\\%\\/\\:\\@]",h,u),"g"),NOT_PATH_NOSCHEME:new RegExp(merge("[^\\%\\/\\@]",h,u),"g"),NOT_QUERY:new RegExp(merge("[^\\%]",h,u,"[\\:\\@\\/\\?]",d),"g"),NOT_FRAGMENT:new RegExp(merge("