diff --git a/dist/index.js b/dist/index.js index 1649cbf..fec7245 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5,7 +5,7 @@ GFS4: `),console.error(e)});q[te]||(io=global[te]||[],oo(q,io),q.close=function( see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:s,destStat:n}=nr.checkPathsSync(e,r,"copy",t);return nr.checkParentPathsSync(e,s,r,"copy"),_p(n,e,r,t)}function _p(e,r,t,s){if(s.filter&&!s.filter(r,t))return;let n=sr.dirname(t);return x.existsSync(n)||Tp(n),wo(e,r,t,s)}function vp(e,r,t,s){if(!(s.filter&&!s.filter(r,t)))return wo(e,r,t,s)}function wo(e,r,t,s){let o=(s.dereference?x.statSync:x.lstatSync)(r);if(o.isDirectory())return Rp(o,e,r,t,s);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return Sp(o,e,r,t,s);if(o.isSymbolicLink())return Cp(e,r,t,s);throw o.isSocket()?new Error(`Cannot copy a socket file: ${r}`):o.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${r}`):new Error(`Unknown file: ${r}`)}function Sp(e,r,t,s,n){return r?Pp(e,t,s,n):bo(e,t,s,n)}function Pp(e,r,t,s){if(s.overwrite)return x.unlinkSync(t),bo(e,r,t,s);if(s.errorOnExist)throw new Error(`'${t}' already exists`)}function bo(e,r,t,s){return x.copyFileSync(r,t),s.preserveTimestamps&&Op(e.mode,r,t),Dt(t,e.mode)}function Op(e,r,t){return kp(e)&&Gp(t,e),Ap(r,t)}function kp(e){return(e&128)==0}function Gp(e,r){return Dt(e,r|128)}function Dt(e,r){return x.chmodSync(e,r)}function Ap(e,r){let t=x.statSync(e);return wp(r,t.atime,t.mtime)}function Rp(e,r,t,s,n){return r?_o(t,s,n):qp(e.mode,t,s,n)}function qp(e,r,t,s){return x.mkdirSync(t),_o(r,t,s),Dt(t,e)}function _o(e,r,t){x.readdirSync(e).forEach(s=>Fp(s,e,r,t))}function Fp(e,r,t,s){let n=sr.join(r,e),o=sr.join(t,e),{destStat:i}=nr.checkPathsSync(n,o,"copy",s);return vp(i,n,o,s)}function Cp(e,r,t,s){let n=x.readlinkSync(r);if(s.dereference&&(n=sr.resolve(process.cwd(),n)),e){let o;try{o=x.readlinkSync(t)}catch(i){if(i.code==="EINVAL"||i.code==="UNKNOWN")return x.symlinkSync(n,t);throw i}if(s.dereference&&(o=sr.resolve(process.cwd(),o)),nr.isSrcSubdir(n,o))throw new Error(`Cannot copy '${n}' to a subdirectory of itself, '${o}'.`);if(x.statSync(t).isDirectory()&&nr.isSrcSubdir(o,n))throw new Error(`Cannot overwrite '${o}' with '${n}'.`);return xp(n,t)}else return x.symlinkSync(n,t)}function xp(e,r){return x.unlinkSync(r),x.symlinkSync(e,r)}vo.exports=bp});var Lt=f((Qd,Po)=>{"use strict";Po.exports={copySync:So()}});var we=f((eg,ko)=>{"use strict";var Up=$().fromPromise,Oo=Ge();function jp(e){return Oo.access(e).then(()=>!0).catch(()=>!1)}ko.exports={pathExists:Up(jp),pathExistsSync:Oo.existsSync}});var Uo=f((rg,xo)=>{"use strict";var M=L(),or=require("path"),Dp=se().mkdirs,Lp=we().pathExists,Np=Ut().utimesMillis,ir=Ae();function Ip(e,r,t,s){typeof t=="function"&&!s?(s=t,t={}):typeof t=="function"&&(t={filter:t}),s=s||function(){},t=t||{},t.clobber="clobber"in t?!!t.clobber:!0,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended; see https://github.com/jprichardson/node-fs-extra/issues/269`),ir.checkPaths(e,r,"copy",t,(n,o)=>{if(n)return s(n);let{srcStat:i,destStat:a}=o;ir.checkParentPaths(e,i,r,"copy",c=>c?s(c):t.filter?Ao(Go,a,e,r,t,s):Go(a,e,r,t,s))})}function Go(e,r,t,s,n){let o=or.dirname(t);Lp(o,(i,a)=>{if(i)return n(i);if(a)return Rr(e,r,t,s,n);Dp(o,c=>c?n(c):Rr(e,r,t,s,n))})}function Ao(e,r,t,s,n,o){Promise.resolve(n.filter(t,s)).then(i=>i?e(r,t,s,n,o):o(),i=>o(i))}function Bp(e,r,t,s,n){return s.filter?Ao(Rr,e,r,t,s,n):Rr(e,r,t,s,n)}function Rr(e,r,t,s,n){(s.dereference?M.stat:M.lstat)(r,(i,a)=>i?n(i):a.isDirectory()?Jp(a,e,r,t,s,n):a.isFile()||a.isCharacterDevice()||a.isBlockDevice()?$p(a,e,r,t,s,n):a.isSymbolicLink()?Xp(e,r,t,s,n):a.isSocket()?n(new Error(`Cannot copy a socket file: ${r}`)):a.isFIFO()?n(new Error(`Cannot copy a FIFO pipe: ${r}`)):n(new Error(`Unknown file: ${r}`)))}function $p(e,r,t,s,n,o){return r?Mp(e,t,s,n,o):Ro(e,t,s,n,o)}function Mp(e,r,t,s,n){if(s.overwrite)M.unlink(t,o=>o?n(o):Ro(e,r,t,s,n));else return s.errorOnExist?n(new Error(`'${t}' already exists`)):n()}function Ro(e,r,t,s,n){M.copyFile(r,t,o=>o?n(o):s.preserveTimestamps?Hp(e.mode,r,t,n):qr(t,e.mode,n))}function Hp(e,r,t,s){return zp(e)?Wp(t,e,n=>n?s(n):qo(e,r,t,s)):qo(e,r,t,s)}function zp(e){return(e&128)==0}function Wp(e,r,t){return qr(e,r|128,t)}function qo(e,r,t,s){Vp(r,t,n=>n?s(n):qr(t,e,s))}function qr(e,r,t){return M.chmod(e,r,t)}function Vp(e,r,t){M.stat(e,(s,n)=>s?t(s):Np(r,n.atime,n.mtime,t))}function Jp(e,r,t,s,n,o){return r?Fo(t,s,n,o):Kp(e.mode,t,s,n,o)}function Kp(e,r,t,s,n){M.mkdir(t,o=>{if(o)return n(o);Fo(r,t,s,i=>i?n(i):qr(t,e,n))})}function Fo(e,r,t,s){M.readdir(e,(n,o)=>n?s(n):Co(o,e,r,t,s))}function Co(e,r,t,s,n){let o=e.pop();return o?Yp(e,o,r,t,s,n):n()}function Yp(e,r,t,s,n,o){let i=or.join(t,r),a=or.join(s,r);ir.checkPaths(i,a,"copy",n,(c,l)=>{if(c)return o(c);let{destStat:u}=l;Bp(u,i,a,n,p=>p?o(p):Co(e,t,s,n,o))})}function Xp(e,r,t,s,n){M.readlink(r,(o,i)=>{if(o)return n(o);if(s.dereference&&(i=or.resolve(process.cwd(),i)),e)M.readlink(t,(a,c)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?M.symlink(i,t,n):n(a):(s.dereference&&(c=or.resolve(process.cwd(),c)),ir.isSrcSubdir(i,c)?n(new Error(`Cannot copy '${i}' to a subdirectory of itself, '${c}'.`)):e.isDirectory()&&ir.isSrcSubdir(c,i)?n(new Error(`Cannot overwrite '${c}' with '${i}'.`)):Zp(i,t,n)));else return M.symlink(i,t,n)})}function Zp(e,r,t){M.unlink(r,s=>s?t(s):M.symlink(e,r,t))}xo.exports=Ip});var Nt=f((tg,jo)=>{"use strict";var Qp=$().fromCallback;jo.exports={copy:Qp(Uo())}});var zo=f((sg,Ho)=>{"use strict";var Do=L(),Lo=require("path"),_=require("assert"),ar=process.platform==="win32";function No(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(t=>{e[t]=e[t]||Do[t],t=t+"Sync",e[t]=e[t]||Do[t]}),e.maxBusyTries=e.maxBusyTries||3}function It(e,r,t){let s=0;typeof r=="function"&&(t=r,r={}),_(e,"rimraf: missing path"),_.strictEqual(typeof e,"string","rimraf: path should be a string"),_.strictEqual(typeof t,"function","rimraf: callback function required"),_(r,"rimraf: invalid options argument provided"),_.strictEqual(typeof r,"object","rimraf: options should be object"),No(r),Io(e,r,function n(o){if(o){if((o.code==="EBUSY"||o.code==="ENOTEMPTY"||o.code==="EPERM")&&sIo(e,r,n),i)}o.code==="ENOENT"&&(o=null)}t(o)})}function Io(e,r,t){_(e),_(r),_(typeof t=="function"),r.lstat(e,(s,n)=>{if(s&&s.code==="ENOENT")return t(null);if(s&&s.code==="EPERM"&&ar)return Bo(e,r,s,t);if(n&&n.isDirectory())return Fr(e,r,s,t);r.unlink(e,o=>{if(o){if(o.code==="ENOENT")return t(null);if(o.code==="EPERM")return ar?Bo(e,r,o,t):Fr(e,r,o,t);if(o.code==="EISDIR")return Fr(e,r,o,t)}return t(o)})})}function Bo(e,r,t,s){_(e),_(r),_(typeof s=="function"),r.chmod(e,438,n=>{n?s(n.code==="ENOENT"?null:t):r.stat(e,(o,i)=>{o?s(o.code==="ENOENT"?null:t):i.isDirectory()?Fr(e,r,t,s):r.unlink(e,s)})})}function $o(e,r,t){let s;_(e),_(r);try{r.chmodSync(e,438)}catch(n){if(n.code==="ENOENT")return;throw t}try{s=r.statSync(e)}catch(n){if(n.code==="ENOENT")return;throw t}s.isDirectory()?Cr(e,r,t):r.unlinkSync(e)}function Fr(e,r,t,s){_(e),_(r),_(typeof s=="function"),r.rmdir(e,n=>{n&&(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")?ef(e,r,s):n&&n.code==="ENOTDIR"?s(t):s(n)})}function ef(e,r,t){_(e),_(r),_(typeof t=="function"),r.readdir(e,(s,n)=>{if(s)return t(s);let o=n.length,i;if(o===0)return r.rmdir(e,t);n.forEach(a=>{It(Lo.join(e,a),r,c=>{if(!i){if(c)return t(i=c);--o==0&&r.rmdir(e,t)}})})})}function Mo(e,r){let t;r=r||{},No(r),_(e,"rimraf: missing path"),_.strictEqual(typeof e,"string","rimraf: path should be a string"),_(r,"rimraf: missing options"),_.strictEqual(typeof r,"object","rimraf: options should be object");try{t=r.lstatSync(e)}catch(s){if(s.code==="ENOENT")return;s.code==="EPERM"&&ar&&$o(e,r,s)}try{t&&t.isDirectory()?Cr(e,r,null):r.unlinkSync(e)}catch(s){if(s.code==="ENOENT")return;if(s.code==="EPERM")return ar?$o(e,r,s):Cr(e,r,s);if(s.code!=="EISDIR")throw s;Cr(e,r,s)}}function Cr(e,r,t){_(e),_(r);try{r.rmdirSync(e)}catch(s){if(s.code==="ENOTDIR")throw t;if(s.code==="ENOTEMPTY"||s.code==="EEXIST"||s.code==="EPERM")rf(e,r);else if(s.code!=="ENOENT")throw s}}function rf(e,r){if(_(e),_(r),r.readdirSync(e).forEach(t=>Mo(Lo.join(e,t),r)),ar){let t=Date.now();do try{return r.rmdirSync(e,r)}catch{}while(Date.now()-t<500)}else return r.rmdirSync(e,r)}Ho.exports=It;It.sync=Mo});var cr=f((ng,Vo)=>{"use strict";var xr=L(),tf=$().fromCallback,Wo=zo();function sf(e,r){if(xr.rm)return xr.rm(e,{recursive:!0,force:!0},r);Wo(e,r)}function nf(e){if(xr.rmSync)return xr.rmSync(e,{recursive:!0,force:!0});Wo.sync(e)}Vo.exports={remove:tf(sf),removeSync:nf}});var ri=f((og,ei)=>{"use strict";var of=$().fromPromise,Jo=Ge(),Ko=require("path"),Yo=se(),Xo=cr(),Zo=of(async function(r){let t;try{t=await Jo.readdir(r)}catch{return Yo.mkdirs(r)}return Promise.all(t.map(s=>Xo.remove(Ko.join(r,s))))});function Qo(e){let r;try{r=Jo.readdirSync(e)}catch{return Yo.mkdirsSync(e)}r.forEach(t=>{t=Ko.join(e,t),Xo.removeSync(t)})}ei.exports={emptyDirSync:Qo,emptydirSync:Qo,emptyDir:Zo,emptydir:Zo}});var oi=f((ig,ni)=>{"use strict";var af=$().fromCallback,ti=require("path"),be=L(),si=se();function cf(e,r){function t(){be.writeFile(e,"",s=>{if(s)return r(s);r()})}be.stat(e,(s,n)=>{if(!s&&n.isFile())return r();let o=ti.dirname(e);be.stat(o,(i,a)=>{if(i)return i.code==="ENOENT"?si.mkdirs(o,c=>{if(c)return r(c);t()}):r(i);a.isDirectory()?t():be.readdir(o,c=>{if(c)return r(c)})})})}function uf(e){let r;try{r=be.statSync(e)}catch{}if(r&&r.isFile())return;let t=ti.dirname(e);try{be.statSync(t).isDirectory()||be.readdirSync(t)}catch(s){if(s&&s.code==="ENOENT")si.mkdirsSync(t);else throw s}be.writeFileSync(e,"")}ni.exports={createFile:af(cf),createFileSync:uf}});var li=f((ag,ui)=>{"use strict";var lf=$().fromCallback,ii=require("path"),_e=L(),ai=se(),pf=we().pathExists,{areIdentical:ci}=Ae();function ff(e,r,t){function s(n,o){_e.link(n,o,i=>{if(i)return t(i);t(null)})}_e.lstat(r,(n,o)=>{_e.lstat(e,(i,a)=>{if(i)return i.message=i.message.replace("lstat","ensureLink"),t(i);if(o&&ci(a,o))return t(null);let c=ii.dirname(r);pf(c,(l,u)=>{if(l)return t(l);if(u)return s(e,r);ai.mkdirs(c,p=>{if(p)return t(p);s(e,r)})})})})}function mf(e,r){let t;try{t=_e.lstatSync(r)}catch{}try{let o=_e.lstatSync(e);if(t&&ci(o,t))return}catch(o){throw o.message=o.message.replace("lstat","ensureLink"),o}let s=ii.dirname(r);return _e.existsSync(s)||ai.mkdirsSync(s),_e.linkSync(e,r)}ui.exports={createLink:lf(ff),createLinkSync:mf}});var fi=f((cg,pi)=>{"use strict";var ve=require("path"),ur=L(),df=we().pathExists;function gf(e,r,t){if(ve.isAbsolute(e))return ur.lstat(e,s=>s?(s.message=s.message.replace("lstat","ensureSymlink"),t(s)):t(null,{toCwd:e,toDst:e}));{let s=ve.dirname(r),n=ve.join(s,e);return df(n,(o,i)=>o?t(o):i?t(null,{toCwd:n,toDst:e}):ur.lstat(e,a=>a?(a.message=a.message.replace("lstat","ensureSymlink"),t(a)):t(null,{toCwd:e,toDst:ve.relative(s,e)})))}}function hf(e,r){let t;if(ve.isAbsolute(e)){if(t=ur.existsSync(e),!t)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}else{let s=ve.dirname(r),n=ve.join(s,e);if(t=ur.existsSync(n),t)return{toCwd:n,toDst:e};if(t=ur.existsSync(e),!t)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:ve.relative(s,e)}}}pi.exports={symlinkPaths:gf,symlinkPathsSync:hf}});var gi=f((ug,di)=>{"use strict";var mi=L();function yf(e,r,t){if(t=typeof r=="function"?r:t,r=typeof r=="function"?!1:r,r)return t(null,r);mi.lstat(e,(s,n)=>{if(s)return t(null,"file");r=n&&n.isDirectory()?"dir":"file",t(null,r)})}function Ef(e,r){let t;if(r)return r;try{t=mi.lstatSync(e)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}di.exports={symlinkType:yf,symlinkTypeSync:Ef}});var vi=f((lg,_i)=>{"use strict";var Tf=$().fromCallback,hi=require("path"),ne=Ge(),yi=se(),wf=yi.mkdirs,bf=yi.mkdirsSync,Ei=fi(),_f=Ei.symlinkPaths,vf=Ei.symlinkPathsSync,Ti=gi(),Sf=Ti.symlinkType,Pf=Ti.symlinkTypeSync,Of=we().pathExists,{areIdentical:wi}=Ae();function kf(e,r,t,s){s=typeof t=="function"?t:s,t=typeof t=="function"?!1:t,ne.lstat(r,(n,o)=>{!n&&o.isSymbolicLink()?Promise.all([ne.stat(e),ne.stat(r)]).then(([i,a])=>{if(wi(i,a))return s(null);bi(e,r,t,s)}):bi(e,r,t,s)})}function bi(e,r,t,s){_f(e,r,(n,o)=>{if(n)return s(n);e=o.toDst,Sf(o.toCwd,t,(i,a)=>{if(i)return s(i);let c=hi.dirname(r);Of(c,(l,u)=>{if(l)return s(l);if(u)return ne.symlink(e,r,a,s);wf(c,p=>{if(p)return s(p);ne.symlink(e,r,a,s)})})})})}function Gf(e,r,t){let s;try{s=ne.lstatSync(r)}catch{}if(s&&s.isSymbolicLink()){let a=ne.statSync(e),c=ne.statSync(r);if(wi(a,c))return}let n=vf(e,r);e=n.toDst,t=Pf(n.toCwd,t);let o=hi.dirname(r);return ne.existsSync(o)||bf(o),ne.symlinkSync(e,r,t)}_i.exports={createSymlink:Tf(kf),createSymlinkSync:Gf}});var Pi=f((pg,Si)=>{"use strict";var Ur=oi(),jr=li(),Dr=vi();Si.exports={createFile:Ur.createFile,createFileSync:Ur.createFileSync,ensureFile:Ur.createFile,ensureFileSync:Ur.createFileSync,createLink:jr.createLink,createLinkSync:jr.createLinkSync,ensureLink:jr.createLink,ensureLinkSync:jr.createLinkSync,createSymlink:Dr.createSymlink,createSymlinkSync:Dr.createSymlinkSync,ensureSymlink:Dr.createSymlink,ensureSymlinkSync:Dr.createSymlinkSync}});var Lr=f((fg,Oi)=>{function Af(e,{EOL:r=` -`,finalEOL:t=!0,replacer:s=null,spaces:n}={}){let o=t?r:"";return JSON.stringify(e,s,n).replace(/\n/g,r)+o}function Rf(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}Oi.exports={stringify:Af,stripBom:Rf}});var Ri=f((mg,Ai)=>{var $e;try{$e=L()}catch(e){$e=require("fs")}var Nr=$(),{stringify:ki,stripBom:Gi}=Lr();async function qf(e,r={}){typeof r=="string"&&(r={encoding:r});let t=r.fs||$e,s="throws"in r?r.throws:!0,n=await Nr.fromCallback(t.readFile)(e,r);n=Gi(n);let o;try{o=JSON.parse(n,r?r.reviver:null)}catch(i){if(s)throw i.message=`${e}: ${i.message}`,i;return null}return o}var Ff=Nr.fromPromise(qf);function Cf(e,r={}){typeof r=="string"&&(r={encoding:r});let t=r.fs||$e,s="throws"in r?r.throws:!0;try{let n=t.readFileSync(e,r);return n=Gi(n),JSON.parse(n,r.reviver)}catch(n){if(s)throw n.message=`${e}: ${n.message}`,n;return null}}async function xf(e,r,t={}){let s=t.fs||$e,n=ki(r,t);await Nr.fromCallback(s.writeFile)(e,n,t)}var Uf=Nr.fromPromise(xf);function jf(e,r,t={}){let s=t.fs||$e,n=ki(r,t);return s.writeFileSync(e,n,t)}var Df={readFile:Ff,readFileSync:Cf,writeFile:Uf,writeFileSync:jf};Ai.exports=Df});var Fi=f((dg,qi)=>{"use strict";var Ir=Ri();qi.exports={readJson:Ir.readFile,readJsonSync:Ir.readFileSync,writeJson:Ir.writeFile,writeJsonSync:Ir.writeFileSync}});var Br=f((gg,Ui)=>{"use strict";var Lf=$().fromCallback,lr=L(),Ci=require("path"),xi=se(),Nf=we().pathExists;function If(e,r,t,s){typeof t=="function"&&(s=t,t="utf8");let n=Ci.dirname(e);Nf(n,(o,i)=>{if(o)return s(o);if(i)return lr.writeFile(e,r,t,s);xi.mkdirs(n,a=>{if(a)return s(a);lr.writeFile(e,r,t,s)})})}function Bf(e,...r){let t=Ci.dirname(e);if(lr.existsSync(t))return lr.writeFileSync(e,...r);xi.mkdirsSync(t),lr.writeFileSync(e,...r)}Ui.exports={outputFile:Lf(If),outputFileSync:Bf}});var Di=f((hg,ji)=>{"use strict";var{stringify:$f}=Lr(),{outputFile:Mf}=Br();async function Hf(e,r,t={}){let s=$f(r,t);await Mf(e,s,t)}ji.exports=Hf});var Ni=f((yg,Li)=>{"use strict";var{stringify:zf}=Lr(),{outputFileSync:Wf}=Br();function Vf(e,r,t){let s=zf(r,t);Wf(e,s,t)}Li.exports=Vf});var Bi=f((Eg,Ii)=>{"use strict";var Jf=$().fromPromise,N=Fi();N.outputJson=Jf(Di());N.outputJsonSync=Ni();N.outputJSON=N.outputJson;N.outputJSONSync=N.outputJsonSync;N.writeJSON=N.writeJson;N.writeJSONSync=N.writeJsonSync;N.readJSON=N.readJson;N.readJSONSync=N.readJsonSync;Ii.exports=N});var Wi=f((Tg,zi)=>{"use strict";var $i=L(),Bt=require("path"),Kf=Lt().copySync,Mi=cr().removeSync,Yf=se().mkdirpSync,Hi=Ae();function Xf(e,r,t){t=t||{};let s=t.overwrite||t.clobber||!1,{srcStat:n,isChangingCase:o=!1}=Hi.checkPathsSync(e,r,"move",t);return Hi.checkParentPathsSync(e,n,r,"move"),Zf(r)||Yf(Bt.dirname(r)),Qf(e,r,s,o)}function Zf(e){let r=Bt.dirname(e);return Bt.parse(r).root===r}function Qf(e,r,t,s){if(s)return $t(e,r,t);if(t)return Mi(r),$t(e,r,t);if($i.existsSync(r))throw new Error("dest already exists.");return $t(e,r,t)}function $t(e,r,t){try{$i.renameSync(e,r)}catch(s){if(s.code!=="EXDEV")throw s;return em(e,r,t)}}function em(e,r,t){return Kf(e,r,{overwrite:t,errorOnExist:!0}),Mi(e)}zi.exports=Xf});var Ji=f((wg,Vi)=>{"use strict";Vi.exports={moveSync:Wi()}});var Qi=f((bg,Zi)=>{"use strict";var rm=L(),Mt=require("path"),tm=Nt().copy,Ki=cr().remove,sm=se().mkdirp,nm=we().pathExists,Yi=Ae();function om(e,r,t,s){typeof t=="function"&&(s=t,t={});let n=t.overwrite||t.clobber||!1;Yi.checkPaths(e,r,"move",t,(o,i)=>{if(o)return s(o);let{srcStat:a,isChangingCase:c=!1}=i;Yi.checkParentPaths(e,a,r,"move",l=>{if(l)return s(l);if(im(r))return Xi(e,r,n,c,s);sm(Mt.dirname(r),u=>u?s(u):Xi(e,r,n,c,s))})})}function im(e){let r=Mt.dirname(e);return Mt.parse(r).root===r}function Xi(e,r,t,s,n){if(s)return Ht(e,r,t,n);if(t)return Ki(r,o=>o?n(o):Ht(e,r,t,n));nm(r,(o,i)=>o?n(o):i?n(new Error("dest already exists.")):Ht(e,r,t,n))}function Ht(e,r,t,s){rm.rename(e,r,n=>n?n.code!=="EXDEV"?s(n):am(e,r,t,s):s())}function am(e,r,t,s){tm(e,r,{overwrite:t,errorOnExist:!0},o=>o?s(o):Ki(e,s))}Zi.exports=om});var ra=f((_g,ea)=>{"use strict";var cm=$().fromCallback;ea.exports={move:cm(Qi())}});var sa=f((vg,ta)=>{"use strict";ta.exports=O(O(O(O(O(O(O(O(O(O(O(O({},Ge()),Lt()),Nt()),ri()),Pi()),Bi()),se()),Ji()),ra()),Br()),we()),cr())});var ca=f((Sg,aa)=>{aa.exports=ia;ia.sync=lm;var na=require("fs");function um(e,r){var t=r.pathExt!==void 0?r.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var s=0;s{fa.exports=la;la.sync=pm;var ua=require("fs");function la(e,r,t){ua.stat(e,function(s,n){t(s,s?!1:pa(n,r))})}function pm(e,r){return pa(ua.statSync(e),r)}function pa(e,r){return e.isFile()&&fm(e,r)}function fm(e,r){var t=e.mode,s=e.uid,n=e.gid,o=r.uid!==void 0?r.uid:process.getuid&&process.getuid(),i=r.gid!==void 0?r.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,p=t&l||t&c&&n===i||t&a&&s===o||t&u&&o===0;return p}});var ga=f((kg,da)=>{var Og=require("fs"),$r;process.platform==="win32"||global.TESTING_WINDOWS?$r=ca():$r=ma();da.exports=zt;zt.sync=mm;function zt(e,r,t){if(typeof r=="function"&&(t=r,r={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(s,n){zt(e,r||{},function(o,i){o?n(o):s(i)})})}$r(e,r||{},function(s,n){s&&(s.code==="EACCES"||r&&r.ignoreErrors)&&(s=null,n=!1),t(s,n)})}function mm(e,r){try{return $r.sync(e,r||{})}catch(t){if(r&&r.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var _a=f((Gg,ba)=>{var Me=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",ha=require("path"),dm=Me?";":":",ya=ga(),Ea=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Ta=(e,r)=>{let t=r.colon||dm,s=e.match(/\//)||Me&&e.match(/\\/)?[""]:[...Me?[process.cwd()]:[],...(r.path||process.env.PATH||"").split(t)],n=Me?r.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Me?n.split(t):[""];return Me&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:s,pathExt:o,pathExtExe:n}},wa=(e,r,t)=>{typeof r=="function"&&(t=r,r={}),r||(r={});let{pathEnv:s,pathExt:n,pathExtExe:o}=Ta(e,r),i=[],a=l=>new Promise((u,p)=>{if(l===s.length)return r.all&&i.length?u(i):p(Ea(e));let m=s[l],d=/^".*"$/.test(m)?m.slice(1,-1):m,g=ha.join(d,e),E=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+g:g;u(c(E,l,0))}),c=(l,u,p)=>new Promise((m,d)=>{if(p===n.length)return m(a(u+1));let g=n[p];ya(l+g,{pathExt:o},(E,y)=>{if(!E&&y)if(r.all)i.push(l+g);else return m(l+g);return m(c(l,u,p+1))})});return t?a(0).then(l=>t(null,l),t):a(0)},gm=(e,r)=>{r=r||{};let{pathEnv:t,pathExt:s,pathExtExe:n}=Ta(e,r),o=[];for(let i=0;i{"use strict";var va=(e={})=>{let r=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(r).reverse().find(s=>s.toUpperCase()==="PATH")||"Path"};Wt.exports=va;Wt.exports.default=va});var Ga=f((Rg,ka)=>{"use strict";var Pa=require("path"),hm=_a(),ym=Sa();function Oa(e,r){let t=e.options.env||process.env,s=process.cwd(),n=e.options.cwd!=null,o=n&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch(a){}let i;try{i=hm.sync(e.command,{path:t[ym({env:t})],pathExt:r?Pa.delimiter:void 0})}catch(a){}finally{o&&process.chdir(s)}return i&&(i=Pa.resolve(n?e.options.cwd:"",i)),i}function Em(e){return Oa(e)||Oa(e,!0)}ka.exports=Em});var Aa=f((qg,Jt)=>{"use strict";var Vt=/([()\][%!^"`<>&|;, *?])/g;function Tm(e){return e=e.replace(Vt,"^$1"),e}function wm(e,r){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(Vt,"^$1"),r&&(e=e.replace(Vt,"^$1")),e}Jt.exports.command=Tm;Jt.exports.argument=wm});var qa=f((Fg,Ra)=>{"use strict";Ra.exports=/^#!(.*)/});var Ca=f((Cg,Fa)=>{"use strict";var bm=qa();Fa.exports=(e="")=>{let r=e.match(bm);if(!r)return null;let[t,s]=r[0].replace(/#! ?/,"").split(" "),n=t.split("/").pop();return n==="env"?s:s?`${n} ${s}`:n}});var Ua=f((xg,xa)=>{"use strict";var Kt=require("fs"),_m=Ca();function vm(e){let r=150,t=Buffer.alloc(r),s;try{s=Kt.openSync(e,"r"),Kt.readSync(s,t,0,r,0),Kt.closeSync(s)}catch(n){}return _m(t.toString())}xa.exports=vm});var Na=f((Ug,La)=>{"use strict";var Sm=require("path"),ja=Ga(),Da=Aa(),Pm=Ua(),Om=process.platform==="win32",km=/\.(?:com|exe)$/i,Gm=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Am(e){e.file=ja(e);let r=e.file&&Pm(e.file);return r?(e.args.unshift(e.file),e.command=r,ja(e)):e.file}function Rm(e){if(!Om)return e;let r=Am(e),t=!km.test(r);if(e.options.forceShell||t){let s=Gm.test(r);e.command=Sm.normalize(e.command),e.command=Da.command(e.command),e.args=e.args.map(o=>Da.argument(o,s));let n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function qm(e,r,t){r&&!Array.isArray(r)&&(t=r,r=null),r=r?r.slice(0):[],t=Object.assign({},t);let s={command:e,args:r,options:t,file:void 0,original:{command:e,args:r}};return t.shell?s:Rm(s)}La.exports=qm});var $a=f((jg,Ba)=>{"use strict";var Yt=process.platform==="win32";function Xt(e,r){return Object.assign(new Error(`${r} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${r} ${e.command}`,path:e.command,spawnargs:e.args})}function Fm(e,r){if(!Yt)return;let t=e.emit;e.emit=function(s,n){if(s==="exit"){let o=Ia(n,r,"spawn");if(o)return t.call(e,"error",o)}return t.apply(e,arguments)}}function Ia(e,r){return Yt&&e===1&&!r.file?Xt(r.original,"spawn"):null}function Cm(e,r){return Yt&&e===1&&!r.file?Xt(r.original,"spawnSync"):null}Ba.exports={hookChildProcess:Fm,verifyENOENT:Ia,verifyENOENTSync:Cm,notFoundError:Xt}});var za=f((Dg,He)=>{"use strict";var Ma=require("child_process"),Zt=Na(),Qt=$a();function Ha(e,r,t){let s=Zt(e,r,t),n=Ma.spawn(s.command,s.args,s.options);return Qt.hookChildProcess(n,s),n}function xm(e,r,t){let s=Zt(e,r,t),n=Ma.spawnSync(s.command,s.args,s.options);return n.error=n.error||Qt.verifyENOENTSync(n.status,s),n}He.exports=Ha;He.exports.spawn=Ha;He.exports.sync=xm;He.exports._parse=Zt;He.exports._enoent=Qt});var Va=f((Lg,Wa)=>{var Um=typeof global=="object"&&global&&global.Object===Object&&global;Wa.exports=Um});var Ka=f((Ng,Ja)=>{var jm=Va(),Dm=typeof self=="object"&&self&&self.Object===Object&&self,Lm=jm||Dm||Function("return this")();Ja.exports=Lm});var es=f((Ig,Ya)=>{var Nm=Ka(),Im=Nm.Symbol;Ya.exports=Im});var ec=f((Bg,Qa)=>{var Xa=es(),Za=Object.prototype,Bm=Za.hasOwnProperty,$m=Za.toString,pr=Xa?Xa.toStringTag:void 0;function Mm(e){var r=Bm.call(e,pr),t=e[pr];try{e[pr]=void 0;var s=!0}catch(o){}var n=$m.call(e);return s&&(r?e[pr]=t:delete e[pr]),n}Qa.exports=Mm});var tc=f(($g,rc)=>{var Hm=Object.prototype,zm=Hm.toString;function Wm(e){return zm.call(e)}rc.exports=Wm});var ic=f((Mg,oc)=>{var sc=es(),Vm=ec(),Jm=tc(),Km="[object Null]",Ym="[object Undefined]",nc=sc?sc.toStringTag:void 0;function Xm(e){return e==null?e===void 0?Ym:Km:nc&&nc in Object(e)?Vm(e):Jm(e)}oc.exports=Xm});var cc=f((Hg,ac)=>{var Zm=Array.isArray;ac.exports=Zm});var lc=f((zg,uc)=>{function Qm(e){return e!=null&&typeof e=="object"}uc.exports=Qm});var fc=f((Wg,pc)=>{var ed=ic(),rd=cc(),td=lc(),sd="[object String]";function nd(e){return typeof e=="string"||!rd(e)&&td(e)&&ed(e)==sd}pc.exports=nd});var yc=Pe(as()),Ec=Pe(Yr());var V=Pe(Yr()),Mr=Pe(Xn()),mc=Pe(sa()),dc=Pe(za()),gc=Pe(fc()),fr;(function(s){s.TOKEN="token",s.OUT_DIR="out-dir",s.CLIENT_PAYLOAD="client-payload"})(fr||(fr={}));function mr(e){return dc.default.sync("git",e,{stdio:"inherit"})}async function hc(){let e=(0,V.getInput)(fr.TOKEN,{required:!0}),r=(0,V.getInput)(fr.OUT_DIR),t=(0,V.getInput)(fr.CLIENT_PAYLOAD,{required:!0}),s=(0,gc.default)(t)?JSON.parse(t):t,n=s.title,o=s.post;(!n||!o)&&(0,V.setFailed)(`Couldn't find available title or content, we got title ${n} and content ${o.slice(0,10)}`);let i=Mr.context.actor||Mr.context.repo.owner,a=Mr.context.repo.repo,c=`https://${i}:${e}@github.com/${i}/${a}.git`,l=(r.endsWith("/")?r:`${r}/`)+(/\.mdx?$/.test(n)?n:`${n}.md`);(0,V.startGroup)("Create local file"),await mc.default.outputFile(l,o),(0,V.info)(`New data is available in the ${i}/${a}/${l}`),(0,V.endGroup)(),i&&(mr(["config","user.email",`${i}@users.noreply.github.com`]),mr(["config","user.name",`"${i}"`]));let u=n.length>24?`${n.slice(0,21)}...`:n;mr(["add","."]),mr(["commit","-s","-m",`"docs: sync \`${u}\` from yuque.com"`]),mr(["push",c]),(0,V.info)("New data has been uploaded to remote git.")}(async()=>{let[,e]=await(0,yc.default)(hc());e&&(0,Ec.setFailed)(`Action failed with error ${e.message}`)})(); +`,finalEOL:t=!0,replacer:s=null,spaces:n}={}){let o=t?r:"";return JSON.stringify(e,s,n).replace(/\n/g,r)+o}function Rf(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}Oi.exports={stringify:Af,stripBom:Rf}});var Ri=f((mg,Ai)=>{var $e;try{$e=L()}catch(e){$e=require("fs")}var Nr=$(),{stringify:ki,stripBom:Gi}=Lr();async function qf(e,r={}){typeof r=="string"&&(r={encoding:r});let t=r.fs||$e,s="throws"in r?r.throws:!0,n=await Nr.fromCallback(t.readFile)(e,r);n=Gi(n);let o;try{o=JSON.parse(n,r?r.reviver:null)}catch(i){if(s)throw i.message=`${e}: ${i.message}`,i;return null}return o}var Ff=Nr.fromPromise(qf);function Cf(e,r={}){typeof r=="string"&&(r={encoding:r});let t=r.fs||$e,s="throws"in r?r.throws:!0;try{let n=t.readFileSync(e,r);return n=Gi(n),JSON.parse(n,r.reviver)}catch(n){if(s)throw n.message=`${e}: ${n.message}`,n;return null}}async function xf(e,r,t={}){let s=t.fs||$e,n=ki(r,t);await Nr.fromCallback(s.writeFile)(e,n,t)}var Uf=Nr.fromPromise(xf);function jf(e,r,t={}){let s=t.fs||$e,n=ki(r,t);return s.writeFileSync(e,n,t)}var Df={readFile:Ff,readFileSync:Cf,writeFile:Uf,writeFileSync:jf};Ai.exports=Df});var Fi=f((dg,qi)=>{"use strict";var Ir=Ri();qi.exports={readJson:Ir.readFile,readJsonSync:Ir.readFileSync,writeJson:Ir.writeFile,writeJsonSync:Ir.writeFileSync}});var Br=f((gg,Ui)=>{"use strict";var Lf=$().fromCallback,lr=L(),Ci=require("path"),xi=se(),Nf=we().pathExists;function If(e,r,t,s){typeof t=="function"&&(s=t,t="utf8");let n=Ci.dirname(e);Nf(n,(o,i)=>{if(o)return s(o);if(i)return lr.writeFile(e,r,t,s);xi.mkdirs(n,a=>{if(a)return s(a);lr.writeFile(e,r,t,s)})})}function Bf(e,...r){let t=Ci.dirname(e);if(lr.existsSync(t))return lr.writeFileSync(e,...r);xi.mkdirsSync(t),lr.writeFileSync(e,...r)}Ui.exports={outputFile:Lf(If),outputFileSync:Bf}});var Di=f((hg,ji)=>{"use strict";var{stringify:$f}=Lr(),{outputFile:Mf}=Br();async function Hf(e,r,t={}){let s=$f(r,t);await Mf(e,s,t)}ji.exports=Hf});var Ni=f((yg,Li)=>{"use strict";var{stringify:zf}=Lr(),{outputFileSync:Wf}=Br();function Vf(e,r,t){let s=zf(r,t);Wf(e,s,t)}Li.exports=Vf});var Bi=f((Eg,Ii)=>{"use strict";var Jf=$().fromPromise,N=Fi();N.outputJson=Jf(Di());N.outputJsonSync=Ni();N.outputJSON=N.outputJson;N.outputJSONSync=N.outputJsonSync;N.writeJSON=N.writeJson;N.writeJSONSync=N.writeJsonSync;N.readJSON=N.readJson;N.readJSONSync=N.readJsonSync;Ii.exports=N});var Wi=f((Tg,zi)=>{"use strict";var $i=L(),Bt=require("path"),Kf=Lt().copySync,Mi=cr().removeSync,Yf=se().mkdirpSync,Hi=Ae();function Xf(e,r,t){t=t||{};let s=t.overwrite||t.clobber||!1,{srcStat:n,isChangingCase:o=!1}=Hi.checkPathsSync(e,r,"move",t);return Hi.checkParentPathsSync(e,n,r,"move"),Zf(r)||Yf(Bt.dirname(r)),Qf(e,r,s,o)}function Zf(e){let r=Bt.dirname(e);return Bt.parse(r).root===r}function Qf(e,r,t,s){if(s)return $t(e,r,t);if(t)return Mi(r),$t(e,r,t);if($i.existsSync(r))throw new Error("dest already exists.");return $t(e,r,t)}function $t(e,r,t){try{$i.renameSync(e,r)}catch(s){if(s.code!=="EXDEV")throw s;return em(e,r,t)}}function em(e,r,t){return Kf(e,r,{overwrite:t,errorOnExist:!0}),Mi(e)}zi.exports=Xf});var Ji=f((wg,Vi)=>{"use strict";Vi.exports={moveSync:Wi()}});var Qi=f((bg,Zi)=>{"use strict";var rm=L(),Mt=require("path"),tm=Nt().copy,Ki=cr().remove,sm=se().mkdirp,nm=we().pathExists,Yi=Ae();function om(e,r,t,s){typeof t=="function"&&(s=t,t={});let n=t.overwrite||t.clobber||!1;Yi.checkPaths(e,r,"move",t,(o,i)=>{if(o)return s(o);let{srcStat:a,isChangingCase:c=!1}=i;Yi.checkParentPaths(e,a,r,"move",l=>{if(l)return s(l);if(im(r))return Xi(e,r,n,c,s);sm(Mt.dirname(r),u=>u?s(u):Xi(e,r,n,c,s))})})}function im(e){let r=Mt.dirname(e);return Mt.parse(r).root===r}function Xi(e,r,t,s,n){if(s)return Ht(e,r,t,n);if(t)return Ki(r,o=>o?n(o):Ht(e,r,t,n));nm(r,(o,i)=>o?n(o):i?n(new Error("dest already exists.")):Ht(e,r,t,n))}function Ht(e,r,t,s){rm.rename(e,r,n=>n?n.code!=="EXDEV"?s(n):am(e,r,t,s):s())}function am(e,r,t,s){tm(e,r,{overwrite:t,errorOnExist:!0},o=>o?s(o):Ki(e,s))}Zi.exports=om});var ra=f((_g,ea)=>{"use strict";var cm=$().fromCallback;ea.exports={move:cm(Qi())}});var sa=f((vg,ta)=>{"use strict";ta.exports=O(O(O(O(O(O(O(O(O(O(O(O({},Ge()),Lt()),Nt()),ri()),Pi()),Bi()),se()),Ji()),ra()),Br()),we()),cr())});var ca=f((Sg,aa)=>{aa.exports=ia;ia.sync=lm;var na=require("fs");function um(e,r){var t=r.pathExt!==void 0?r.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var s=0;s{fa.exports=la;la.sync=pm;var ua=require("fs");function la(e,r,t){ua.stat(e,function(s,n){t(s,s?!1:pa(n,r))})}function pm(e,r){return pa(ua.statSync(e),r)}function pa(e,r){return e.isFile()&&fm(e,r)}function fm(e,r){var t=e.mode,s=e.uid,n=e.gid,o=r.uid!==void 0?r.uid:process.getuid&&process.getuid(),i=r.gid!==void 0?r.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,p=t&l||t&c&&n===i||t&a&&s===o||t&u&&o===0;return p}});var ga=f((kg,da)=>{var Og=require("fs"),$r;process.platform==="win32"||global.TESTING_WINDOWS?$r=ca():$r=ma();da.exports=zt;zt.sync=mm;function zt(e,r,t){if(typeof r=="function"&&(t=r,r={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(s,n){zt(e,r||{},function(o,i){o?n(o):s(i)})})}$r(e,r||{},function(s,n){s&&(s.code==="EACCES"||r&&r.ignoreErrors)&&(s=null,n=!1),t(s,n)})}function mm(e,r){try{return $r.sync(e,r||{})}catch(t){if(r&&r.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var _a=f((Gg,ba)=>{var Me=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",ha=require("path"),dm=Me?";":":",ya=ga(),Ea=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Ta=(e,r)=>{let t=r.colon||dm,s=e.match(/\//)||Me&&e.match(/\\/)?[""]:[...Me?[process.cwd()]:[],...(r.path||process.env.PATH||"").split(t)],n=Me?r.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Me?n.split(t):[""];return Me&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:s,pathExt:o,pathExtExe:n}},wa=(e,r,t)=>{typeof r=="function"&&(t=r,r={}),r||(r={});let{pathEnv:s,pathExt:n,pathExtExe:o}=Ta(e,r),i=[],a=l=>new Promise((u,p)=>{if(l===s.length)return r.all&&i.length?u(i):p(Ea(e));let m=s[l],d=/^".*"$/.test(m)?m.slice(1,-1):m,g=ha.join(d,e),E=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+g:g;u(c(E,l,0))}),c=(l,u,p)=>new Promise((m,d)=>{if(p===n.length)return m(a(u+1));let g=n[p];ya(l+g,{pathExt:o},(E,y)=>{if(!E&&y)if(r.all)i.push(l+g);else return m(l+g);return m(c(l,u,p+1))})});return t?a(0).then(l=>t(null,l),t):a(0)},gm=(e,r)=>{r=r||{};let{pathEnv:t,pathExt:s,pathExtExe:n}=Ta(e,r),o=[];for(let i=0;i{"use strict";var va=(e={})=>{let r=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(r).reverse().find(s=>s.toUpperCase()==="PATH")||"Path"};Wt.exports=va;Wt.exports.default=va});var Ga=f((Rg,ka)=>{"use strict";var Pa=require("path"),hm=_a(),ym=Sa();function Oa(e,r){let t=e.options.env||process.env,s=process.cwd(),n=e.options.cwd!=null,o=n&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch(a){}let i;try{i=hm.sync(e.command,{path:t[ym({env:t})],pathExt:r?Pa.delimiter:void 0})}catch(a){}finally{o&&process.chdir(s)}return i&&(i=Pa.resolve(n?e.options.cwd:"",i)),i}function Em(e){return Oa(e)||Oa(e,!0)}ka.exports=Em});var Aa=f((qg,Jt)=>{"use strict";var Vt=/([()\][%!^"`<>&|;, *?])/g;function Tm(e){return e=e.replace(Vt,"^$1"),e}function wm(e,r){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(Vt,"^$1"),r&&(e=e.replace(Vt,"^$1")),e}Jt.exports.command=Tm;Jt.exports.argument=wm});var qa=f((Fg,Ra)=>{"use strict";Ra.exports=/^#!(.*)/});var Ca=f((Cg,Fa)=>{"use strict";var bm=qa();Fa.exports=(e="")=>{let r=e.match(bm);if(!r)return null;let[t,s]=r[0].replace(/#! ?/,"").split(" "),n=t.split("/").pop();return n==="env"?s:s?`${n} ${s}`:n}});var Ua=f((xg,xa)=>{"use strict";var Kt=require("fs"),_m=Ca();function vm(e){let r=150,t=Buffer.alloc(r),s;try{s=Kt.openSync(e,"r"),Kt.readSync(s,t,0,r,0),Kt.closeSync(s)}catch(n){}return _m(t.toString())}xa.exports=vm});var Na=f((Ug,La)=>{"use strict";var Sm=require("path"),ja=Ga(),Da=Aa(),Pm=Ua(),Om=process.platform==="win32",km=/\.(?:com|exe)$/i,Gm=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Am(e){e.file=ja(e);let r=e.file&&Pm(e.file);return r?(e.args.unshift(e.file),e.command=r,ja(e)):e.file}function Rm(e){if(!Om)return e;let r=Am(e),t=!km.test(r);if(e.options.forceShell||t){let s=Gm.test(r);e.command=Sm.normalize(e.command),e.command=Da.command(e.command),e.args=e.args.map(o=>Da.argument(o,s));let n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function qm(e,r,t){r&&!Array.isArray(r)&&(t=r,r=null),r=r?r.slice(0):[],t=Object.assign({},t);let s={command:e,args:r,options:t,file:void 0,original:{command:e,args:r}};return t.shell?s:Rm(s)}La.exports=qm});var $a=f((jg,Ba)=>{"use strict";var Yt=process.platform==="win32";function Xt(e,r){return Object.assign(new Error(`${r} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${r} ${e.command}`,path:e.command,spawnargs:e.args})}function Fm(e,r){if(!Yt)return;let t=e.emit;e.emit=function(s,n){if(s==="exit"){let o=Ia(n,r,"spawn");if(o)return t.call(e,"error",o)}return t.apply(e,arguments)}}function Ia(e,r){return Yt&&e===1&&!r.file?Xt(r.original,"spawn"):null}function Cm(e,r){return Yt&&e===1&&!r.file?Xt(r.original,"spawnSync"):null}Ba.exports={hookChildProcess:Fm,verifyENOENT:Ia,verifyENOENTSync:Cm,notFoundError:Xt}});var za=f((Dg,He)=>{"use strict";var Ma=require("child_process"),Zt=Na(),Qt=$a();function Ha(e,r,t){let s=Zt(e,r,t),n=Ma.spawn(s.command,s.args,s.options);return Qt.hookChildProcess(n,s),n}function xm(e,r,t){let s=Zt(e,r,t),n=Ma.spawnSync(s.command,s.args,s.options);return n.error=n.error||Qt.verifyENOENTSync(n.status,s),n}He.exports=Ha;He.exports.spawn=Ha;He.exports.sync=xm;He.exports._parse=Zt;He.exports._enoent=Qt});var Va=f((Lg,Wa)=>{var Um=typeof global=="object"&&global&&global.Object===Object&&global;Wa.exports=Um});var Ka=f((Ng,Ja)=>{var jm=Va(),Dm=typeof self=="object"&&self&&self.Object===Object&&self,Lm=jm||Dm||Function("return this")();Ja.exports=Lm});var es=f((Ig,Ya)=>{var Nm=Ka(),Im=Nm.Symbol;Ya.exports=Im});var ec=f((Bg,Qa)=>{var Xa=es(),Za=Object.prototype,Bm=Za.hasOwnProperty,$m=Za.toString,pr=Xa?Xa.toStringTag:void 0;function Mm(e){var r=Bm.call(e,pr),t=e[pr];try{e[pr]=void 0;var s=!0}catch(o){}var n=$m.call(e);return s&&(r?e[pr]=t:delete e[pr]),n}Qa.exports=Mm});var tc=f(($g,rc)=>{var Hm=Object.prototype,zm=Hm.toString;function Wm(e){return zm.call(e)}rc.exports=Wm});var ic=f((Mg,oc)=>{var sc=es(),Vm=ec(),Jm=tc(),Km="[object Null]",Ym="[object Undefined]",nc=sc?sc.toStringTag:void 0;function Xm(e){return e==null?e===void 0?Ym:Km:nc&&nc in Object(e)?Vm(e):Jm(e)}oc.exports=Xm});var cc=f((Hg,ac)=>{var Zm=Array.isArray;ac.exports=Zm});var lc=f((zg,uc)=>{function Qm(e){return e!=null&&typeof e=="object"}uc.exports=Qm});var fc=f((Wg,pc)=>{var ed=ic(),rd=cc(),td=lc(),sd="[object String]";function nd(e){return typeof e=="string"||!rd(e)&&td(e)&&ed(e)==sd}pc.exports=nd});var yc=Pe(as()),Ec=Pe(Yr());var V=Pe(Yr()),Mr=Pe(Xn()),mc=Pe(sa()),dc=Pe(za()),gc=Pe(fc()),fr;(function(s){s.TOKEN="token",s.OUT_DIR="out-dir",s.CLIENT_PAYLOAD="client-payload"})(fr||(fr={}));function mr(e){return dc.default.sync("git",e,{stdio:"inherit"})}async function hc(){let e=(0,V.getInput)(fr.TOKEN,{required:!0}),r=(0,V.getInput)(fr.OUT_DIR),t=(0,V.getInput)(fr.CLIENT_PAYLOAD,{required:!0}),s=(0,gc.default)(t)?JSON.parse(t):t,n=s.title,o=s.post;(!n||!o)&&(0,V.setFailed)(`Couldn't find available title or content, we got title ${n} and content ${o.slice(0,10)}`);let i=Mr.context.actor||Mr.context.repo.owner,a=Mr.context.repo.repo,c=`https://${i}:${e}@github.com/${i}/${a}.git`,l=(r.endsWith("/")?r:`${r}/`)+(/\.mdx?$/.test(n)?n:`${n}.md`);(0,V.startGroup)("Create local file"),await mc.default.outputFile(l,o),(0,V.info)(`New data is available in the ${i}/${a}/${l}`),(0,V.endGroup)(),i&&(mr(["config","user.email",`${i}@users.noreply.github.com`]),mr(["config","user.name",`"${i}"`]));let u=n.length>24?`${n.slice(0,21)}...`:n;mr(["add","."]),mr(["commit","-s","-m",`docs: sync \`${u}\` from yuque.com`]),mr(["push",c]),(0,V.info)("New data has been uploaded to remote git.")}(async()=>{let[,e]=await(0,yc.default)(hc());e&&(0,Ec.setFailed)(`Action failed with error ${e.message}`)})(); /*! * is-plain-object * diff --git a/src/action.ts b/src/action.ts index 335b05b..7f27f72 100644 --- a/src/action.ts +++ b/src/action.ts @@ -64,7 +64,7 @@ export async function main() { 'commit', '-s', '-m', - `"docs: sync \`${nameOnlyForLog}\` from yuque.com"` + `docs: sync \`${nameOnlyForLog}\` from yuque.com` ]) runGit(['push', remoteOrigin])