Run pnpm store prune post action

This commit is contained in:
khai96_ committed 2020-05-09 21:15:50 +07:00
1 parent 291e58ad85
commit c8fc1974e1
3 files changed
+32 -4

No files matched your search

+1 -1
View File
@@ -1 +1 @@
module.exports=function(n,e){"use strict";var f={};function __webpack_require__(e){if(f[e]){return f[e].exports}var r=f[e]={i:e,l:false,exports:{}};n[e].call(r.exports,r,r.exports,__webpack_require__);r.l=true;return r.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(803)}return startup()}({0:function(n,e){"use strict";Object.defineProperty(e,"__esModule",{value:true});e.ref="301414cec74a2b6b63c95b42f2ad1790ccb980ed";e.url=`https://raw.githubusercontent.com/pnpm/self-installer/${e.ref}/install.js`;e.default=e.url},17:function(n){"use strict";n.exports=function generate__limitItems(n,e,f){var r=" ";var l=n.level;var s=n.dataLevel;var v=n.schema[e];var c=n.schemaPath+n.util.getProperty(e);var p=n.errSchemaPath+"/"+e;var g=!n.opts.allErrors;var b;var w="data"+(s||"");var d=n.opts.$data&&v&&v.$data,i;if(d){r+=" var schema"+l+" = "+n.util.getData(v.$data,s,n.dataPathArr)+"; ";i="schema"+l}else{i=v}var A=e=="maxItems"?">":"<";r+="if ( ";if(d){r+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "}r+=" "+w+".length "+A+" "+i+") { ";var b=e;var j=j||[];j.push(r);r="";if(n.createErrors!==false){r+=" { keyword: '"+(b||"_limitItems")+"' , dataPath: (dataPath || '') + "+n.errorPath+" , schemaPath: "+n.util.toQuotedString(p)+" , params: { limit: "+i+" } ";if(n.opts.messages!==false){r+=" , message: 'should NOT have ";if(e=="maxItems"){r+="more"}else{r+="fewer"}r+=" than ";if(d){r+="' + "+i+" + '"}else{r+=""+v}r+=" items' "}if(n.opts.verbose){r+=" , schema: ";if(d){r+="validate.schema"+c}else{r+=""+v}r+=" , parentSchema: validate.schema"+n.schemaPath+" , data: "+w+" "}r+=" } "}else{r+=" {} "}var E=r;r=j.pop();if(!n.compositeRule&&g){if(n.async){r+=" throw new ValidationError(["+E+"]); "}else{r+=" validate.errors = ["+E+"]; return false; "}}else{r+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}r+="} ";if(g){r+=" else { "}return r}},34:function(n){n.exports=require("https")},87:function(n){n.exports=require("os")},89:function(n,e,f){"use strict";var r=this&&this.__awaiter||function(n,e,f,r){function adopt(n){return n instanceof f?n:new f(function(e){e(n)})}return new(f||(f=Promise))(function(f,l){function fulfilled(n){try{step(r.next(n))}catch(n){l(n)}}function rejected(n){try{step(r["throw"](n))}catch(n){l(n)}}function step(n){n.done?f(n.value):adopt(n.value).then(fulfilled,rejected)}step((r=r.apply(n,e||[])).next())})};var l=this&&this.__importStar||function(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var f in n)if(Object.hasOwnProperty.call(n,f))e[f]=n[f];e["default"]=n;return e};Object.defineProperty(e,"__esModule",{value:true});const s=f(486);const v=l(f(87));const c=l(f(622));var p;(function(n){n[n["Success"]=0]="Success";n[n["Failure"]=1]="Failure"})(p=e.ExitCode||(e.ExitCode={}));function exportVariable(n,e){const f=s.toCommandValue(e);process.env[n]=f;s.issueCommand("set-env",{name:n},f)}e.exportVariable=exportVariable;function setSecret(n){s.issueCommand("add-mask",{},n)}e.setSecret=setSecret;function addPath(n){s.issueCommand("add-path",{},n);process.env["PATH"]=`${n}${c.delimiter}${process.env["PATH"]}`}e.addPath=addPath;function getInput(n,e){const f=process.env[`INPUT_${n.replace(/ /g,"_").toUpperCase()}`]||"";if(e&&e.required&&!f){throw new Error(`Input required and not supplied: ${n}`)}return f.trim()}e.getInput=getInput;function setOutput(n,e){s.issueCommand("set-output",{name:n},e)}e.setOutput=setOutput;function setCommandEcho(n){s.issue("echo",n?"on":"off")}e.setCommandEcho=setCommandEcho;function setFailed(n){process.exitCode=p.Failure;error(n)}e.setFailed=setFailed;function isDebug(){return process.env["RUNNER_DEBUG"]==="1"}e.isDebug=isDebug;function debug(n){s.issueCommand("debug",{},n)}e.debug=debug;function error(n){s.issue("error",n instanceof Error?n.toString():n)}e.error=error;function warning(n){s.issue("warning",n instanceof Error?n.toString():n)}e.warning=warning;function info(n){process.stdout.write(n+v.EOL)}e.info=info;function startGroup(n){s.issue("group",n)}e.startGroup=startGroup;function endGroup(){s.issue("endgroup")}e.endGroup=endGroup;function group(n,e){return r(this,void 0,void 0,function*(){startGroup(n);let f;try{f=yield e()}finally{endGroup()}return f})}e.group=group;function saveState(n,e){s.issueCommand("save-state",{name:n},e)}e.saveState=saveState;function getState(n){return process.env[`STATE_${n}`]||""}e.getState=getState},90:function(n,e,f){"use strict";var r=f(205);function resolveJavascriptRegExp(n){if(n===null)return false;if(n.length===0)return false;var e=n,f=/\/([gim]*)$/.exec(n),r="";if(e[0]==="/"){if(f)r=f[1];if(r.length>3)return false;if(e[e.length-r.length-1]!=="/")return false}return true}function constructJavascriptRegExp(n){var e=n,f=/\/([gim]*)$/.exec(n),r="";if(e[0]==="/"){if(f)r=f[1];e=e.slice(1,e.length-r.length-1)}return new RegExp(e,r)}function representJavascriptRegExp(n){var e="/"+n.source+"/";if(n.global)e+="g";if(n.multiline)e+="m";ifLine truncated
module.exports=function(n,e){"use strict";var f={};function __webpack_require__(e){if(f[e]){return f[e].exports}var r=f[e]={i:e,l:false,exports:{}};n[e].call(r.exports,r,r.exports,__webpack_require__);r.l=true;return r.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(803)}return startup()}({0:function(n,e){"use strict";Object.defineProperty(e,"__esModule",{value:true});e.ref="301414cec74a2b6b63c95b42f2ad1790ccb980ed";e.url=`https://raw.githubusercontent.com/pnpm/self-installer/${e.ref}/install.js`;e.default=e.url},17:function(n){"use strict";n.exports=function generate__limitItems(n,e,f){var r=" ";var l=n.level;var s=n.dataLevel;var v=n.schema[e];var c=n.schemaPath+n.util.getProperty(e);var p=n.errSchemaPath+"/"+e;var g=!n.opts.allErrors;var b;var w="data"+(s||"");var i=n.opts.$data&&v&&v.$data,d;if(i){r+=" var schema"+l+" = "+n.util.getData(v.$data,s,n.dataPathArr)+"; ";d="schema"+l}else{d=v}var A=e=="maxItems"?">":"<";r+="if ( ";if(i){r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "}r+=" "+w+".length "+A+" "+d+") { ";var b=e;var j=j||[];j.push(r);r="";if(n.createErrors!==false){r+=" { keyword: '"+(b||"_limitItems")+"' , dataPath: (dataPath || '') + "+n.errorPath+" , schemaPath: "+n.util.toQuotedString(p)+" , params: { limit: "+d+" } ";if(n.opts.messages!==false){r+=" , message: 'should NOT have ";if(e=="maxItems"){r+="more"}else{r+="fewer"}r+=" than ";if(i){r+="' + "+d+" + '"}else{r+=""+v}r+=" items' "}if(n.opts.verbose){r+=" , schema: ";if(i){r+="validate.schema"+c}else{r+=""+v}r+=" , parentSchema: validate.schema"+n.schemaPath+" , data: "+w+" "}r+=" } "}else{r+=" {} "}var E=r;r=j.pop();if(!n.compositeRule&&g){if(n.async){r+=" throw new ValidationError(["+E+"]); "}else{r+=" validate.errors = ["+E+"]; return false; "}}else{r+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}r+="} ";if(g){r+=" else { "}return r}},34:function(n){n.exports=require("https")},87:function(n){n.exports=require("os")},89:function(n,e,f){"use strict";var r=this&&this.__awaiter||function(n,e,f,r){function adopt(n){return n instanceof f?n:new f(function(e){e(n)})}return new(f||(f=Promise))(function(f,l){function fulfilled(n){try{step(r.next(n))}catch(n){l(n)}}function rejected(n){try{step(r["throw"](n))}catch(n){l(n)}}function step(n){n.done?f(n.value):adopt(n.value).then(fulfilled,rejected)}step((r=r.apply(n,e||[])).next())})};var l=this&&this.__importStar||function(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var f in n)if(Object.hasOwnProperty.call(n,f))e[f]=n[f];e["default"]=n;return e};Object.defineProperty(e,"__esModule",{value:true});const s=f(486);const v=l(f(87));const c=l(f(622));var p;(function(n){n[n["Success"]=0]="Success";n[n["Failure"]=1]="Failure"})(p=e.ExitCode||(e.ExitCode={}));function exportVariable(n,e){const f=s.toCommandValue(e);process.env[n]=f;s.issueCommand("set-env",{name:n},f)}e.exportVariable=exportVariable;function setSecret(n){s.issueCommand("add-mask",{},n)}e.setSecret=setSecret;function addPath(n){s.issueCommand("add-path",{},n);process.env["PATH"]=`${n}${c.delimiter}${process.env["PATH"]}`}e.addPath=addPath;function getInput(n,e){const f=process.env[`INPUT_${n.replace(/ /g,"_").toUpperCase()}`]||"";if(e&&e.required&&!f){throw new Error(`Input required and not supplied: ${n}`)}return f.trim()}e.getInput=getInput;function setOutput(n,e){s.issueCommand("set-output",{name:n},e)}e.setOutput=setOutput;function setCommandEcho(n){s.issue("echo",n?"on":"off")}e.setCommandEcho=setCommandEcho;function setFailed(n){process.exitCode=p.Failure;error(n)}e.setFailed=setFailed;function isDebug(){return process.env["RUNNER_DEBUG"]==="1"}e.isDebug=isDebug;function debug(n){s.issueCommand("debug",{},n)}e.debug=debug;function error(n){s.issue("error",n instanceof Error?n.toString():n)}e.error=error;function warning(n){s.issue("warning",n instanceof Error?n.toString():n)}e.warning=warning;function info(n){process.stdout.write(n+v.EOL)}e.info=info;function startGroup(n){s.issue("group",n)}e.startGroup=startGroup;function endGroup(){s.issue("endgroup")}e.endGroup=endGroup;function group(n,e){return r(this,void 0,void 0,function*(){startGroup(n);let f;try{f=yield e()}finally{endGroup()}return f})}e.group=group;function saveState(n,e){s.issueCommand("save-state",{name:n},e)}e.saveState=saveState;function getState(n){return process.env[`STATE_${n}`]||""}e.getState=getState},90:function(n,e,f){"use strict";var r=f(205);function resolveJavascriptRegExp(n){if(n===null)return false;if(n.length===0)return false;var e=n,f=/\/([gim]*)$/.exec(n),r="";if(e[0]==="/"){if(f)r=f[1];if(r.length>3)return false;if(e[e.length-r.length-1]!=="/")return false}return true}function constructJavascriptRegExp(n){var e=n,f=/\/([gim]*)$/.exec(n),r="";if(e[0]==="/"){if(f)r=f[1];e=e.slice(1,e.length-r.length-1)}return new RegExp(e,r)}function representJavascriptRegExp(n){var e="/"+n.source+"/";if(n.global)e+="g";if(n.multiline)e+="m";ifLine truncated
+4 -3
View File
@@ -3,12 +3,13 @@ import getInputs from './inputs'
import setOutputs from './outputs'
import installPnpm from './install-pnpm'
import pnpmInstall from './pnpm-install'
import pruneStore from './pnpm-store-prune'
async function main() {
const isPost = getState('is_post')
if (isPost === 'true') return
saveState('is_post', 'true')
const inputs = getInputs()
const isPost = getState('is_post')
if (isPost === 'true') return pruneStore(inputs)
saveState('is_post', 'true')
await installPnpm(inputs)
console.log('Installation Completed!')
setOutputs(inputs)
+27
View File
@@ -0,0 +1,27 @@
import { spawnSync } from 'child_process'
import { setFailed } from '@actions/core'
import { Inputs } from '../inputs'
export function pruneStore(inputs: Inputs) {
if (inputs.runInstall.length === 0) {
console.log('Pruning is unnecessary.')
return
}
console.log('Running pnpm store prune')
const { error, status } = spawnSync('pnpm', ['store', 'prune'], {
stdio: 'inherit',
})
if (error) {
setFailed(error)
return
}
if (status) {
setFailed(`command pnpm store prune exits with code ${status}`)
return
}
}
export default pruneStore