ssh-deploy/dist/index.js

2 lines
11 KiB
JavaScript
Raw Normal View History

2019-10-02 23:52:52 +02:00
#!/usr/bin/env node
2023-01-02 01:33:48 +01:00
(()=>{var e={126:(e,r,t)=>{var s=t(147);var o;if(process.platform==="win32"||global.TESTING_WINDOWS){o=t(1)}else{o=t(728)}e.exports=isexe;isexe.sync=sync;function isexe(e,r,t){if(typeof r==="function"){t=r;r={}}if(!t){if(typeof Promise!=="function"){throw new TypeError("callback not provided")}return new Promise((function(t,s){isexe(e,r||{},(function(e,r){if(e){s(e)}else{t(r)}}))}))}o(e,r||{},(function(e,s){if(e){if(e.code==="EACCES"||r&&r.ignoreErrors){e=null;s=false}}t(e,s)}))}function sync(e,r){try{return o.sync(e,r||{})}catch(e){if(r&&r.ignoreErrors||e.code==="EACCES"){return false}else{throw e}}}},728:(e,r,t)=>{e.exports=isexe;isexe.sync=sync;var s=t(147);function isexe(e,r,t){s.stat(e,(function(e,s){t(e,e?false:checkStat(s,r))}))}function sync(e,r){return checkStat(s.statSync(e),r)}function checkStat(e,r){return e.isFile()&&checkMode(e,r)}function checkMode(e,r){var t=e.mode;var s=e.uid;var o=e.gid;var n=r.uid!==undefined?r.uid:process.getuid&&process.getuid();var c=r.gid!==undefined?r.gid:process.getgid&&process.getgid();var i=parseInt("100",8);var a=parseInt("010",8);var u=parseInt("001",8);var l=i|a;var d=t&u||t&a&&o===c||t&i&&s===n||t&l&&n===0;return d}},1:(e,r,t)=>{e.exports=isexe;isexe.sync=sync;var s=t(147);function checkPathExt(e,r){var t=r.pathExt!==undefined?r.pathExt:process.env.PATHEXT;if(!t){return true}t=t.split(";");if(t.indexOf("")!==-1){return true}for(var s=0;s<t.length;s++){var o=t[s].toLowerCase();if(o&&e.substr(-o.length).toLowerCase()===o){return true}}return false}function checkStat(e,r,t){if(!e.isSymbolicLink()&&!e.isFile()){return false}return checkPathExt(r,t)}function isexe(e,r,t){s.stat(e,(function(s,o){t(s,s?false:checkStat(o,e,r))}))}function sync(e,r){return checkStat(s.statSync(e),e,r)}},898:(e,r,t)=>{"use strict";var s=t(81).spawn;var o=t(837);var escapeSpaces=function(e){if(typeof e==="string"){return e.replace(/\b\s/g,"\\ ")}else{return e}};var escapeSpacesInOptions=function(e){["src","dest","include","exclude","excludeFirst"].forEach((function(r){var t=e[r];if(typeof t==="string"){e[r]=escapeSpaces(t)}else if(Array.isArray(t)===true){e[r]=t.map(escapeSpaces)}}));return e};e.exports=function(e,r){e=e||{};e=o._extend({},e);e=escapeSpacesInOptions(e);var t=e.platform||process.platform;var n=t==="win32";if(typeof e.src==="undefined"){throw new Error("'src' directory is missing from options")}if(typeof e.dest==="undefined"){throw new Error("'dest' directory is missing from options")}var c=e.dest;if(typeof e.host!=="undefined"){c=e.host+":"+e.dest}if(!Array.isArray(e.src)){e.src=[e.src]}var i=[].concat(e.src);i.push(c);var a=(e.args||[]).find((function(e){return e.match(/--chmod=/)}));if(n&&!a){i.push("--chmod=ugo=rwX")}if(typeof e.host!=="undefined"||e.ssh){i.push("--rsh");var u="ssh";if(typeof e.port!=="undefined"){u+=" -p "+e.port}if(typeof e.privateKey!=="undefined"){u+=" -i "+e.privateKey}if(typeof e.sshCmdArgs!=="undefined"){u+=" "+e.sshCmdArgs.join(" ")}i.push(u)}if(e.recursive===true){i.push("--recursive")}if(e.times===true){i.push("--times")}if(e.syncDest===true||e.deleteAll===true){i.push("--delete");i.push("--delete-excluded")}if(e.syncDestIgnoreExcl===true||e.delete===true){i.push("--delete")}if(e.dryRun===true){i.push("--dry-run");i.push("--verbose")}if(typeof e.excludeFirst!=="undefined"&&o.isArray(e.excludeFirst)){e.excludeFirst.forEach((function(e,r){i.push("--exclude="+e)}))}if(typeof e.include!=="undefined"&&o.isArray(e.include)){e.include.forEach((function(e,r){i.push("--include="+e)}))}if(typeof e.exclude!=="undefined"&&o.isArray(e.exclude)){e.exclude.forEach((function(e,r){i.push("--exclude="+e)}))}switch(e.compareMode){case"sizeOnly":i.push("--size-only");break;case"checksum":i.push("--checksum");break}if(typeof e.args!=="undefined"&&o.isArray(e.args)){i=[...new Set([...i,...e.args])]}i=[...new Set(i)];var noop=function(){};var l=e.onStdout||noop;var d=e.onStderr||noop;var f="rsync ";i.forEach((function(e){if(e.substr(0,4)==="ssh "){e='"'+e+'"'}f+=e+" "}));f=f.trim();if(e.noExec){r(null,null,null,f);return}try{var p="";var h="";var y;if(n){y=s("cmd.exe",["/s","/c