@qlover/fe-release 2.0.6 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1 -1
- package/package.json +3 -5
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
|
-
"use strict";var e=require("commander"),r=require("semver"),o=require("./index.cjs");require("@qlover/scripts-context"),require("@qlover/env-loader"),require("@qlover/fe-corekit"),require("@octokit/rest"),require("node:path"),require("fs"),require("path"),require("node:module"),require("node:url"),require("p-limit")
|
|
2
|
+
"use strict";var e=require("commander"),r=require("semver"),o=require("./index.cjs");require("@qlover/scripts-context"),require("@qlover/env-loader"),require("@qlover/fe-corekit"),require("@octokit/rest"),require("node:path"),require("fs"),require("path"),require("node:module"),require("node:url"),require("p-limit");const t=["patch","minor","major"],i=e=>e.split(",").filter((e=>null!=e&&""!=e));(async function(){const{shared:n,...a}=function(){const n=new e.Command;return n.version("2.0.10","-v, --version","Show version").description("A tool for releasing front-end projects, supporting multiple release modes and configurations, simplifying the release process and improving efficiency.").option("-d, --dry-run","Do not touch or write anything, but show the commands").option("-V, --verbose","Show more information").option("-p, --publish-path <publishPath>","The path of the package to release, map to feConfig.release.publishPath").option("-b, --branch-name <branchName>","The branch name of the release, map to feConfig.release.branchName, default(release-${pkgName}-${tagName})").option("-s, --source-branch <sourceBranch>","The source branch of the release").option("-i, --changelog.increment <increment>","The increment of the release",(e=>{if(!t.includes(e)&&!r.valid(e))throw new Error(`Invalid increment(-i) Must be one of [${t.join(", ")}] or valid version string(semver)`);return e}),"patch").option("--changelog.skip","Whether to skip the changelog").option("--changelog.skip-changeset","Whether to skip the changeset").option("--githubPR.skip","Whether to skip the githubPR").option("--packages-directories <packagesDirectories>","The packages that have been changed, multiple values use `,` to split, map to feConfig.release.packagesDirectories",i).option("--githubPR.dry-run-create-PR","Whether to dry run the creation of the pull request").option("--githubPR.push-change-labels","Whether to push the changed labels to the release PR").option("-P, --githubPR.release-PR","Create a release PR").option("-l, --workspaces.change-labels <changeLabels>","The change labels of the release, multiple values use `,` to split",i),n.parse(),o.reduceOptions(n.opts(),"shared")}(),{dryRun:s,verbose:h,...c}=n,l=Object.assign(a,{});await new o.ReleaseTask({dryRun:s,verbose:h,options:l,shared:c}).exec()})().catch((e=>{console.error(e.message),process.exit(1)}));
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
|
-
import{Command as e}from"commander";import o from"semver";import{ReleaseTask as t,reduceOptions as r}from"./index.js";import"@qlover/scripts-context";import"@qlover/env-loader";import"@qlover/fe-corekit";import"@octokit/rest";import"node:path";import"fs";import"path";import"node:module";import"node:url";import"p-limit";
|
|
2
|
+
import{Command as e}from"commander";import o from"semver";import{ReleaseTask as t,reduceOptions as r}from"./index.js";import"@qlover/scripts-context";import"@qlover/env-loader";import"@qlover/fe-corekit";import"@octokit/rest";import"node:path";import"fs";import"path";import"node:module";import"node:url";import"p-limit";const i=["patch","minor","major"],n=e=>e.split(",").filter((e=>null!=e&&""!=e));(async function(){const{shared:a,...s}=function(){const t=new e;return t.version("2.0.10","-v, --version","Show version").description("A tool for releasing front-end projects, supporting multiple release modes and configurations, simplifying the release process and improving efficiency.").option("-d, --dry-run","Do not touch or write anything, but show the commands").option("-V, --verbose","Show more information").option("-p, --publish-path <publishPath>","The path of the package to release, map to feConfig.release.publishPath").option("-b, --branch-name <branchName>","The branch name of the release, map to feConfig.release.branchName, default(release-${pkgName}-${tagName})").option("-s, --source-branch <sourceBranch>","The source branch of the release").option("-i, --changelog.increment <increment>","The increment of the release",(e=>{if(!i.includes(e)&&!o.valid(e))throw new Error(`Invalid increment(-i) Must be one of [${i.join(", ")}] or valid version string(semver)`);return e}),"patch").option("--changelog.skip","Whether to skip the changelog").option("--changelog.skip-changeset","Whether to skip the changeset").option("--githubPR.skip","Whether to skip the githubPR").option("--packages-directories <packagesDirectories>","The packages that have been changed, multiple values use `,` to split, map to feConfig.release.packagesDirectories",n).option("--githubPR.dry-run-create-PR","Whether to dry run the creation of the pull request").option("--githubPR.push-change-labels","Whether to push the changed labels to the release PR").option("-P, --githubPR.release-PR","Create a release PR").option("-l, --workspaces.change-labels <changeLabels>","The change labels of the release, multiple values use `,` to split",n),t.parse(),r(t.opts(),"shared")}(),{dryRun:h,verbose:p,...c}=a,l=Object.assign(s,{});await new t({dryRun:h,verbose:p,options:l,shared:c}).exec()})().catch((e=>{console.error(e.message),process.exit(1)}));
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t,r,n,o,i,s,a,c,u,h,l,g,f,p,d,m,v,y,b,w,x,R,_,k,P,C,$,N,j,E,O,T,B,S,A,L,U,F,W,G,q,M,I,z,H,D,V,J,K,Y,Q,X,Z,ee,te,re,ne,oe,ie,se,ae,ce,ue,he,le,ge,fe,pe,de,me,ve,ye,be,we,xe,Re,_e,ke,Pe,Ce,$e,Ne,je,Ee,Oe,Te,Be,Se,Ae,Le,Ue,Fe,We,Ge,qe,Me,Ie,ze=require("@qlover/scripts-context"),He=require("@qlover/env-loader"),De=require("@qlover/fe-corekit"),Ve=require("@octokit/rest"),Je=require("node:path"),Ke=require("fs"),Ye=require("path"),Qe=require("node:module"),Xe=require("node:url"),Ze=require("p-limit"),et=require("conventional-changelog"),tt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function rt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function nt(){if(t)return e;return t=1,e=function(){this.__data__=[],this.size=0}}function ot(){if(n)return r;return n=1,r=function(e,t){return e===t||e!=e&&t!=t}}function it(){if(i)return o;i=1;var e=ot();return o=function(t,r){for(var n=t.length;n--;)if(e(t[n][0],r))return n;return-1}}function st(){if(a)return s;a=1;var e=it(),t=Array.prototype.splice;return s=function(r){var n=this.__data__,o=e(n,r);return!(o<0)&&(o==n.length-1?n.pop():t.call(n,o,1),--this.size,!0)}}function at(){if(u)return c;u=1;var e=it();return c=function(t){var r=this.__data__,n=e(r,t);return n<0?void 0:r[n][1]}}function ct(){if(l)return h;l=1;var e=it();return h=function(t){return e(this.__data__,t)>-1}}function ut(){if(f)return g;f=1;var e=it();return g=function(t,r){var n=this.__data__,o=e(n,t);return o<0?(++this.size,n.push([t,r])):n[o][1]=r,this}}function ht(){if(d)return p;d=1;var e=nt(),t=st(),r=at(),n=ct(),o=ut();function i(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,p=i}function lt(){if(v)return m;v=1;var e=ht();return m=function(){this.__data__=new e,this.size=0}}function gt(){if(b)return y;return b=1,y=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}}function ft(){if(x)return w;return x=1,w=function(e){return this.__data__.get(e)}}function pt(){if(_)return R;return _=1,R=function(e){return this.__data__.has(e)}}function dt(){if(P)return k;P=1;var e="object"==typeof tt&&tt&&tt.Object===Object&&tt;return k=e}function mt(){if($)return C;$=1;var e=dt(),t="object"==typeof self&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return C=r}function vt(){if(j)return N;j=1;var e=mt().Symbol;return N=e}function yt(){if(O)return E;O=1;var e=vt(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,o=e?e.toStringTag:void 0;return E=function(e){var t=r.call(e,o),i=e[o];try{e[o]=void 0;var s=!0}catch(e){}var a=n.call(e);return s&&(t?e[o]=i:delete e[o]),a}}function bt(){if(B)return T;B=1;var e=Object.prototype.toString;return T=function(t){return e.call(t)}}function wt(){if(A)return S;A=1;var e=vt(),t=yt(),r=bt(),n=e?e.toStringTag:void 0;return S=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":n&&n in Object(e)?t(e):r(e)}}function xt(){if(U)return L;return U=1,L=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}}function Rt(){if(W)return F;W=1;var e=wt(),t=xt();return F=function(r){if(!t(r))return!1;var n=e(r);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}}function _t(){if(q)return G;q=1;var e=mt()["__core-js_shared__"];return G=e}function kt(){if(I)return M;I=1;var e,t=_t(),r=(e=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return M=function(e){return!!r&&r in e}}function Pt(){if(H)return z;H=1;var e=Function.prototype.toString;return z=function(t){if(null!=t){try{return e.call(t)}catch(e){}try{return t+""}catch(e){}}return""}}function Ct(){if(V)return D;V=1;var e=Rt(),t=kt(),r=xt(),n=Pt(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,s=Object.prototype,a=i.toString,c=s.hasOwnProperty,u=RegExp("^"+a.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return D=function(i){return!(!r(i)||t(i))&&(e(i)?u:o).test(n(i))}}function $t(){if(K)return J;return K=1,J=function(e,t){return null==e?void 0:e[t]}}function Nt(){if(Q)return Y;Q=1;var e=Ct(),t=$t();return Y=function(r,n){var o=t(r,n);return e(o)?o:void 0}}function jt(){if(Z)return X;Z=1;var e=Nt()(mt(),"Map");return X=e}function Et(){if(te)return ee;te=1;var e=Nt()(Object,"create");return ee=e}function Ot(){if(ne)return re;ne=1;var e=Et();return re=function(){this.__data__=e?e(null):{},this.size=0}}function Tt(){if(ie)return oe;return ie=1,oe=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}}function Bt(){if(ae)return se;ae=1;var e=Et(),t=Object.prototype.hasOwnProperty;return se=function(r){var n=this.__data__;if(e){var o=n[r];return"__lodash_hash_undefined__"===o?void 0:o}return t.call(n,r)?n[r]:void 0}}function St(){if(ue)return ce;ue=1;var e=Et(),t=Object.prototype.hasOwnProperty;return ce=function(r){var n=this.__data__;return e?void 0!==n[r]:t.call(n,r)}}function At(){if(le)return he;le=1;var e=Et();return he=function(t,r){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=e&&void 0===r?"__lodash_hash_undefined__":r,this}}function Lt(){if(fe)return ge;fe=1;var e=Ot(),t=Tt(),r=Bt(),n=St(),o=At();function i(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,ge=i}function Ut(){if(de)return pe;de=1;var e=Lt(),t=ht(),r=jt();return pe=function(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}}function Ft(){if(ve)return me;return ve=1,me=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}}function Wt(){if(be)return ye;be=1;var e=Ft();return ye=function(t,r){var n=t.__data__;return e(r)?n["string"==typeof r?"string":"hash"]:n.map}}function Gt(){if(xe)return we;xe=1;var e=Wt();return we=function(t){var r=e(this,t).delete(t);return this.size-=r?1:0,r}}function qt(){if(_e)return Re;_e=1;var e=Wt();return Re=function(t){return e(this,t).get(t)}}function Mt(){if(Pe)return ke;Pe=1;var e=Wt();return ke=function(t){return e(this,t).has(t)}}function It(){if($e)return Ce;$e=1;var e=Wt();return Ce=function(t,r){var n=e(this,t),o=n.size;return n.set(t,r),this.size+=n.size==o?0:1,this}}function zt(){if(je)return Ne;je=1;var e=Ut(),t=Gt(),r=qt(),n=Mt(),o=It();function i(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,Ne=i}function Ht(){if(Oe)return Ee;Oe=1;var e=ht(),t=jt(),r=zt();return Ee=function(n,o){var i=this.__data__;if(i instanceof e){var s=i.__data__;if(!t||s.length<199)return s.push([n,o]),this.size=++i.size,this;i=this.__data__=new r(s)}return i.set(n,o),this.size=i.size,this}}function Dt(){if(Be)return Te;Be=1;var e=ht(),t=lt(),r=gt(),n=ft(),o=pt(),i=Ht();function s(t){var r=this.__data__=new e(t);this.size=r.size}return s.prototype.clear=t,s.prototype.delete=r,s.prototype.get=n,s.prototype.has=o,s.prototype.set=i,Te=s}function Vt(){if(Ae)return Se;Ae=1;var e=Nt(),t=function(){try{var t=e(Object,"defineProperty");return t({},"",{}),t}catch(e){}}();return Se=t}function Jt(){if(Ue)return Le;Ue=1;var e=Vt();return Le=function(t,r,n){"__proto__"==r&&e?e(t,r,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[r]=n}}function Kt(){if(We)return Fe;We=1;var e=Jt(),t=ot();return Fe=function(r,n,o){(void 0!==o&&!t(r[n],o)||void 0===o&&!(n in r))&&e(r,n,o)}}function Yt(){if(qe)return Ge;return qe=1,Ge=function(e){return function(t,r,n){for(var o=-1,i=Object(t),s=n(t),a=s.length;a--;){var c=s[e?a:++o];if(!1===r(i[c],c,i))break}return t}}}function Qt(){if(Ie)return Me;Ie=1;var e=Yt()();return Me=e}var Xt,Zt,er,tr,rr,nr,or,ir,sr,ar,cr,ur,hr,lr,gr,fr,pr,dr,mr,vr,yr,br,wr,xr,Rr,_r,kr,Pr,Cr,$r,Nr,jr,Er,Or={exports:{}};function Tr(){return Xt||(Xt=1,function(e,t){var r=mt(),n=t&&!t.nodeType&&t,o=n&&e&&!e.nodeType&&e,i=o&&o.exports===n?r.Buffer:void 0,s=i?i.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var r=e.length,n=s?s(r):new e.constructor(r);return e.copy(n),n}}(Or,Or.exports)),Or.exports}function Br(){if(er)return Zt;er=1;var e=mt().Uint8Array;return Zt=e}function Sr(){if(rr)return tr;rr=1;var e=Br();return tr=function(t){var r=new t.constructor(t.byteLength);return new e(r).set(new e(t)),r}}function Ar(){if(or)return nr;or=1;var e=Sr();return nr=function(t,r){var n=r?e(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}}function Lr(){if(sr)return ir;return sr=1,ir=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}}function Ur(){if(cr)return ar;cr=1;var e=xt(),t=Object.create,r=function(){function r(){}return function(n){if(!e(n))return{};if(t)return t(n);r.prototype=n;var o=new r;return r.prototype=void 0,o}}();return ar=r}function Fr(){if(hr)return ur;return hr=1,ur=function(e,t){return function(r){return e(t(r))}}}function Wr(){if(gr)return lr;gr=1;var e=Fr()(Object.getPrototypeOf,Object);return lr=e}function Gr(){if(pr)return fr;pr=1;var e=Object.prototype;return fr=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}}function qr(){if(mr)return dr;mr=1;var e=Ur(),t=Wr(),r=Gr();return dr=function(n){return"function"!=typeof n.constructor||r(n)?{}:e(t(n))}}function Mr(){if(yr)return vr;return yr=1,vr=function(e){return null!=e&&"object"==typeof e}}function Ir(){if(wr)return br;wr=1;var e=wt(),t=Mr();return br=function(r){return t(r)&&"[object Arguments]"==e(r)}}function zr(){if(Rr)return xr;Rr=1;var e=Ir(),t=Mr(),r=Object.prototype,n=r.hasOwnProperty,o=r.propertyIsEnumerable,i=e(function(){return arguments}())?e:function(e){return t(e)&&n.call(e,"callee")&&!o.call(e,"callee")};return xr=i}function Hr(){if(kr)return _r;kr=1;var e=Array.isArray;return _r=e}function Dr(){if(Cr)return Pr;Cr=1;return Pr=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}}function Vr(){if(Nr)return $r;Nr=1;var e=Rt(),t=Dr();return $r=function(r){return null!=r&&t(r.length)&&!e(r)}}function Jr(){if(Er)return jr;Er=1;var e=Vr(),t=Mr();return jr=function(r){return t(r)&&e(r)}}var Kr,Yr,Qr,Xr,Zr,en,tn,rn,nn,on={exports:{}};function sn(){if(Yr)return Kr;return Yr=1,Kr=function(){return!1}}function an(){return Qr||(Qr=1,function(e,t){var r=mt(),n=sn(),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,s=i&&i.exports===o?r.Buffer:void 0,a=(s?s.isBuffer:void 0)||n;e.exports=a}(on,on.exports)),on.exports}function cn(){if(Zr)return Xr;Zr=1;var e=wt(),t=Wr(),r=Mr(),n=Function.prototype,o=Object.prototype,i=n.toString,s=o.hasOwnProperty,a=i.call(Object);return Xr=function(n){if(!r(n)||"[object Object]"!=e(n))return!1;var o=t(n);if(null===o)return!0;var c=s.call(o,"constructor")&&o.constructor;return"function"==typeof c&&c instanceof c&&i.call(c)==a}}function un(){if(tn)return en;tn=1;var e=wt(),t=Dr(),r=Mr(),n={};return n["[object Float32Array]"]=n["[object Float64Array]"]=n["[object Int8Array]"]=n["[object Int16Array]"]=n["[object Int32Array]"]=n["[object Uint8Array]"]=n["[object Uint8ClampedArray]"]=n["[object Uint16Array]"]=n["[object Uint32Array]"]=!0,n["[object Arguments]"]=n["[object Array]"]=n["[object ArrayBuffer]"]=n["[object Boolean]"]=n["[object DataView]"]=n["[object Date]"]=n["[object Error]"]=n["[object Function]"]=n["[object Map]"]=n["[object Number]"]=n["[object Object]"]=n["[object RegExp]"]=n["[object Set]"]=n["[object String]"]=n["[object WeakMap]"]=!1,en=function(o){return r(o)&&t(o.length)&&!!n[e(o)]}}function hn(){if(nn)return rn;return nn=1,rn=function(e){return function(t){return e(t)}}}var ln,gn,fn,pn,dn,mn,vn,yn,bn,wn,xn,Rn,_n,kn,Pn,Cn,$n,Nn,jn,En,On,Tn,Bn,Sn,An,Ln,Un,Fn,Wn,Gn,qn,Mn,In,zn,Hn,Dn,Vn,Jn,Kn,Yn,Qn,Xn,Zn,eo,to,ro,no,oo,io,so={exports:{}};function ao(){return ln||(ln=1,function(e,t){var r=dt(),n=t&&!t.nodeType&&t,o=n&&e&&!e.nodeType&&e,i=o&&o.exports===n&&r.process,s=function(){try{var e=o&&o.require&&o.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=s}(so,so.exports)),so.exports}function co(){if(fn)return gn;fn=1;var e=un(),t=hn(),r=ao(),n=r&&r.isTypedArray,o=n?t(n):e;return gn=o}function uo(){if(dn)return pn;return dn=1,pn=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}}function ho(){if(vn)return mn;vn=1;var e=Jt(),t=ot(),r=Object.prototype.hasOwnProperty;return mn=function(n,o,i){var s=n[o];r.call(n,o)&&t(s,i)&&(void 0!==i||o in n)||e(n,o,i)}}function lo(){if(bn)return yn;bn=1;var e=ho(),t=Jt();return yn=function(r,n,o,i){var s=!o;o||(o={});for(var a=-1,c=n.length;++a<c;){var u=n[a],h=i?i(o[u],r[u],u,o,r):void 0;void 0===h&&(h=r[u]),s?t(o,u,h):e(o,u,h)}return o}}function go(){if(xn)return wn;return xn=1,wn=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}}function fo(){if(_n)return Rn;_n=1;var e=/^(?:0|[1-9]\d*)$/;return Rn=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}}function po(){if(Pn)return kn;Pn=1;var e=go(),t=zr(),r=Hr(),n=an(),o=fo(),i=co(),s=Object.prototype.hasOwnProperty;return kn=function(a,c){var u=r(a),h=!u&&t(a),l=!u&&!h&&n(a),g=!u&&!h&&!l&&i(a),f=u||h||l||g,p=f?e(a.length,String):[],d=p.length;for(var m in a)!c&&!s.call(a,m)||f&&("length"==m||l&&("offset"==m||"parent"==m)||g&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||o(m,d))||p.push(m);return p}}function mo(){if($n)return Cn;return $n=1,Cn=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}}function vo(){if(jn)return Nn;jn=1;var e=xt(),t=Gr(),r=mo(),n=Object.prototype.hasOwnProperty;return Nn=function(o){if(!e(o))return r(o);var i=t(o),s=[];for(var a in o)("constructor"!=a||!i&&n.call(o,a))&&s.push(a);return s}}function yo(){if(On)return En;On=1;var e=po(),t=vo(),r=Vr();return En=function(n){return r(n)?e(n,!0):t(n)}}function bo(){if(Bn)return Tn;Bn=1;var e=lo(),t=yo();return Tn=function(r){return e(r,t(r))}}function wo(){if(An)return Sn;An=1;var e=Kt(),t=Tr(),r=Ar(),n=Lr(),o=qr(),i=zr(),s=Hr(),a=Jr(),c=an(),u=Rt(),h=xt(),l=cn(),g=co(),f=uo(),p=bo();return Sn=function(d,m,v,y,b,w,x){var R=f(d,v),_=f(m,v),k=x.get(_);if(k)e(d,v,k);else{var P=w?w(R,_,v+"",d,m,x):void 0,C=void 0===P;if(C){var $=s(_),N=!$&&c(_),j=!$&&!N&&g(_);P=_,$||N||j?s(R)?P=R:a(R)?P=n(R):N?(C=!1,P=t(_,!0)):j?(C=!1,P=r(_,!0)):P=[]:l(_)||i(_)?(P=R,i(R)?P=p(R):h(R)&&!u(R)||(P=o(_))):C=!1}C&&(x.set(_,P),b(P,_,y,w,x),x.delete(_)),e(d,v,P)}}}function xo(){if(Un)return Ln;Un=1;var e=Dt(),t=Kt(),r=Qt(),n=wo(),o=xt(),i=yo(),s=uo();return Ln=function a(c,u,h,l,g){c!==u&&r(u,(function(r,i){if(g||(g=new e),o(r))n(c,u,i,h,a,l,g);else{var f=l?l(s(c,i),r,i+"",c,u,g):void 0;void 0===f&&(f=r),t(c,i,f)}}),i)},Ln}function Ro(){if(Wn)return Fn;return Wn=1,Fn=function(e){return e}}function _o(){if(qn)return Gn;return qn=1,Gn=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}}function ko(){if(In)return Mn;In=1;var e=_o(),t=Math.max;return Mn=function(r,n,o){return n=t(void 0===n?r.length-1:n,0),function(){for(var i=arguments,s=-1,a=t(i.length-n,0),c=Array(a);++s<a;)c[s]=i[n+s];s=-1;for(var u=Array(n+1);++s<n;)u[s]=i[s];return u[n]=o(c),e(r,this,u)}},Mn}function Po(){if(Hn)return zn;return Hn=1,zn=function(e){return function(){return e}}}function Co(){if(Vn)return Dn;Vn=1;var e=Po(),t=Vt();return Dn=t?function(r,n){return t(r,"toString",{configurable:!0,enumerable:!1,value:e(n),writable:!0})}:Ro()}function $o(){if(Kn)return Jn;Kn=1;var e=Date.now;return Jn=function(t){var r=0,n=0;return function(){var o=e(),i=16-(o-n);if(n=o,i>0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}},Jn}function No(){if(Qn)return Yn;Qn=1;var e=Co(),t=$o()(e);return Yn=t}function jo(){if(Zn)return Xn;Zn=1;var e=Ro(),t=ko(),r=No();return Xn=function(n,o){return r(t(n,o,e),n+"")}}function Eo(){if(to)return eo;to=1;var e=ot(),t=Vr(),r=fo(),n=xt();return eo=function(o,i,s){if(!n(s))return!1;var a=typeof i;return!!("number"==a?t(s)&&r(i,s.length):"string"==a&&i in s)&&e(s[i],o)}}function Oo(){if(no)return ro;no=1;var e=jo(),t=Eo();return ro=function(r){return e((function(e,n){var o=-1,i=n.length,s=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(s=r.length>3&&"function"==typeof s?(i--,s):void 0,a&&t(n[0],n[1],a)&&(s=i<3?void 0:s,i=1),e=Object(e);++o<i;){var c=n[o];c&&r(e,c,o,s)}return e}))}}function To(){if(io)return oo;io=1;var e=xo(),t=Oo()((function(t,r,n){e(t,r,n)}));return oo=t}var Bo,So,Ao,Lo,Uo,Fo,Wo,Go,qo,Mo,Io,zo,Ho,Do,Vo,Jo,Ko,Yo,Qo,Xo,Zo,ei,ti,ri,ni=rt(To());function oi(){if(So)return Bo;So=1;var e=wt(),t=Mr();return Bo=function(r){return"symbol"==typeof r||t(r)&&"[object Symbol]"==e(r)}}function ii(){if(Lo)return Ao;Lo=1;var e=Hr(),t=oi(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;return Ao=function(o,i){if(e(o))return!1;var s=typeof o;return!("number"!=s&&"symbol"!=s&&"boolean"!=s&&null!=o&&!t(o))||(n.test(o)||!r.test(o)||null!=i&&o in Object(i))}}function si(){if(Fo)return Uo;Fo=1;var e=zt();function t(r,n){if("function"!=typeof r||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var o=function(){var e=arguments,t=n?n.apply(this,e):e[0],i=o.cache;if(i.has(t))return i.get(t);var s=r.apply(this,e);return o.cache=i.set(t,s)||i,s};return o.cache=new(t.Cache||e),o}return t.Cache=e,Uo=t}function ai(){if(Go)return Wo;Go=1;var e=si();return Wo=function(t){var r=e(t,(function(e){return 500===n.size&&n.clear(),e})),n=r.cache;return r}}function ci(){if(Mo)return qo;Mo=1;var e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,r=ai()((function(r){var n=[];return 46===r.charCodeAt(0)&&n.push(""),r.replace(e,(function(e,r,o,i){n.push(o?i.replace(t,"$1"):r||e)})),n}));return qo=r}function ui(){if(zo)return Io;return zo=1,Io=function(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}}function hi(){if(Do)return Ho;Do=1;var e=vt(),t=ui(),r=Hr(),n=oi(),o=e?e.prototype:void 0,i=o?o.toString:void 0;return Ho=function e(o){if("string"==typeof o)return o;if(r(o))return t(o,e)+"";if(n(o))return i?i.call(o):"";var s=o+"";return"0"==s&&1/o==-1/0?"-0":s},Ho}function li(){if(Jo)return Vo;Jo=1;var e=hi();return Vo=function(t){return null==t?"":e(t)}}function gi(){if(Yo)return Ko;Yo=1;var e=Hr(),t=ii(),r=ci(),n=li();return Ko=function(o,i){return e(o)?o:t(o,i)?[o]:r(n(o))}}function fi(){if(Xo)return Qo;Xo=1;var e=oi();return Qo=function(t){if("string"==typeof t||e(t))return t;var r=t+"";return"0"==r&&1/t==-1/0?"-0":r}}function pi(){if(ei)return Zo;ei=1;var e=gi(),t=fi();return Zo=function(r,n){for(var o=0,i=(n=e(n,r)).length;null!=r&&o<i;)r=r[t(n[o++])];return o&&o==i?r:void 0},Zo}function di(){if(ri)return ti;ri=1;var e=pi();return ti=function(t,r,n){var o=null==t?void 0:e(t,r);return void 0===o?n:o},ti}var mi=rt(di());const vi="package.json",yi=[".env.local",".env"];class bi extends ze.FeScriptContext{_env;shared;constructor(e){super(e),this._env=He.Env.searchEnv({logger:this.logger,preloadList:this.feConfig.envOrder||yi}),this.shared=Object.assign({},this.feConfig.release,this.getDefaultShreadOptions(e.shared))}getDefaultShreadOptions(e){return{rootPath:process.cwd(),sourceBranch:this._env.get("FE_RELEASE_BRANCH")||this._env.get("FE_RELEASE_SOURCE_BRANCH")||"master",releaseEnv:this._env.get("FE_RELEASE_ENV")||this._env.get("NODE_ENV")||"development",...e}}get rootPath(){return this.shared.rootPath}get sourceBranch(){return this.shared.sourceBranch}get releaseEnv(){return this.shared.releaseEnv}get env(){return this._env}get workspaces(){return this.getConfig("workspaces.workspaces")}get workspace(){return this.getConfig("workspaces.workspace")}setWorkspaces(e){this.options.workspaces={...this.options.workspaces,workspaces:e}}setConfig(e){this.options=ni(this.options,e)}getConfig(e,t){return mi(this.options,e,t)}setShared(e){this.shared=ni(this.shared,e)}getPkg(e,t){const r=this.workspace?.packageJson;if(!r)throw new Error("package.json is not found");return e?mi(r,e,t):r}getTemplateContext(){return{...this.shared,...this.workspace,publishPath:this.workspace?.path||"",env:this.releaseEnv,branch:this.sourceBranch}}async runChangesetsCli(e,t){let r="pnpm";try{await this.shell.exec("pnpm -v",{dryRun:!1})}catch{r="npm"}return await this.shell.exec(["pnpm"===r?"pnpm dlx":"npx","@changesets/cli",e,...t??[]])}}function wi(e,...t){return[e,...t]}const xi={maxWorkspace:3,multiWorkspaceSeparator:"_",workspaceVersionSeparator:"@",batchBranchName:"batch-${timestamp}-${releaseName}-${length}-packages"};class Ri{shell;logger;config;constructor(e,t,r={}){this.shell=e,this.logger=t,this.config={...xi,...r}}getReleaseBranchName(e,t,r){const n=r.branchName||"release-${tagName}";if("string"!=typeof n)throw new Error("Branch name template is not a string");return this.logger.verbose("Release Branch template is:",n),this.shell.format(n,{pkgName:e,releaseName:e,tagName:t,...r})}getBatchReleaseBranchName(e,t,r,n){const o=this.config.batchBranchName;if("string"!=typeof o)throw new Error("Branch name template is not a string");return this.logger.verbose("Release Batch Branch template is:",o),this.shell.format(o,{pkgName:e,releaseName:e,tagName:t,...r,length:n,timestamp:Date.now()})}getReleaseName(e){if(1===e.length)return e[0].name;const{maxWorkspace:t,multiWorkspaceSeparator:r,workspaceVersionSeparator:n}=this.config;return e.slice(0,t).map((({name:e,version:t})=>`${e}${n}${t}`)).join(r)}getReleaseTagName(e){return 1===e.length?e[0].version:`batch-${e.length}-${(new Date).toISOString().split("T")[0]}`}getReleaseBranchParams(e,t){const r=this.getReleaseTagName(e),n=this.getReleaseName(e);return{tagName:r,releaseBranch:e.length>1?this.getBatchReleaseBranchName(n,r,t,e.length):this.getReleaseBranchName(n,r,t)}}getPRTitle(e,t){const r=this.config.PRTitle||"Release ${env} ${pkgName} ${tagName}";return this.shell.format(r,{...t,tagName:e.tagName,pkgName:e.releaseBranch})}getPRBody(e,t,r){const n=this.config.PRBody,o=e.length>1?e.map((e=>this.shell.format("\n## ${name} ${version}\n${changelog}\n",e))):e[0].changelog,{workspaceVersionSeparator:i}=this.config,s=1===e.length?t.tagName:e.map((e=>`${e.name}${i}${e.version}`)).join(" ");return this.shell.format(n,{...r,tagName:s,changelog:o})}}class _i{context;_octokit=null;constructor(e){this.context=e}getGitHubUserInfo(){const{authorName:e,repoName:t}=this.context.shared;if(!e||!t)throw new Error("Author name or repo name is not set");return{owner:e,repo:t}}getToken(){const{tokenRef:e="GITHUB_TOKEN"}=this.context.getConfig("githubPR"),t=this.context.env.get(e);if(!t)throw new Error(`Token is not set. Please set ${e} environment variable.`);return t}get octokit(){if(this._octokit)return this._octokit;const{timeout:e}=this.context.getConfig("githubPR"),t={auth:this.getToken(),request:{timeout:e}};return this._octokit=new Ve.Octokit(t),this._octokit}get logger(){return this.context.logger}get shell(){return this.context.shell}get autoMergeType(){return this.context.shared.autoMergeType||"squash"}get dryRunPRNumber(){return this.context.getConfig("githubPR.dryRunPRNumber","999999")}get autoMergeReleasePR(){return this.context.shared.autoMergeReleasePR||false}async mergePR(e,t){if(!e)return void this.logger.error("Failed to create Pull Request.",e);const r=this.autoMergeType;if(this.context.dryRun){const{repoName:n,authorName:o}=this.context.shared;this.logger.info(`[DRY RUN] Would merge PR #${e} with method '${r}' in repo ${o}/${n}, branch ${t}`)}else await this.octokit.rest.pulls.merge({...this.getGitHubUserInfo(),pull_number:Number(e),merge_method:r})}async checkedPR(e,t){try{await this.octokit.rest.pulls.get({...this.getGitHubUserInfo(),pull_number:Number(e)}),await this.octokit.rest.git.deleteRef({...this.getGitHubUserInfo(),ref:`heads/${t}`}),this.logger.info(`Branch ${t} has been deleted`)}catch(r){if(404===r.status)return void this.logger.warn(`PR #${e} or branch ${t} not found`);throw this.logger.error("Failed to check PR or delete branch",r),r}}async createReleasePRLabel(){const e=this.context.shared.label;if(!(e&&e.name&&e.description&&e.color))throw new Error("Label is not valid, skipping creation");if(this.context.dryRun)return this.logger.info("[DRY RUN] Would create PR label with:",e),e;try{const t=await this.octokit.rest.issues.createLabel({...this.getGitHubUserInfo(),name:e.name,description:e.description,color:e.color.replace("#","")});return this.logger.debug("Create PR label Success",t),e}catch(t){if(422===t.status)return this.logger.warn(`Label ${e.name} already exists, skipping!`),e;throw this.logger.error("Create PR label Failed",t),t}}async createReleasePR(e){if(this.context.getConfig("githubPR.dryRunCreatePR")||this.context.dryRun)return this.logger.info("[DRY RUN] Would create PR with:",{...e,labels:e.labels}),this.dryRunPRNumber;try{const t=await this.octokit.rest.pulls.create({...this.getGitHubUserInfo(),...e}),r=t.data.number;if(!r)throw new Error("CreateReleasePR Failed, prNumber is empty");if(this.logger.debug("Create PR Success",[t?.url]),e.labels&&e.labels.length){const t=await this.octokit.rest.issues.addLabels({...this.getGitHubUserInfo(),issue_number:r,labels:e.labels});this.logger.debug("Add PR label Success",[t.url])}return r.toString()}catch(e){if(422===e.status&&e.message.includes("already exists")){this.logger.warn("PR already exists");const t=e.message.match(/pull request #(\d+)/);return t?t[1]:""}throw this.logger.error("Failed to create PR",e),e}}truncateBody(e){return e&&e.length>=124e3?e.substring(0,124e3)+"...":e}getOctokitReleaseOptions(e){const{releaseName:t,draft:r=!1,preRelease:n=!1,autoGenerate:o=!1,makeLatest:i=!0,releaseNotes:s,discussionCategoryName:a}=this.context.getConfig("githubPR"),c=t,u=o?"":this.truncateBody(String(s));return{name:c,make_latest:i.toString(),body:u,draft:r,prerelease:n,generate_release_notes:o,discussion_category_name:a,tag_name:"",...e,...this.getGitHubUserInfo()}}async createRelease(e){const t=this.getOctokitReleaseOptions({tag_name:e.tagName,body:e.changelog});if(t.name=this.shell.format(t.name,e),this.logger.exec(`octokit repos.createRelease "${t.name}" (${t.tag_name})`,{isDryRun:this.context.dryRun}),!t.tag_name)throw new Error("TagName is undefined");if(this.context.dryRun)return;const r=await this.octokit.repos.createRelease(t);this.logger.verbose(`octokit repos.createRelease: done (${r.headers.location})`)}}var ki,Pi;function Ci(){if(Pi)return ki;Pi=1;var e=wt(),t=Hr(),r=Mr();return ki=function(n){return"string"==typeof n||!t(n)&&r(n)&&"[object String]"==e(n)}}var $i=rt(Ci());class Ni{context;pluginName;props;onlyOne=!0;constructor(e,t,r={}){this.context=e,this.pluginName=t,this.props=r,this.setConfig(this.getInitialProps(r))}getInitialProps(e){const t=this.context.options[this.pluginName],r=mi(this.context.shared,this.pluginName);return t||e?ni({},r,e,t):{}}get logger(){return this.context.logger}get shell(){return this.context.shell}get options(){return this.context.getConfig(this.pluginName,{})}getEnv(e,t){return this.context.env.get(e)??t}enabled(e,t){return!0}getConfig(e,t){return e?this.context.getConfig([this.pluginName,...Array.isArray(e)?e:[e]],t):this.context.getConfig(this.pluginName,t)}setConfig(e){this.context.setConfig({[this.pluginName]:e})}onBefore(e){}onExec(e){}onSuccess(e){}onError(e){}async step({label:e,task:t}){this.logger.obtrusive(e);try{const r=await t();return this.logger.info(`${e} - success`),r}catch(e){throw this.logger.error(e),e}}}class ji extends Ni{async onBefore(){const e=await this.getUserInfo();if(!e)throw new Error("Failed to get repoInfo");let t=this.context.shared.currentBranch;t||(t=await this.getCurrentBranch()),t&&await this.context.shell.exec(`git checkout ${t}`,{dryRun:!1}),this.context.setShared({repoName:e.repoName,authorName:e.authorName,currentBranch:t})}async getCurrentBranch(){return await new Promise((e=>setTimeout(e,100))),this.context.shell.exec("git rev-parse --abbrev-ref HEAD",{dryRun:!1})}async getRemoteUrl(){return(await this.context.shell.exec("git config --get remote.origin.url",{dryRun:!1})).trim()}async getUserInfo(){let e;try{e=await this.getRemoteUrl()}catch{throw new Error("Failed to get git remote url. Please ensure this is a git repository with a valid remote.")}if(!e)throw new Error("Git remote URL is empty. Please set a valid GitHub remote URL.");this.context.logger.verbose("repoUrl: ",e);const t=e.match(/github\.com[:/]([^/]+)\/([^/.]+)(?:\.git)?$/);if(!t)throw new Error("Invalid GitHub repository URL format. Please ensure the remote URL is from GitHub.");const[,r,n]=t;if(!this.isValidString(r)||!this.isValidString(n))throw new Error("Failed to extract owner or repository name from GitHub URL");return{repoName:n,authorName:r}}isValidString(e){return!!e&&$i(e)}commit(e,t=[]){return this.context.shell.exec(["git","commit","--message",JSON.stringify(e),...t])}}class Ei{options;constructor(e){this.options=e}compare(e,t){return"function"==typeof this.options.compare?this.options.compare(e,t):e.startsWith(t)}toChangeLabel(e,t=this.options.changePackagesLabel){return t.replace("${name}",e)}toChangeLabels(e,t=this.options.changePackagesLabel){return e.map((e=>this.toChangeLabel(e,t)))}pick(e,t=this.options.packagesDirectories){const r=[];for(const n of t)for(const t of e)if(this.compare(t,n)){r.push(n);break}return r}}class Oi{static readJson(e){const t=Ke.readFileSync(e,"utf-8");return JSON.parse(t)}static toWorkspace(e,t){let{root:r,packageJson:n}=e;const o=e.path;if(!o)throw new Error("path is not required!");return r=r||Ye.join(t,o),n=n||Oi.readJson(Ye.join(r,vi)),{name:n.name,version:n.version,path:o,root:r,packageJson:n}}}class Ti extends Ni{releaseTask=null;workspacesList=[];_skip=!1;releaseLabel;constructor(e){super(e,"workspaces"),this.releaseLabel=new Ei({changePackagesLabel:this.context.shared.changePackagesLabel||"change:${name}",packagesDirectories:this.context.shared.packagesDirectories||[]})}enabled(){return!this._skip&&!this.getConfig("skip")}async onBefore(){const e=this.getConfig("workspace");if(e)return this.logger.debug("Use the specified workspace",e),void this.setCurrentWorkspace(e,[]);const t=await this.getWorkspaces();if(this.getConfig("skipCheckPackage")||0===t.length)throw new Error("No changes to publish packages");const{publishPath:r}=this.context.shared;if(r){const e=t.find((e=>Je.resolve(e.root)===Je.resolve(r)));if(this.nextSkip(),!e)throw new Error(`No workspace found for: ${r}`);return this.logger.debug(`Workspace of ${r} find!`,Je.join(e.root,vi)),void this.setCurrentWorkspace(e,[e])}const[n,...o]=t;this.workspacesList=o,this.setCurrentWorkspace(n,t)}nextSkip(){this._skip=!0,this.logger.debug("skip next workspace")}setReleaseTask(e){this.releaseTask=e}setCurrentWorkspace(e,t){this.context.setShared({publishPath:e.path}),this.setConfig({workspace:e,workspaces:t})}getPackages(){const e=this.context.shared.packagesDirectories;return Array.isArray(e)?e:[]}async getGitWorkspaces(){const e=this.context.sourceBranch,t=await this.shell.exec(`git diff --name-only origin/${e}...HEAD`,{dryRun:!1});return"string"==typeof t?t.split("\n"):[]}async getChangedPackages(e,t){if(this.logger.debug("changeLabels",t),Array.isArray(t)&&t.length>0){const r=e.filter((e=>{const r=this.releaseLabel.toChangeLabel(e);return t.includes(r)}));return this.logger.debug("changed by labels",r),r}const r=await this.getGitWorkspaces();return this.logger.debug("changed by git",r),this.releaseLabel.pick(r,e)}async getWorkspaces(){const e=this.getPackages();this.logger.debug("packages",e);const t=await this.getChangedPackages(e,this.getConfig("changeLabels"));this.logger.debug("changedPaths",t);const r=t.map((e=>Oi.toWorkspace({path:e},this.context.rootPath)));return r}}function Bi(e,...t){return"function"==typeof e&&e.prototype&&e.prototype.constructor===e?new e(...t):e(...t)}function Si(e){return e.startsWith(".")?Je.parse(e).name:e}async function Ai(e){let t=null;try{t=(await import(e)).default}catch{try{t=(await import(Je.join(process.cwd(),e))).default}catch{const r=Qe.createRequire(process.cwd());t=(await import(Xe.pathToFileURL(r.resolve(e,{paths:[process.cwd()]})).href)).default}}return[Si(e),t]}async function Li(e,t,r=5){const n=Ze(r),o=t.map((([t,...r])=>n((()=>(async(t,...r)=>{if("string"==typeof t){const[,n]=await Ai(t);return Bi(n,e,...r)}return Bi(t,e,...r)})(t,...r)))));return Promise.all(o)}const Ui={name:"angular",types:[{type:"feat",section:"✨ Features",hidden:!1},{type:"fix",section:"🐞 Bug Fixes",hidden:!1},{type:"chore",section:"🔧 Chores",hidden:!1},{type:"docs",section:"📝 Documentation",hidden:!1},{type:"refactor",section:"♻️ Refactors",hidden:!1},{type:"perf",section:"🚀 Performance",hidden:!1},{type:"test",section:"🚨 Tests",hidden:!1},{type:"style",section:"🎨 Styles",hidden:!1},{type:"ci",section:"🔄 CI",hidden:!1},{type:"build",section:"🚧 Build",hidden:!1},{type:"revert",section:"⏪ Reverts",hidden:!1},{type:"release",section:"🔖 Releases",hidden:!1}]};const Fi=[wi(Ti),wi(class extends Ni{constructor(e,t){super(e,"changelog",{increment:"patch",changesetRoot:".changeset",tagTemplate:"${name}@${version}",tagPrefix:"${name}",tagMatch:"${name}@*",...t})}get changesetRoot(){return Ye.join(this.context.rootPath,this.getConfig("changesetRoot"))}enabled(){return!this.getConfig("skip")}async onBefore(){if(!Ke.existsSync(this.changesetRoot))throw new Error(`Changeset directory ${this.changesetRoot} does not exist`);this.logger.debug(`${this.changesetRoot} exists`)}mergeWorkspaces(e){return e.map((e=>{const t=Oi.toWorkspace({path:e.path},this.context.rootPath),r={...e,version:t.version};return r.tagName=this.generateTagName(r),r}))}async onExec(){const e=await this.step({label:"Generate Changelogs",task:()=>Promise.all(this.context.workspaces.map((e=>this.generateChangelog(e))))});this.getConfig("skipChangeset")?this.logger.debug("Skip generate changeset files"):(await this.step({label:"Changeset Version",task:()=>Promise.all(e.map((e=>this.generateChangesetFile(e))))}),await this.context.runChangesetsCli("version",["--no-changelog"]));const t=this.mergeWorkspaces(e);this.logger.debug("new workspaces",t),this.context.setWorkspaces(t)}getTagPrefix(e){return this.shell.format(this.getConfig("tagPrefix"),e)}async createChangelog({lastTag:e,workspace:t}){const r={releaseCount:1,tagPrefix:this.getTagPrefix(t),warn:this.logger.warn.bind(this.logger),preset:Ui.name},n={version:t.version};let o=e;try{await this.shell.exec(`git rev-parse --verify --quiet "refs/tags/${e}"`,{dryRun:!1}),this.logger.verbose(`Tag '${e}' found for workspace '${t.name}'. Using it as the starting point.`)}catch{this.logger.warn(`Tag '${e}' not found for workspace '${t.name}'. Will generate changelog using commits within path '${t.path}' from the beginning of history or latest available tag.`),o=void 0}const i={debug:this.logger.debug.bind(this.logger),from:o,reverse:!0,path:t.path},s={},a={headerPartial:""};return this.logger.debug("options",r),this.logger.debug("context",n),this.logger.debug("gitRawCommitsOpts",i),new Promise(((e,c)=>{let u="";const h=et(r,n,i,s,a);h.on("data",(e=>{u+=e.toString()})),h.on("error",(e=>{this.logger.error(`Error during conventional-changelog stream for workspace '${t.name}':`,e),c(new Error(`Failed to generate changelog for ${t.name}: ${e.message}`))})),h.on("end",(()=>{!u&&o?this.logger.warn(`No commits found for workspace '${t.name}' since tag '${o}' within path '${t.path}'. Changelog will be empty.`):u||this.logger.info(`No commits found for workspace '${t.name}' within path '${t.path}'. Changelog will be empty.`),e(this.tranformChangelog(u,Ui.types))}))}))}tranformChangelog(e,t){return e}async generateChangelog(e){const t=await this.getTagName(e);this.logger.verbose("tagName is:",t);const r=await this.createChangelog({workspace:e,lastTag:t});return{...e,lastTag:t,changelog:r}}generateTagName(e){try{const t=this.getConfig("tagTemplate");return this.shell.format(t,e)}catch(t){return console.error(`Error generating tag name for ${e.name}:`,t),`${e.name}-v0.0.0`}}async getTagName(e){try{const t=this.generateTagName(e),r=this.shell.format(this.getConfig("tagMatch"),e),n=await this.shell.exec(`git for-each-ref --sort=-creatordate --format "%(refname:short)|%(creatordate:iso8601)" "refs/tags/${r}"`,{dryRun:!1});if(this.logger.debug("tagsOutput",n),!n)return t;const o=n.split("\n").filter(Boolean);if(0===o.length)return t;return o[0].split("|")[0]}catch(t){console.error(`Error getting tag for ${e.name}:`,t);return this.generateTagName(e)}}getIncrement(){const e=this.context.getConfig("workspaces.changeLabels");if(Array.isArray(e)&&e.length>0){if(e.includes("increment:major"))return"major";if(e.includes("increment:minor"))return"minor"}return this.getConfig("increment","patch")}async generateChangesetFile(e){const{name:t,version:r}=e,n=`${t}-${r}`.replace(/[\/\\]/g,"_"),o=Ye.join(this.changesetRoot,`${n}.md`),i=this.getIncrement();this.logger.verbose("increment is:",[i]);const s=this.shell.format("---\n'${name}': '${increment}'\n---\n${changelog}",{...e,increment:i});if(this.context.dryRun)return this.logger.info(`Changeset [${o}] will be created, content is:`),void this.logger.log(s);Ke.existsSync(o)?this.logger.info(`Changeset ${n} already exists`):Ke.writeFileSync(o,s,"utf-8")}},{}),wi(class extends ji{context;releaseParams;githubManager;constructor(e,t){super(e,"githubPR",{releaseName:"Release ${name} v${version}",...t}),this.context=e,this.githubManager=new _i(this.context),this.releaseParams=new Ri(e.shell,e.logger,{PRTitle:this.getConfig("PRTitle",this.context.shared.PRTitle),PRBody:this.getConfig("PRBody",this.context.shared.PRBody),...this.props})}enabled(e){return!this.getConfig("skip")&&("onExec"===e?!this.isPublish:"onSuccess"!==e||this.isPublish)}get isPublish(){return!this.getConfig("releasePR")}async isGithubRepository(){try{return(await this.getRemoteUrl()).includes("github.com")}catch{return!1}}async onBefore(){this.logger.verbose("GithubPR onBefore");if(!await this.isGithubRepository())throw new Error("Current repository is not a GitHub repository. GitHub PR workflow is only available for GitHub repositories.");if(await super.onBefore(),this.isPublish){const e=this.getEnv("NPM_TOKEN");if(!e)throw new Error("NPM_TOKEN is not set");await this.shell.exec(`npm config set //registry.npmjs.org/:_authToken=${e}`)}}async onExec(){const e=this.context.workspaces;await this.step({label:"Release Commit",task:()=>this.relesaeCommit(e)});const t=await this.step({label:"Create Release Branch",task:()=>this.createReleaseBranch(e)});await this.releasePullRequest(e,t)}async onSuccess(){const e=this.context.workspaces;this.getConfig("dryRunCreatePR")||(await this.context.runChangesetsCli("publish"),await this.shell.exec("git push origin --tags")),await this.step({label:"Release Github",task:()=>Promise.all(e.map((e=>(this.logger.debug(e),this.githubManager.createRelease(e)))))})}async relesaeCommit(e){const t=this.getConfig("commitArgs",[]);if(1===e.length)return await this.shell.exec("git add ."),void await this.commitWorkspace(e[0],t);await this.shell.exec("git add .");const r=`chore(tag): ${e.map((e=>`${e.name} v${e.version}`)).join(",")}`;await this.commit(r,t)}async releasePullRequest(e,t){const r=await this.step({label:"Create Release PR",task:()=>this.createReleasePR(e,t)});if(this.githubManager.autoMergeReleasePR){const{releaseBranch:e}=t;return await this.step({label:`Merge Release PR(${r})`,task:()=>this.githubManager.mergePR(r,e)}),void await this.step({label:`Checked Release PR(${r})`,task:()=>this.githubManager.checkedPR(r,e)})}this.logger.info(`Please manually merge PR(#${r}) and complete the publishing process afterwards`)}async commitWorkspace(e,t=[]){const r=this.shell.format(this.getConfig("commitMessage","chore(tag): ${name} v${version}"),e);return await this.commit(r,t)}async createReleaseBranch(e){const t=this.releaseParams.getReleaseBranchParams(e,this.context.getTemplateContext()),{tagName:r,releaseBranch:n}=t;if("string"!=typeof r)throw new Error("Tag name is not a string");const{sourceBranch:o,currentBranch:i}=this.context.shared;this.context.logger.verbose("PR TagName is:",r),this.context.logger.verbose("PR CurrentBranch is:",i),this.context.logger.verbose("PR SourceBranch is:",o),this.context.logger.verbose("PR ReleaseBranch is:",n);try{await this.context.shell.exec(`git fetch origin ${o} ${i}`),await this.context.shell.exec(`git checkout -b ${n} ${i}`),await this.context.shell.exec(`git push origin ${n}`)}catch(e){throw e.message.includes("remote: Permission to ")&&this.context.logger.warn('Token maybe not allow Workflow permissions, can you try to open "Workflow permissions" -> "Read and write permissions" for this token?'),e}return{tagName:r,releaseBranch:n}}async createReleasePR(e,t){const r=[(await this.githubManager.createReleasePRLabel()).name],n=this.context.getTemplateContext(),o=this.releaseParams.getPRTitle(t,n),i=this.releaseParams.getPRBody(e,t,n);return this.githubManager.createReleasePR({title:o,body:i,base:this.context.sourceBranch,head:t.releaseBranch,labels:r})}},{})];var Wi,Gi,qi,Mi;function Ii(){if(Gi)return Wi;Gi=1;var e=ho(),t=gi(),r=fo(),n=xt(),o=fi();return Wi=function(i,s,a,c){if(!n(i))return i;for(var u=-1,h=(s=t(s,i)).length,l=h-1,g=i;null!=g&&++u<h;){var f=o(s[u]),p=a;if("__proto__"===f||"constructor"===f||"prototype"===f)return i;if(u!=l){var d=g[f];void 0===(p=c?c(d,f,g):void 0)&&(p=n(d)?d:r(s[u+1])?[]:{})}e(g,f,p),g=g[f]}return i},Wi}function zi(){if(Mi)return qi;Mi=1;var e=Ii();return qi=function(t,r,n){return null==t?t:e(t,r,n)},qi}var Hi=rt(zi());exports.Plugin=Ni,exports.ReleaseContext=bi,exports.ReleaseLabel=Ei,exports.ReleaseTask=class{executor;defaultTuples;context;constructor(e={},t=new De.AsyncExecutor,r=Fi){this.executor=t,this.defaultTuples=r,this.context=new bi(e)}getContext(){return this.context}async usePlugins(e){e=e||this.context.shared.plugins||[];const t=await Li(this.context,[...this.defaultTuples,...e]);return t.forEach((e=>{e instanceof Ti&&e.setReleaseTask(this),this.executor.use(e)})),t}async run(){return this.executor.exec(this.context,(e=>Promise.resolve(e)))}async exec(e){if("false"===this.context.env.get("FE_RELEASE"))throw new Error("Skip Release");return await this.usePlugins(e),this.run()}},exports.factory=Bi,exports.load=Ai,exports.loaderPluginsFromPluginTuples=Li,exports.reduceOptions=function(e,t){return Object.entries(e).reduce(((e,[r,n])=>(r.includes(".")?Hi(e,r,n):Hi(e,t?`${t}.${r}`:r,n),e)),{})},exports.tuple=wi;
|
|
1
|
+
"use strict";var t,e,r,n,o,i,s,a,c,u,h,l,f,g,p,m,d,v,y,b,w,R,x,_,k,P,C,$,N,j,E,B,T,O,S,A,L,F,U,W,M,G,H,q,z,I,D,V,J,K,Y,Q,X,Z,tt,et,rt,nt,ot,it,st,at,ct,ut,ht,lt,ft,gt,pt,mt,dt,vt,yt,bt,wt,Rt,xt,_t,kt,Pt,Ct,$t,Nt,jt,Et,Bt,Tt,Ot,St,At,Lt,Ft,Ut,Wt,Mt,Gt,Ht,qt,zt=require("@qlover/scripts-context"),It=require("@qlover/env-loader"),Dt=require("@qlover/fe-corekit"),Vt=require("@octokit/rest"),Jt=require("node:path"),Kt=require("fs"),Yt=require("path"),Qt=require("node:module"),Xt=require("node:url"),Zt=require("p-limit"),te="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ee(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function re(){if(e)return t;return e=1,t=function(){this.__data__=[],this.size=0}}function ne(){if(n)return r;return n=1,r=function(t,e){return t===e||t!=t&&e!=e}}function oe(){if(i)return o;i=1;var t=ne();return o=function(e,r){for(var n=e.length;n--;)if(t(e[n][0],r))return n;return-1}}function ie(){if(a)return s;a=1;var t=oe(),e=Array.prototype.splice;return s=function(r){var n=this.__data__,o=t(n,r);return!(o<0)&&(o==n.length-1?n.pop():e.call(n,o,1),--this.size,!0)}}function se(){if(u)return c;u=1;var t=oe();return c=function(e){var r=this.__data__,n=t(r,e);return n<0?void 0:r[n][1]}}function ae(){if(l)return h;l=1;var t=oe();return h=function(e){return t(this.__data__,e)>-1}}function ce(){if(g)return f;g=1;var t=oe();return f=function(e,r){var n=this.__data__,o=t(n,e);return o<0?(++this.size,n.push([e,r])):n[o][1]=r,this}}function ue(){if(m)return p;m=1;var t=re(),e=ie(),r=se(),n=ae(),o=ce();function i(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,p=i}function he(){if(v)return d;v=1;var t=ue();return d=function(){this.__data__=new t,this.size=0}}function le(){if(b)return y;return b=1,y=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}}function fe(){if(R)return w;return R=1,w=function(t){return this.__data__.get(t)}}function ge(){if(_)return x;return _=1,x=function(t){return this.__data__.has(t)}}function pe(){if(P)return k;P=1;var t="object"==typeof te&&te&&te.Object===Object&&te;return k=t}function me(){if($)return C;$=1;var t=pe(),e="object"==typeof self&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return C=r}function de(){if(j)return N;j=1;var t=me().Symbol;return N=t}function ve(){if(B)return E;B=1;var t=de(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,o=t?t.toStringTag:void 0;return E=function(t){var e=r.call(t,o),i=t[o];try{t[o]=void 0;var s=!0}catch(t){}var a=n.call(t);return s&&(e?t[o]=i:delete t[o]),a}}function ye(){if(O)return T;O=1;var t=Object.prototype.toString;return T=function(e){return t.call(e)}}function be(){if(A)return S;A=1;var t=de(),e=ve(),r=ye(),n=t?t.toStringTag:void 0;return S=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":n&&n in Object(t)?e(t):r(t)}}function we(){if(F)return L;return F=1,L=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}}function Re(){if(W)return U;W=1;var t=be(),e=we();return U=function(r){if(!e(r))return!1;var n=t(r);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}}function xe(){if(G)return M;G=1;var t=me()["__core-js_shared__"];return M=t}function _e(){if(q)return H;q=1;var t,e=xe(),r=(t=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||""))?"Symbol(src)_1."+t:"";return H=function(t){return!!r&&r in t}}function ke(){if(I)return z;I=1;var t=Function.prototype.toString;return z=function(e){if(null!=e){try{return t.call(e)}catch(t){}try{return e+""}catch(t){}}return""}}function Pe(){if(V)return D;V=1;var t=Re(),e=_e(),r=we(),n=ke(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,s=Object.prototype,a=i.toString,c=s.hasOwnProperty,u=RegExp("^"+a.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return D=function(i){return!(!r(i)||e(i))&&(t(i)?u:o).test(n(i))}}function Ce(){if(K)return J;return K=1,J=function(t,e){return null==t?void 0:t[e]}}function $e(){if(Q)return Y;Q=1;var t=Pe(),e=Ce();return Y=function(r,n){var o=e(r,n);return t(o)?o:void 0}}function Ne(){if(Z)return X;Z=1;var t=$e()(me(),"Map");return X=t}function je(){if(et)return tt;et=1;var t=$e()(Object,"create");return tt=t}function Ee(){if(nt)return rt;nt=1;var t=je();return rt=function(){this.__data__=t?t(null):{},this.size=0}}function Be(){if(it)return ot;return it=1,ot=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}}function Te(){if(at)return st;at=1;var t=je(),e=Object.prototype.hasOwnProperty;return st=function(r){var n=this.__data__;if(t){var o=n[r];return"__lodash_hash_undefined__"===o?void 0:o}return e.call(n,r)?n[r]:void 0}}function Oe(){if(ut)return ct;ut=1;var t=je(),e=Object.prototype.hasOwnProperty;return ct=function(r){var n=this.__data__;return t?void 0!==n[r]:e.call(n,r)}}function Se(){if(lt)return ht;lt=1;var t=je();return ht=function(e,r){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=t&&void 0===r?"__lodash_hash_undefined__":r,this}}function Ae(){if(gt)return ft;gt=1;var t=Ee(),e=Be(),r=Te(),n=Oe(),o=Se();function i(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,ft=i}function Le(){if(mt)return pt;mt=1;var t=Ae(),e=ue(),r=Ne();return pt=function(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}}function Fe(){if(vt)return dt;return vt=1,dt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}}function Ue(){if(bt)return yt;bt=1;var t=Fe();return yt=function(e,r){var n=e.__data__;return t(r)?n["string"==typeof r?"string":"hash"]:n.map}}function We(){if(Rt)return wt;Rt=1;var t=Ue();return wt=function(e){var r=t(this,e).delete(e);return this.size-=r?1:0,r}}function Me(){if(_t)return xt;_t=1;var t=Ue();return xt=function(e){return t(this,e).get(e)}}function Ge(){if(Pt)return kt;Pt=1;var t=Ue();return kt=function(e){return t(this,e).has(e)}}function He(){if($t)return Ct;$t=1;var t=Ue();return Ct=function(e,r){var n=t(this,e),o=n.size;return n.set(e,r),this.size+=n.size==o?0:1,this}}function qe(){if(jt)return Nt;jt=1;var t=Le(),e=We(),r=Me(),n=Ge(),o=He();function i(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,Nt=i}function ze(){if(Bt)return Et;Bt=1;var t=ue(),e=Ne(),r=qe();return Et=function(n,o){var i=this.__data__;if(i instanceof t){var s=i.__data__;if(!e||s.length<199)return s.push([n,o]),this.size=++i.size,this;i=this.__data__=new r(s)}return i.set(n,o),this.size=i.size,this}}function Ie(){if(Ot)return Tt;Ot=1;var t=ue(),e=he(),r=le(),n=fe(),o=ge(),i=ze();function s(e){var r=this.__data__=new t(e);this.size=r.size}return s.prototype.clear=e,s.prototype.delete=r,s.prototype.get=n,s.prototype.has=o,s.prototype.set=i,Tt=s}function De(){if(At)return St;At=1;var t=$e(),e=function(){try{var e=t(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();return St=e}function Ve(){if(Ft)return Lt;Ft=1;var t=De();return Lt=function(e,r,n){"__proto__"==r&&t?t(e,r,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[r]=n}}function Je(){if(Wt)return Ut;Wt=1;var t=Ve(),e=ne();return Ut=function(r,n,o){(void 0!==o&&!e(r[n],o)||void 0===o&&!(n in r))&&t(r,n,o)}}function Ke(){if(Gt)return Mt;return Gt=1,Mt=function(t){return function(e,r,n){for(var o=-1,i=Object(e),s=n(e),a=s.length;a--;){var c=s[t?a:++o];if(!1===r(i[c],c,i))break}return e}}}function Ye(){if(qt)return Ht;qt=1;var t=Ke()();return Ht=t}var Qe,Xe,Ze,tr,er,rr,nr,or,ir,sr,ar,cr,ur,hr,lr,fr,gr,pr,mr,dr,vr,yr,br,wr,Rr,xr,_r,kr,Pr,Cr,$r,Nr,jr,Er={exports:{}};function Br(){return Qe||(Qe=1,function(t,e){var r=me(),n=e&&!e.nodeType&&e,o=n&&t&&!t.nodeType&&t,i=o&&o.exports===n?r.Buffer:void 0,s=i?i.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=s?s(r):new t.constructor(r);return t.copy(n),n}}(Er,Er.exports)),Er.exports}function Tr(){if(Ze)return Xe;Ze=1;var t=me().Uint8Array;return Xe=t}function Or(){if(er)return tr;er=1;var t=Tr();return tr=function(e){var r=new e.constructor(e.byteLength);return new t(r).set(new t(e)),r}}function Sr(){if(nr)return rr;nr=1;var t=Or();return rr=function(e,r){var n=r?t(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}}function Ar(){if(ir)return or;return ir=1,or=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}}function Lr(){if(ar)return sr;ar=1;var t=we(),e=Object.create,r=function(){function r(){}return function(n){if(!t(n))return{};if(e)return e(n);r.prototype=n;var o=new r;return r.prototype=void 0,o}}();return sr=r}function Fr(){if(ur)return cr;return ur=1,cr=function(t,e){return function(r){return t(e(r))}}}function Ur(){if(lr)return hr;lr=1;var t=Fr()(Object.getPrototypeOf,Object);return hr=t}function Wr(){if(gr)return fr;gr=1;var t=Object.prototype;return fr=function(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||t)}}function Mr(){if(mr)return pr;mr=1;var t=Lr(),e=Ur(),r=Wr();return pr=function(n){return"function"!=typeof n.constructor||r(n)?{}:t(e(n))}}function Gr(){if(vr)return dr;return vr=1,dr=function(t){return null!=t&&"object"==typeof t}}function Hr(){if(br)return yr;br=1;var t=be(),e=Gr();return yr=function(r){return e(r)&&"[object Arguments]"==t(r)}}function qr(){if(Rr)return wr;Rr=1;var t=Hr(),e=Gr(),r=Object.prototype,n=r.hasOwnProperty,o=r.propertyIsEnumerable,i=t(function(){return arguments}())?t:function(t){return e(t)&&n.call(t,"callee")&&!o.call(t,"callee")};return wr=i}function zr(){if(_r)return xr;_r=1;var t=Array.isArray;return xr=t}function Ir(){if(Pr)return kr;Pr=1;return kr=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}}function Dr(){if($r)return Cr;$r=1;var t=Re(),e=Ir();return Cr=function(r){return null!=r&&e(r.length)&&!t(r)}}function Vr(){if(jr)return Nr;jr=1;var t=Dr(),e=Gr();return Nr=function(r){return e(r)&&t(r)}}var Jr,Kr,Yr,Qr,Xr,Zr,tn,en,rn,nn={exports:{}};function on(){if(Kr)return Jr;return Kr=1,Jr=function(){return!1}}function sn(){return Yr||(Yr=1,function(t,e){var r=me(),n=on(),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o?r.Buffer:void 0,a=(s?s.isBuffer:void 0)||n;t.exports=a}(nn,nn.exports)),nn.exports}function an(){if(Xr)return Qr;Xr=1;var t=be(),e=Ur(),r=Gr(),n=Function.prototype,o=Object.prototype,i=n.toString,s=o.hasOwnProperty,a=i.call(Object);return Qr=function(n){if(!r(n)||"[object Object]"!=t(n))return!1;var o=e(n);if(null===o)return!0;var c=s.call(o,"constructor")&&o.constructor;return"function"==typeof c&&c instanceof c&&i.call(c)==a}}function cn(){if(tn)return Zr;tn=1;var t=be(),e=Ir(),r=Gr(),n={};return n["[object Float32Array]"]=n["[object Float64Array]"]=n["[object Int8Array]"]=n["[object Int16Array]"]=n["[object Int32Array]"]=n["[object Uint8Array]"]=n["[object Uint8ClampedArray]"]=n["[object Uint16Array]"]=n["[object Uint32Array]"]=!0,n["[object Arguments]"]=n["[object Array]"]=n["[object ArrayBuffer]"]=n["[object Boolean]"]=n["[object DataView]"]=n["[object Date]"]=n["[object Error]"]=n["[object Function]"]=n["[object Map]"]=n["[object Number]"]=n["[object Object]"]=n["[object RegExp]"]=n["[object Set]"]=n["[object String]"]=n["[object WeakMap]"]=!1,Zr=function(o){return r(o)&&e(o.length)&&!!n[t(o)]}}function un(){if(rn)return en;return rn=1,en=function(t){return function(e){return t(e)}}}var hn,ln,fn,gn,pn,mn,dn,vn,yn,bn,wn,Rn,xn,_n,kn,Pn,Cn,$n,Nn,jn,En,Bn,Tn,On,Sn,An,Ln,Fn,Un,Wn,Mn,Gn,Hn,qn,zn,In,Dn,Vn,Jn,Kn,Yn,Qn,Xn,Zn,to,eo,ro,no,oo,io={exports:{}};function so(){return hn||(hn=1,function(t,e){var r=pe(),n=e&&!e.nodeType&&e,o=n&&t&&!t.nodeType&&t,i=o&&o.exports===n&&r.process,s=function(){try{var t=o&&o.require&&o.require("util").types;return t||i&&i.binding&&i.binding("util")}catch(t){}}();t.exports=s}(io,io.exports)),io.exports}function ao(){if(fn)return ln;fn=1;var t=cn(),e=un(),r=so(),n=r&&r.isTypedArray,o=n?e(n):t;return ln=o}function co(){if(pn)return gn;return pn=1,gn=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}}function uo(){if(dn)return mn;dn=1;var t=Ve(),e=ne(),r=Object.prototype.hasOwnProperty;return mn=function(n,o,i){var s=n[o];r.call(n,o)&&e(s,i)&&(void 0!==i||o in n)||t(n,o,i)}}function ho(){if(yn)return vn;yn=1;var t=uo(),e=Ve();return vn=function(r,n,o,i){var s=!o;o||(o={});for(var a=-1,c=n.length;++a<c;){var u=n[a],h=i?i(o[u],r[u],u,o,r):void 0;void 0===h&&(h=r[u]),s?e(o,u,h):t(o,u,h)}return o}}function lo(){if(wn)return bn;return wn=1,bn=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}}function fo(){if(xn)return Rn;xn=1;var t=/^(?:0|[1-9]\d*)$/;return Rn=function(e,r){var n=typeof e;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&t.test(e))&&e>-1&&e%1==0&&e<r}}function go(){if(kn)return _n;kn=1;var t=lo(),e=qr(),r=zr(),n=sn(),o=fo(),i=ao(),s=Object.prototype.hasOwnProperty;return _n=function(a,c){var u=r(a),h=!u&&e(a),l=!u&&!h&&n(a),f=!u&&!h&&!l&&i(a),g=u||h||l||f,p=g?t(a.length,String):[],m=p.length;for(var d in a)!c&&!s.call(a,d)||g&&("length"==d||l&&("offset"==d||"parent"==d)||f&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||o(d,m))||p.push(d);return p}}function po(){if(Cn)return Pn;return Cn=1,Pn=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}}function mo(){if(Nn)return $n;Nn=1;var t=we(),e=Wr(),r=po(),n=Object.prototype.hasOwnProperty;return $n=function(o){if(!t(o))return r(o);var i=e(o),s=[];for(var a in o)("constructor"!=a||!i&&n.call(o,a))&&s.push(a);return s}}function vo(){if(En)return jn;En=1;var t=go(),e=mo(),r=Dr();return jn=function(n){return r(n)?t(n,!0):e(n)}}function yo(){if(Tn)return Bn;Tn=1;var t=ho(),e=vo();return Bn=function(r){return t(r,e(r))}}function bo(){if(Sn)return On;Sn=1;var t=Je(),e=Br(),r=Sr(),n=Ar(),o=Mr(),i=qr(),s=zr(),a=Vr(),c=sn(),u=Re(),h=we(),l=an(),f=ao(),g=co(),p=yo();return On=function(m,d,v,y,b,w,R){var x=g(m,v),_=g(d,v),k=R.get(_);if(k)t(m,v,k);else{var P=w?w(x,_,v+"",m,d,R):void 0,C=void 0===P;if(C){var $=s(_),N=!$&&c(_),j=!$&&!N&&f(_);P=_,$||N||j?s(x)?P=x:a(x)?P=n(x):N?(C=!1,P=e(_,!0)):j?(C=!1,P=r(_,!0)):P=[]:l(_)||i(_)?(P=x,i(x)?P=p(x):h(x)&&!u(x)||(P=o(_))):C=!1}C&&(R.set(_,P),b(P,_,y,w,R),R.delete(_)),t(m,v,P)}}}function wo(){if(Ln)return An;Ln=1;var t=Ie(),e=Je(),r=Ye(),n=bo(),o=we(),i=vo(),s=co();return An=function a(c,u,h,l,f){c!==u&&r(u,(function(r,i){if(f||(f=new t),o(r))n(c,u,i,h,a,l,f);else{var g=l?l(s(c,i),r,i+"",c,u,f):void 0;void 0===g&&(g=r),e(c,i,g)}}),i)},An}function Ro(){if(Un)return Fn;return Un=1,Fn=function(t){return t}}function xo(){if(Mn)return Wn;return Mn=1,Wn=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}}function _o(){if(Hn)return Gn;Hn=1;var t=xo(),e=Math.max;return Gn=function(r,n,o){return n=e(void 0===n?r.length-1:n,0),function(){for(var i=arguments,s=-1,a=e(i.length-n,0),c=Array(a);++s<a;)c[s]=i[n+s];s=-1;for(var u=Array(n+1);++s<n;)u[s]=i[s];return u[n]=o(c),t(r,this,u)}},Gn}function ko(){if(zn)return qn;return zn=1,qn=function(t){return function(){return t}}}function Po(){if(Dn)return In;Dn=1;var t=ko(),e=De();return In=e?function(r,n){return e(r,"toString",{configurable:!0,enumerable:!1,value:t(n),writable:!0})}:Ro()}function Co(){if(Jn)return Vn;Jn=1;var t=Date.now;return Vn=function(e){var r=0,n=0;return function(){var o=t(),i=16-(o-n);if(n=o,i>0){if(++r>=800)return arguments[0]}else r=0;return e.apply(void 0,arguments)}},Vn}function $o(){if(Yn)return Kn;Yn=1;var t=Po(),e=Co()(t);return Kn=e}function No(){if(Xn)return Qn;Xn=1;var t=Ro(),e=_o(),r=$o();return Qn=function(n,o){return r(e(n,o,t),n+"")}}function jo(){if(to)return Zn;to=1;var t=ne(),e=Dr(),r=fo(),n=we();return Zn=function(o,i,s){if(!n(s))return!1;var a=typeof i;return!!("number"==a?e(s)&&r(i,s.length):"string"==a&&i in s)&&t(s[i],o)}}function Eo(){if(ro)return eo;ro=1;var t=No(),e=jo();return eo=function(r){return t((function(t,n){var o=-1,i=n.length,s=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(s=r.length>3&&"function"==typeof s?(i--,s):void 0,a&&e(n[0],n[1],a)&&(s=i<3?void 0:s,i=1),t=Object(t);++o<i;){var c=n[o];c&&r(t,c,o,s)}return t}))}}function Bo(){if(oo)return no;oo=1;var t=wo(),e=Eo()((function(e,r,n){t(e,r,n)}));return no=e}var To,Oo,So,Ao,Lo,Fo,Uo,Wo,Mo,Go,Ho,qo,zo,Io,Do,Vo,Jo,Ko,Yo,Qo,Xo,Zo,ti,ei,ri=ee(Bo());function ni(){if(Oo)return To;Oo=1;var t=be(),e=Gr();return To=function(r){return"symbol"==typeof r||e(r)&&"[object Symbol]"==t(r)}}function oi(){if(Ao)return So;Ao=1;var t=zr(),e=ni(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;return So=function(o,i){if(t(o))return!1;var s=typeof o;return!("number"!=s&&"symbol"!=s&&"boolean"!=s&&null!=o&&!e(o))||(n.test(o)||!r.test(o)||null!=i&&o in Object(i))}}function ii(){if(Fo)return Lo;Fo=1;var t=qe();function e(r,n){if("function"!=typeof r||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var o=function(){var t=arguments,e=n?n.apply(this,t):t[0],i=o.cache;if(i.has(e))return i.get(e);var s=r.apply(this,t);return o.cache=i.set(e,s)||i,s};return o.cache=new(e.Cache||t),o}return e.Cache=t,Lo=e}function si(){if(Wo)return Uo;Wo=1;var t=ii();return Uo=function(e){var r=t(e,(function(t){return 500===n.size&&n.clear(),t})),n=r.cache;return r}}function ai(){if(Go)return Mo;Go=1;var t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,e=/\\(\\)?/g,r=si()((function(r){var n=[];return 46===r.charCodeAt(0)&&n.push(""),r.replace(t,(function(t,r,o,i){n.push(o?i.replace(e,"$1"):r||t)})),n}));return Mo=r}function ci(){if(qo)return Ho;return qo=1,Ho=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}}function ui(){if(Io)return zo;Io=1;var t=de(),e=ci(),r=zr(),n=ni(),o=t?t.prototype:void 0,i=o?o.toString:void 0;return zo=function t(o){if("string"==typeof o)return o;if(r(o))return e(o,t)+"";if(n(o))return i?i.call(o):"";var s=o+"";return"0"==s&&1/o==-1/0?"-0":s},zo}function hi(){if(Vo)return Do;Vo=1;var t=ui();return Do=function(e){return null==e?"":t(e)}}function li(){if(Ko)return Jo;Ko=1;var t=zr(),e=oi(),r=ai(),n=hi();return Jo=function(o,i){return t(o)?o:e(o,i)?[o]:r(n(o))}}function fi(){if(Qo)return Yo;Qo=1;var t=ni();return Yo=function(e){if("string"==typeof e||t(e))return e;var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}}function gi(){if(Zo)return Xo;Zo=1;var t=li(),e=fi();return Xo=function(r,n){for(var o=0,i=(n=t(n,r)).length;null!=r&&o<i;)r=r[e(n[o++])];return o&&o==i?r:void 0},Xo}function pi(){if(ei)return ti;ei=1;var t=gi();return ti=function(e,r,n){var o=null==e?void 0:t(e,r);return void 0===o?n:o},ti}var mi=ee(pi());const di="package.json",vi=[".env.local",".env"];class yi extends zt.FeScriptContext{_env;shared;constructor(t){super(t),this._env=It.Env.searchEnv({logger:this.logger,preloadList:this.feConfig.envOrder||vi}),this.shared=Object.assign({},this.feConfig.release,this.getDefaultShreadOptions(t.shared))}getDefaultShreadOptions(t){return{rootPath:process.cwd(),sourceBranch:this._env.get("FE_RELEASE_BRANCH")||this._env.get("FE_RELEASE_SOURCE_BRANCH")||"master",releaseEnv:this._env.get("FE_RELEASE_ENV")||this._env.get("NODE_ENV")||"development",...t}}get rootPath(){return this.shared.rootPath}get sourceBranch(){return this.shared.sourceBranch}get releaseEnv(){return this.shared.releaseEnv}get env(){return this._env}get workspaces(){return this.getConfig("workspaces.workspaces")}get workspace(){return this.getConfig("workspaces.workspace")}setWorkspaces(t){this.options.workspaces={...this.options.workspaces,workspaces:t}}setConfig(t){this.options=ri(this.options,t)}getConfig(t,e){return mi(this.options,t,e)}setShared(t){this.shared=ri(this.shared,t)}getPkg(t,e){const r=this.workspace?.packageJson;if(!r)throw new Error("package.json is not found");return t?mi(r,t,e):r}getTemplateContext(){return{...this.shared,...this.workspace,publishPath:this.workspace?.path||"",env:this.releaseEnv,branch:this.sourceBranch}}async runChangesetsCli(t,e){let r="pnpm";try{await this.shell.exec("pnpm -v",{dryRun:!1})}catch{r="npm"}return await this.shell.exec(["pnpm"===r?"pnpm dlx":"npx","@changesets/cli",t,...e??[]])}}function bi(t,...e){return[t,...e]}const wi={maxWorkspace:3,multiWorkspaceSeparator:"_",workspaceVersionSeparator:"@",batchBranchName:"batch-${timestamp}-${releaseName}-${length}-packages"};class Ri{shell;logger;config;constructor(t,e,r={}){this.shell=t,this.logger=e,this.config={...wi,...r}}getReleaseBranchName(t,e,r){const n=r.branchName||"release-${tagName}";if("string"!=typeof n)throw new Error("Branch name template is not a string");return this.logger.verbose("Release Branch template is:",n),this.shell.format(n,{pkgName:t,releaseName:t,tagName:e,...r})}getBatchReleaseBranchName(t,e,r,n){const o=this.config.batchBranchName;if("string"!=typeof o)throw new Error("Branch name template is not a string");return this.logger.verbose("Release Batch Branch template is:",o),this.shell.format(o,{pkgName:t,releaseName:t,tagName:e,...r,length:n,timestamp:Date.now()})}getReleaseName(t){if(1===t.length)return t[0].name;const{maxWorkspace:e,multiWorkspaceSeparator:r,workspaceVersionSeparator:n}=this.config;return t.slice(0,e).map((({name:t,version:e})=>`${t}${n}${e}`)).join(r)}getReleaseTagName(t){return 1===t.length?t[0].version:`batch-${t.length}-${(new Date).toISOString().split("T")[0]}`}getReleaseBranchParams(t,e){const r=this.getReleaseTagName(t),n=this.getReleaseName(t);return{tagName:r,releaseBranch:t.length>1?this.getBatchReleaseBranchName(n,r,e,t.length):this.getReleaseBranchName(n,r,e)}}getPRTitle(t,e){const r=this.config.PRTitle||"Release ${env} ${pkgName} ${tagName}";return this.shell.format(r,{...e,tagName:t.tagName,pkgName:t.releaseBranch})}getPRBody(t,e,r){const n=this.config.PRBody,o=t.length>1?t.map((t=>this.shell.format("\n## ${name} ${version}\n${changelog}\n",t))).join("\n"):t[0].changelog,{workspaceVersionSeparator:i}=this.config,s=1===t.length?e.tagName:t.map((t=>`${t.name}${i}${t.version}`)).join(" ");return this.shell.format(n,{...r,tagName:s,changelog:o})}}class xi{context;_octokit=null;constructor(t){this.context=t}getGitHubUserInfo(){const{authorName:t,repoName:e}=this.context.shared;if(!t||!e)throw new Error("Author name or repo name is not set");return{owner:t,repo:e}}getToken(){const{tokenRef:t="GITHUB_TOKEN"}=this.context.getConfig("githubPR"),e=this.context.env.get(t);if(!e)throw new Error(`Token is not set. Please set ${t} environment variable.`);return e}get octokit(){if(this._octokit)return this._octokit;const{timeout:t}=this.context.getConfig("githubPR"),e={auth:this.getToken(),request:{timeout:t}};return this._octokit=new Vt.Octokit(e),this._octokit}get logger(){return this.context.logger}get shell(){return this.context.shell}get autoMergeType(){return this.context.shared.autoMergeType||"squash"}get dryRunPRNumber(){return this.context.getConfig("githubPR.dryRunPRNumber","999999")}get autoMergeReleasePR(){return this.context.shared.autoMergeReleasePR||false}async mergePR(t,e){if(!t)return void this.logger.error("Failed to create Pull Request.",t);const r=this.autoMergeType;if(this.context.dryRun){const{repoName:n,authorName:o}=this.context.shared;this.logger.info(`[DRY RUN] Would merge PR #${t} with method '${r}' in repo ${o}/${n}, branch ${e}`)}else await this.octokit.rest.pulls.merge({...this.getGitHubUserInfo(),pull_number:Number(t),merge_method:r})}async checkedPR(t,e){try{await this.octokit.rest.pulls.get({...this.getGitHubUserInfo(),pull_number:Number(t)}),await this.octokit.rest.git.deleteRef({...this.getGitHubUserInfo(),ref:`heads/${e}`}),this.logger.info(`Branch ${e} has been deleted`)}catch(r){if(404===r.status)return void this.logger.warn(`PR #${t} or branch ${e} not found`);throw this.logger.error("Failed to check PR or delete branch",r),r}}async createReleasePRLabel(){const t=this.context.shared.label;if(!(t&&t.name&&t.description&&t.color))throw new Error("Label is not valid, skipping creation");if(this.context.dryRun)return this.logger.info("[DRY RUN] Would create PR label with:",t),t;try{const e=await this.octokit.rest.issues.createLabel({...this.getGitHubUserInfo(),name:t.name,description:t.description,color:t.color.replace("#","")});return this.logger.debug("Create PR label Success",e),t}catch(e){if(422===e.status)return this.logger.warn(`Label ${t.name} already exists, skipping!`),t;throw this.logger.error("Create PR label Failed",e),e}}async createReleasePR(t){if(this.context.getConfig("githubPR.dryRunCreatePR")||this.context.dryRun)return this.logger.info("[DRY RUN] Would create PR with:",{...t,labels:t.labels}),this.dryRunPRNumber;try{const e=await this.octokit.rest.pulls.create({...this.getGitHubUserInfo(),...t}),r=e.data.number;if(!r)throw new Error("CreateReleasePR Failed, prNumber is empty");if(this.logger.debug("Create PR Success",[e?.url]),t.labels&&t.labels.length){const e=await this.octokit.rest.issues.addLabels({...this.getGitHubUserInfo(),issue_number:r,labels:t.labels});this.logger.debug("Add PR label Success",[e.url])}return r.toString()}catch(t){if(422===t.status&&t.message.includes("already exists")){this.logger.warn("PR already exists");const e=t.message.match(/pull request #(\d+)/);return e?e[1]:""}throw this.logger.error("Failed to create PR",t),t}}truncateBody(t){return t&&t.length>=124e3?t.substring(0,124e3)+"...":t}getOctokitReleaseOptions(t){const{releaseName:e,draft:r=!1,preRelease:n=!1,autoGenerate:o=!1,makeLatest:i=!0,releaseNotes:s,discussionCategoryName:a}=this.context.getConfig("githubPR"),c=e,u=o?"":this.truncateBody(String(s));return{name:c,make_latest:i.toString(),body:u,draft:r,prerelease:n,generate_release_notes:o,discussion_category_name:a,tag_name:"",...t,...this.getGitHubUserInfo()}}async createRelease(t){const e=this.getOctokitReleaseOptions({tag_name:t.tagName,body:t.changelog});if(e.name=this.shell.format(e.name,t),this.logger.exec(`octokit repos.createRelease "${e.name}" (${e.tag_name})`,{isDryRun:this.context.dryRun}),!e.tag_name)throw new Error("TagName is undefined");if(this.context.dryRun)return;const r=await this.octokit.repos.createRelease(e);this.logger.verbose(`octokit repos.createRelease: done (${r.headers.location})`)}}var _i,ki;function Pi(){if(ki)return _i;ki=1;var t=be(),e=zr(),r=Gr();return _i=function(n){return"string"==typeof n||!e(n)&&r(n)&&"[object String]"==t(n)}}var Ci=ee(Pi());class $i{context;pluginName;props;onlyOne=!0;constructor(t,e,r={}){this.context=t,this.pluginName=e,this.props=r,this.setConfig(this.getInitialProps(r))}getInitialProps(t){const e=this.context.options[this.pluginName],r=mi(this.context.shared,this.pluginName);return e||t?ri({},r,t,e):{}}get logger(){return this.context.logger}get shell(){return this.context.shell}get options(){return this.context.getConfig(this.pluginName,{})}getEnv(t,e){return this.context.env.get(t)??e}enabled(t,e){return!0}getConfig(t,e){return t?this.context.getConfig([this.pluginName,...Array.isArray(t)?t:[t]],e):this.context.getConfig(this.pluginName,e)}setConfig(t){this.context.setConfig({[this.pluginName]:t})}onBefore(t){}onExec(t){}onSuccess(t){}onError(t){}async step({label:t,task:e}){this.logger.obtrusive(t);try{const r=await e();return this.logger.info(`${t} - success`),r}catch(t){throw this.logger.error(t),t}}}class Ni extends $i{async onBefore(){const t=await this.getUserInfo();if(!t)throw new Error("Failed to get repoInfo");let e=this.context.shared.currentBranch;e||(e=await this.getCurrentBranch()),e&&await this.context.shell.exec(`git checkout ${e}`,{dryRun:!1}),this.context.setShared({repoName:t.repoName,authorName:t.authorName,currentBranch:e})}async getCurrentBranch(){return await new Promise((t=>setTimeout(t,100))),this.context.shell.exec("git rev-parse --abbrev-ref HEAD",{dryRun:!1})}async getRemoteUrl(){return(await this.context.shell.exec("git config --get remote.origin.url",{dryRun:!1})).trim()}async getUserInfo(){let t;try{t=await this.getRemoteUrl()}catch{throw new Error("Failed to get git remote url. Please ensure this is a git repository with a valid remote.")}if(!t)throw new Error("Git remote URL is empty. Please set a valid GitHub remote URL.");this.context.logger.verbose("repoUrl: ",t);const e=t.match(/github\.com[:/]([^/]+)\/([^/.]+)(?:\.git)?$/);if(!e)throw new Error("Invalid GitHub repository URL format. Please ensure the remote URL is from GitHub.");const[,r,n]=e;if(!this.isValidString(r)||!this.isValidString(n))throw new Error("Failed to extract owner or repository name from GitHub URL");return{repoName:n,authorName:r}}isValidString(t){return!!t&&Ci(t)}commit(t,e=[]){return this.context.shell.exec(["git","commit","--message",JSON.stringify(t),...e])}}class ji{options;constructor(t){this.options=t}compare(t,e){return"function"==typeof this.options.compare?this.options.compare(t,e):t.startsWith(e)}toChangeLabel(t,e=this.options.changePackagesLabel){return e.replace("${name}",t)}toChangeLabels(t,e=this.options.changePackagesLabel){return t.map((t=>this.toChangeLabel(t,e)))}pick(t,e=this.options.packagesDirectories){const r=[];for(const n of e)for(const e of t)if(this.compare(e,n)){r.push(n);break}return r}}class Ei{static readJson(t){const e=Kt.readFileSync(t,"utf-8");return JSON.parse(e)}static toWorkspace(t,e){let{root:r,packageJson:n}=t;const o=t.path;if(!o)throw new Error("path is not required!");return r=r||Yt.join(e,o),n=n||Ei.readJson(Yt.join(r,di)),{name:n.name,version:n.version,path:o,root:r,packageJson:n}}}class Bi extends $i{releaseTask=null;workspacesList=[];_skip=!1;releaseLabel;constructor(t){super(t,"workspaces"),this.releaseLabel=new ji({changePackagesLabel:this.context.shared.changePackagesLabel||"change:${name}",packagesDirectories:this.context.shared.packagesDirectories||[]})}enabled(){return!this._skip&&!this.getConfig("skip")}async onBefore(){const t=this.getConfig("workspace");if(t)return this.logger.debug("Use the specified workspace",t),void this.setCurrentWorkspace(t,[]);const e=await this.getWorkspaces();if(this.getConfig("skipCheckPackage")||0===e.length)throw new Error("No changes to publish packages");const{publishPath:r}=this.context.shared;if(r){const t=e.find((t=>Jt.resolve(t.root)===Jt.resolve(r)));if(this.nextSkip(),!t)throw new Error(`No workspace found for: ${r}`);return this.logger.debug(`Workspace of ${r} find!`,Jt.join(t.root,di)),void this.setCurrentWorkspace(t,[t])}const[n,...o]=e;this.workspacesList=o,this.setCurrentWorkspace(n,e)}nextSkip(){this._skip=!0,this.logger.debug("skip next workspace")}setReleaseTask(t){this.releaseTask=t}setCurrentWorkspace(t,e){this.context.setShared({publishPath:t.path}),this.setConfig({workspace:t,workspaces:e})}getPackages(){const t=this.context.shared.packagesDirectories;return Array.isArray(t)?t:[]}async getGitWorkspaces(){const t=this.context.sourceBranch,e=await this.shell.exec(`git diff --name-only origin/${t}...HEAD`,{dryRun:!1});return"string"==typeof e?e.split("\n"):[]}async getChangedPackages(t,e){if(this.logger.debug("changeLabels",e),Array.isArray(e)&&e.length>0){const r=t.filter((t=>{const r=this.releaseLabel.toChangeLabel(t);return e.includes(r)}));return this.logger.debug("changed by labels",r),r}const r=await this.getGitWorkspaces();return this.logger.debug("changed by git",r),this.releaseLabel.pick(r,t)}async getWorkspaces(){const t=this.getPackages();this.logger.debug("packages",t);const e=await this.getChangedPackages(t,this.getConfig("changeLabels"));this.logger.debug("changedPaths",e);const r=e.map((t=>Ei.toWorkspace({path:t},this.context.rootPath)));return r}}function Ti(t,...e){return"function"==typeof t&&t.prototype&&t.prototype.constructor===t?new t(...e):t(...e)}function Oi(t){return t.startsWith(".")?Jt.parse(t).name:t}async function Si(t){let e=null;try{e=(await import(t)).default}catch{try{e=(await import(Jt.join(process.cwd(),t))).default}catch{const r=Qt.createRequire(process.cwd());e=(await import(Xt.pathToFileURL(r.resolve(t,{paths:[process.cwd()]})).href)).default}}return[Oi(t),e]}async function Ai(t,e,r=5){const n=Zt(r),o=e.map((([e,...r])=>n((()=>(async(e,...r)=>{if("string"==typeof e){const[,n]=await Si(e);return Ti(n,t,...r)}return Ti(e,t,...r)})(e,...r)))));return Promise.all(o)}class Li{formatFlatCommits(t,e,r){const{types:n=[],formatTemplate:o="* ${message}${prRef}\n"}=e,i=new Map;for(const e of t){const t=e.type||"other";i.has(t)||i.set(t,[]),i.get(t).push(e)}const s=[];for(const{type:t,section:e,hidden:a}of n){if(a)continue;const n=i.get(t);if(n?.length){s.push(`${e||t}`);for(const t of n){const e=t.prNumber?` (#${t.prNumber})`:"";if(s.push(r.format(o,{...t,prRef:e})),t.body){const e=t.body.split("\n").map((t=>` ${t}`));s.push(e.join("\n"))}}}}return s}}class Fi{shell;options;constructor(t,e){this.shell=t,this.options=e}parseCommitBody(t){const e=t.split("\n").filter(Boolean),r=[];let n=null;for(let t=0;t<e.length;t++){const o=e[t].trim();if(o.startsWith("Co-authored-by:")||"---------"===o||0===o.length)continue;const i=o.match(/^\*?\s*(?:([a-z]+)(?:\((.*?)\))?: )?(.+)$/i);if(i&&o.startsWith("*")){n&&r.push({...n,body:n.bodyLines?.join("\n").trim()});const[t,e,s,a]=i;n={matchRaw:t,raw:o,type:e?.toLowerCase(),scope:s?.trim(),message:a.trim(),bodyLines:[]}}else n&&o.startsWith("-")&&n.bodyLines?.push(o)}return n&&r.push({...n,body:n.bodyLines?.join("\n").trim()}),r}async getPRCommits(t){const{from:e,to:r,directory:n,format:o}={...this.options,...t};return(await this.getLog({from:e,to:r,directory:n,format:o,noMerges:!1})).split("\n----------------------\n").filter(Boolean).map((t=>{const[e,r,...n]=t.trim().split("\n"),o=n.join("\n"),i=r.match(/\(#(\d+)\)/),s=r.replace(/\s*\(#\d+\)\s*$/,"").match(/^(?:([a-z]+)(?:\((.*?)\))?: )?(.+)$/i);return{hash:e,raw:{title:r,body:o},title:s?{type:s[1]?.toLowerCase(),scope:s[2]?.trim(),message:s[3].trim()}:{message:r.replace(/\s*\(#\d+\)\s*$/,"").trim()},commits:this.parseCommitBody(o),prNumber:i?.[1]}}))}async hasTag(t){return this.shell.exec(`git tag --list "${t}"`,{dryRun:!1}).then((()=>!0)).catch((()=>!1))}async resolveTag(t,e){if(t)try{if(await this.shell.exec(`git tag --list "${t}"`,{dryRun:!1}).then((t=>!!t.trim())))return t}catch{}return"root"===e?this.shell.exec("git rev-list --max-parents=0 HEAD",{dryRun:!1}).then((t=>t.trim())):"HEAD"}async getLog(t){const{directory:e,format:r="%H%n%s%n%b%n----------------------",noMerges:n=!0}=t,o=await this.resolveTag(t.from,"root"),i=await this.resolveTag(t.to,"HEAD"),s=`git log --pretty=format:"${r}" ${n?"--no-merges":""} ${o===i?i:`${o}..${i}`} ${e?`-- "${e}"`:""}`;return this.shell.exec(s.trim(),{dryRun:!1})}flatCommits(t){const e=[];for(const r of t){const t={title:r.title,raw:r.raw,hash:r.hash,prNumber:r.prNumber},n=r.commits.map((e=>({...e,prNumber:r.prNumber,hash:r.hash,parentHash:r.hash,parentCommit:t})));e.push(...n)}return e}formatFlatCommits(t,e){const{types:r=[],formatter:n}={...this.options,...e};return(n||new Li).formatFlatCommits(t,{types:r},this.shell)}}const Ui=[bi(Bi),bi(class extends $i{constructor(t,e){super(t,"changelog",{increment:"patch",changesetRoot:".changeset",tagTemplate:"${name}@${version}",tagPrefix:"${name}",tagMatch:"${name}@*",...e})}get changesetRoot(){return Yt.join(this.context.rootPath,this.getConfig("changesetRoot"))}enabled(){return!this.getConfig("skip")}async onBefore(){if(!Kt.existsSync(this.changesetRoot))throw new Error(`Changeset directory ${this.changesetRoot} does not exist`);this.logger.debug(`${this.changesetRoot} exists`)}mergeWorkspaces(t){return t.map((t=>{const e=Ei.toWorkspace({path:t.path},this.context.rootPath),r={...t,version:e.version};return r.tagName=this.generateTagName(r),r}))}async onExec(){const t=await this.step({label:"Generate Changelogs",task:()=>Promise.all(this.context.workspaces.map((t=>this.generateChangelog(t))))});this.getConfig("skipChangeset")?this.logger.debug("Skip generate changeset files"):(await this.step({label:"Changeset Version",task:()=>Promise.all(t.map((t=>this.generateChangesetFile(t))))}),await this.context.runChangesetsCli("version",["--no-changelog"]));const e=this.mergeWorkspaces(t);this.logger.debug("new workspaces",e),this.context.setWorkspaces(e)}getTagPrefix(t){return this.shell.format(this.getConfig("tagPrefix"),t)}async createChangelog({lastTag:t,workspace:e}){const r=new Fi(this.context.shell,{...this.getConfig("gitChangelogOptions"),from:t,directory:e.path});return r.getPRCommits().then((t=>{const e=r.flatCommits(t);return r.formatFlatCommits(e).join("\n")}))}async generateChangelog(t){const e=await this.getTagName(t);this.logger.verbose("tagName is:",e);const r=await this.createChangelog({workspace:t,lastTag:e});return{...t,lastTag:e,changelog:r}}generateTagName(t){try{const e=this.getConfig("tagTemplate");return this.shell.format(e,t)}catch(e){return console.error(`Error generating tag name for ${t.name}:`,e),`${t.name}-v0.0.0`}}async getTagName(t){try{const e=this.generateTagName(t),r=this.shell.format(this.getConfig("tagMatch"),t),n=await this.shell.exec(`git for-each-ref --sort=-creatordate --format "%(refname:short)|%(creatordate:iso8601)" "refs/tags/${r}"`,{dryRun:!1});if(this.logger.debug("tagsOutput",n),!n)return e;const o=n.split("\n").filter(Boolean);if(0===o.length)return e;return o[0].split("|")[0]}catch(e){console.error(`Error getting tag for ${t.name}:`,e);return this.generateTagName(t)}}getIncrement(){const t=this.context.getConfig("workspaces.changeLabels");if(Array.isArray(t)&&t.length>0){if(t.includes("increment:major"))return"major";if(t.includes("increment:minor"))return"minor"}return this.getConfig("increment","patch")}async generateChangesetFile(t){const{name:e,version:r}=t,n=`${e}-${r}`.replace(/[\/\\]/g,"_"),o=Yt.join(this.changesetRoot,`${n}.md`),i=this.getIncrement();this.logger.verbose("increment is:",[i]);const s=this.shell.format("---\n'${name}': '${increment}'\n---\n${changelog}",{...t,increment:i});if(this.context.dryRun)return this.logger.info(`Changeset [${o}] will be created, content is:`),void this.logger.log(s);Kt.existsSync(o)?this.logger.info(`Changeset ${n} already exists`):Kt.writeFileSync(o,s,"utf-8")}},{}),bi(class extends Ni{context;releaseParams;githubManager;constructor(t,e){super(t,"githubPR",{releaseName:"Release ${name} v${version}",...e}),this.context=t,this.githubManager=new xi(this.context),this.releaseParams=new Ri(t.shell,t.logger,{PRTitle:this.getConfig("PRTitle",this.context.shared.PRTitle),PRBody:this.getConfig("PRBody",this.context.shared.PRBody),...this.props})}enabled(t){return!this.getConfig("skip")&&("onExec"===t?!this.isPublish:"onSuccess"!==t||this.isPublish)}get isPublish(){return!this.getConfig("releasePR")}async isGithubRepository(){try{return(await this.getRemoteUrl()).includes("github.com")}catch{return!1}}async onBefore(){this.logger.verbose("GithubPR onBefore");if(!await this.isGithubRepository())throw new Error("Current repository is not a GitHub repository. GitHub PR workflow is only available for GitHub repositories.");if(await super.onBefore(),this.isPublish){const t=this.getEnv("NPM_TOKEN");if(!t)throw new Error("NPM_TOKEN is not set");await this.shell.exec(`npm config set //registry.npmjs.org/:_authToken=${t}`)}}async onExec(){const t=this.context.workspaces;await this.step({label:"Release Commit",task:()=>this.relesaeCommit(t)});const e=await this.step({label:"Create Release Branch",task:()=>this.createReleaseBranch(t)});await this.releasePullRequest(t,e)}async onSuccess(){const t=this.context.workspaces;this.getConfig("dryRunCreatePR")||(await this.context.runChangesetsCli("publish"),await this.shell.exec("git push origin --tags")),await this.step({label:"Release Github",task:()=>Promise.all(t.map((t=>(this.logger.debug(t),this.githubManager.createRelease(t)))))})}async relesaeCommit(t){const e=this.getConfig("commitArgs",[]);if(1===t.length)return await this.shell.exec("git add ."),void await this.commitWorkspace(t[0],e);await this.shell.exec("git add .");const r=`chore(tag): ${t.map((t=>`${t.name} v${t.version}`)).join(",")}`;await this.commit(r,e)}async releasePullRequest(t,e){const r=await this.step({label:"Create Release PR",task:()=>this.createReleasePR(t,e)});if(this.githubManager.autoMergeReleasePR){const{releaseBranch:t}=e;return await this.step({label:`Merge Release PR(${r})`,task:()=>this.githubManager.mergePR(r,t)}),void await this.step({label:`Checked Release PR(${r})`,task:()=>this.githubManager.checkedPR(r,t)})}this.logger.info(`Please manually merge PR(#${r}) and complete the publishing process afterwards`)}async commitWorkspace(t,e=[]){const r=this.shell.format(this.getConfig("commitMessage","chore(tag): ${name} v${version}"),t);return await this.commit(r,e)}async createReleaseBranch(t){const e=this.releaseParams.getReleaseBranchParams(t,this.context.getTemplateContext()),{tagName:r,releaseBranch:n}=e;if("string"!=typeof r)throw new Error("Tag name is not a string");const{sourceBranch:o,currentBranch:i}=this.context.shared;this.context.logger.verbose("PR TagName is:",r),this.context.logger.verbose("PR CurrentBranch is:",i),this.context.logger.verbose("PR SourceBranch is:",o),this.context.logger.verbose("PR ReleaseBranch is:",n);try{await this.context.shell.exec(`git fetch origin ${o} ${i}`),await this.context.shell.exec(`git checkout -b ${n} ${i}`),await this.context.shell.exec(`git push origin ${n}`)}catch(t){throw t.message.includes("remote: Permission to ")&&this.context.logger.warn('Token maybe not allow Workflow permissions, can you try to open "Workflow permissions" -> "Read and write permissions" for this token?'),t}return{tagName:r,releaseBranch:n}}async createReleasePR(t,e){let r=[(await this.githubManager.createReleasePRLabel()).name];if(this.getConfig("pushChangeLabels")){const t=this.context.getConfig("workspaces.changeLabels");Array.isArray(t)&&t.length>0&&r.push(...t)}r=Array.from(new Set(r)),this.logger.verbose("Release PR labels:",r);const n=this.context.getTemplateContext(),o=this.releaseParams.getPRTitle(e,n),i=this.releaseParams.getPRBody(t,e,n);return this.githubManager.createReleasePR({title:o,body:i,base:this.context.sourceBranch,head:e.releaseBranch,labels:r})}},{})];var Wi,Mi,Gi,Hi;function qi(){if(Mi)return Wi;Mi=1;var t=uo(),e=li(),r=fo(),n=we(),o=fi();return Wi=function(i,s,a,c){if(!n(i))return i;for(var u=-1,h=(s=e(s,i)).length,l=h-1,f=i;null!=f&&++u<h;){var g=o(s[u]),p=a;if("__proto__"===g||"constructor"===g||"prototype"===g)return i;if(u!=l){var m=f[g];void 0===(p=c?c(m,g,f):void 0)&&(p=n(m)?m:r(s[u+1])?[]:{})}t(f,g,p),f=f[g]}return i},Wi}function zi(){if(Hi)return Gi;Hi=1;var t=qi();return Gi=function(e,r,n){return null==e?e:t(e,r,n)},Gi}var Ii=ee(zi());exports.Plugin=$i,exports.ReleaseContext=yi,exports.ReleaseLabel=ji,exports.ReleaseTask=class{executor;defaultTuples;context;constructor(t={},e=new Dt.AsyncExecutor,r=Ui){this.executor=e,this.defaultTuples=r,this.context=new yi(t)}getContext(){return this.context}async usePlugins(t){t=t||this.context.shared.plugins||[];const e=await Ai(this.context,[...this.defaultTuples,...t]);return e.forEach((t=>{t instanceof Bi&&t.setReleaseTask(this),this.executor.use(t)})),e}async run(){return this.executor.exec(this.context,(t=>Promise.resolve(t)))}async exec(t){if("false"===this.context.env.get("FE_RELEASE"))throw new Error("Skip Release");return await this.usePlugins(t),this.run()}},exports.factory=Ti,exports.load=Si,exports.loaderPluginsFromPluginTuples=Ai,exports.reduceOptions=function(t,e){return Object.entries(t).reduce(((t,[r,n])=>(r.includes(".")?Ii(t,r,n):Ii(t,e?`${e}.${r}`:r,n),t)),{})},exports.tuple=bi;
|
package/dist/index.d.ts
CHANGED
|
@@ -204,6 +204,12 @@ interface GithubPRProps extends ReleaseParamsConfig, GitBaseProps {
|
|
|
204
204
|
* @default undefined
|
|
205
205
|
*/
|
|
206
206
|
discussionCategoryName?: string;
|
|
207
|
+
/**
|
|
208
|
+
* Whether to push the changed labels to the release PR
|
|
209
|
+
*
|
|
210
|
+
* @default false
|
|
211
|
+
*/
|
|
212
|
+
pushChangeLabels?: boolean;
|
|
207
213
|
}
|
|
208
214
|
|
|
209
215
|
interface ExecutorReleaseContext extends ExecutorContext<ReleaseContext> {
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FeScriptContext as t}from"@qlover/scripts-context";import{Env as e}from"@qlover/env-loader";import{AsyncExecutor as r}from"@qlover/fe-corekit";import{Octokit as n}from"@octokit/rest";import{resolve as o,join as i,parse as a}from"node:path";import{readFileSync as s,existsSync as c,writeFileSync as u}from"fs";import{join as h}from"path";import{createRequire as l}from"node:module";import{pathToFileURL as f}from"node:url";import g from"p-limit";import p from"conventional-changelog";var d,m,v,y,b,w,R,x,_,k,P,C,$,N,j,E,B,O,T,S,A,L,U,W,F,G,M,I,z,H,D,q,V,J,K,Y,Q,X,Z,tt,et,rt,nt,ot,it,at,st,ct,ut,ht,lt,ft,gt,pt,dt,mt,vt,yt,bt,wt,Rt,xt,_t,kt,Pt,Ct,$t,Nt,jt,Et,Bt,Ot,Tt,St,At,Lt,Ut,Wt,Ft,Gt,Mt,It,zt,Ht,Dt,qt,Vt,Jt,Kt,Yt,Qt,Xt,Zt,te,ee,re,ne,oe,ie="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ae(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function se(){if(m)return d;return m=1,d=function(){this.__data__=[],this.size=0}}function ce(){if(y)return v;return y=1,v=function(t,e){return t===e||t!=t&&e!=e}}function ue(){if(w)return b;w=1;var t=ce();return b=function(e,r){for(var n=e.length;n--;)if(t(e[n][0],r))return n;return-1}}function he(){if(x)return R;x=1;var t=ue(),e=Array.prototype.splice;return R=function(r){var n=this.__data__,o=t(n,r);return!(o<0)&&(o==n.length-1?n.pop():e.call(n,o,1),--this.size,!0)}}function le(){if(k)return _;k=1;var t=ue();return _=function(e){var r=this.__data__,n=t(r,e);return n<0?void 0:r[n][1]}}function fe(){if(C)return P;C=1;var t=ue();return P=function(e){return t(this.__data__,e)>-1}}function ge(){if(N)return $;N=1;var t=ue();return $=function(e,r){var n=this.__data__,o=t(n,e);return o<0?(++this.size,n.push([e,r])):n[o][1]=r,this}}function pe(){if(E)return j;E=1;var t=se(),e=he(),r=le(),n=fe(),o=ge();function i(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,j=i}function de(){if(O)return B;O=1;var t=pe();return B=function(){this.__data__=new t,this.size=0}}function me(){if(S)return T;return S=1,T=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}}function ve(){if(L)return A;return L=1,A=function(t){return this.__data__.get(t)}}function ye(){if(W)return U;return W=1,U=function(t){return this.__data__.has(t)}}function be(){if(G)return F;G=1;var t="object"==typeof ie&&ie&&ie.Object===Object&&ie;return F=t}function we(){if(I)return M;I=1;var t=be(),e="object"==typeof self&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return M=r}function Re(){if(H)return z;H=1;var t=we().Symbol;return z=t}function xe(){if(q)return D;q=1;var t=Re(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,o=t?t.toStringTag:void 0;return D=function(t){var e=r.call(t,o),i=t[o];try{t[o]=void 0;var a=!0}catch(t){}var s=n.call(t);return a&&(e?t[o]=i:delete t[o]),s}}function _e(){if(J)return V;J=1;var t=Object.prototype.toString;return V=function(e){return t.call(e)}}function ke(){if(Y)return K;Y=1;var t=Re(),e=xe(),r=_e(),n=t?t.toStringTag:void 0;return K=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":n&&n in Object(t)?e(t):r(t)}}function Pe(){if(X)return Q;return X=1,Q=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}}function Ce(){if(tt)return Z;tt=1;var t=ke(),e=Pe();return Z=function(r){if(!e(r))return!1;var n=t(r);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}}function $e(){if(rt)return et;rt=1;var t=we()["__core-js_shared__"];return et=t}function Ne(){if(ot)return nt;ot=1;var t,e=$e(),r=(t=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||""))?"Symbol(src)_1."+t:"";return nt=function(t){return!!r&&r in t}}function je(){if(at)return it;at=1;var t=Function.prototype.toString;return it=function(e){if(null!=e){try{return t.call(e)}catch(t){}try{return e+""}catch(t){}}return""}}function Ee(){if(ct)return st;ct=1;var t=Ce(),e=Ne(),r=Pe(),n=je(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,a=Object.prototype,s=i.toString,c=a.hasOwnProperty,u=RegExp("^"+s.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return st=function(i){return!(!r(i)||e(i))&&(t(i)?u:o).test(n(i))}}function Be(){if(ht)return ut;return ht=1,ut=function(t,e){return null==t?void 0:t[e]}}function Oe(){if(ft)return lt;ft=1;var t=Ee(),e=Be();return lt=function(r,n){var o=e(r,n);return t(o)?o:void 0}}function Te(){if(pt)return gt;pt=1;var t=Oe()(we(),"Map");return gt=t}function Se(){if(mt)return dt;mt=1;var t=Oe()(Object,"create");return dt=t}function Ae(){if(yt)return vt;yt=1;var t=Se();return vt=function(){this.__data__=t?t(null):{},this.size=0}}function Le(){if(wt)return bt;return wt=1,bt=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}}function Ue(){if(xt)return Rt;xt=1;var t=Se(),e=Object.prototype.hasOwnProperty;return Rt=function(r){var n=this.__data__;if(t){var o=n[r];return"__lodash_hash_undefined__"===o?void 0:o}return e.call(n,r)?n[r]:void 0}}function We(){if(kt)return _t;kt=1;var t=Se(),e=Object.prototype.hasOwnProperty;return _t=function(r){var n=this.__data__;return t?void 0!==n[r]:e.call(n,r)}}function Fe(){if(Ct)return Pt;Ct=1;var t=Se();return Pt=function(e,r){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=t&&void 0===r?"__lodash_hash_undefined__":r,this}}function Ge(){if(Nt)return $t;Nt=1;var t=Ae(),e=Le(),r=Ue(),n=We(),o=Fe();function i(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,$t=i}function Me(){if(Et)return jt;Et=1;var t=Ge(),e=pe(),r=Te();return jt=function(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}}function Ie(){if(Ot)return Bt;return Ot=1,Bt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}}function ze(){if(St)return Tt;St=1;var t=Ie();return Tt=function(e,r){var n=e.__data__;return t(r)?n["string"==typeof r?"string":"hash"]:n.map}}function He(){if(Lt)return At;Lt=1;var t=ze();return At=function(e){var r=t(this,e).delete(e);return this.size-=r?1:0,r}}function De(){if(Wt)return Ut;Wt=1;var t=ze();return Ut=function(e){return t(this,e).get(e)}}function qe(){if(Gt)return Ft;Gt=1;var t=ze();return Ft=function(e){return t(this,e).has(e)}}function Ve(){if(It)return Mt;It=1;var t=ze();return Mt=function(e,r){var n=t(this,e),o=n.size;return n.set(e,r),this.size+=n.size==o?0:1,this}}function Je(){if(Ht)return zt;Ht=1;var t=Me(),e=He(),r=De(),n=qe(),o=Ve();function i(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,zt=i}function Ke(){if(qt)return Dt;qt=1;var t=pe(),e=Te(),r=Je();return Dt=function(n,o){var i=this.__data__;if(i instanceof t){var a=i.__data__;if(!e||a.length<199)return a.push([n,o]),this.size=++i.size,this;i=this.__data__=new r(a)}return i.set(n,o),this.size=i.size,this}}function Ye(){if(Jt)return Vt;Jt=1;var t=pe(),e=de(),r=me(),n=ve(),o=ye(),i=Ke();function a(e){var r=this.__data__=new t(e);this.size=r.size}return a.prototype.clear=e,a.prototype.delete=r,a.prototype.get=n,a.prototype.has=o,a.prototype.set=i,Vt=a}function Qe(){if(Yt)return Kt;Yt=1;var t=Oe(),e=function(){try{var e=t(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();return Kt=e}function Xe(){if(Xt)return Qt;Xt=1;var t=Qe();return Qt=function(e,r,n){"__proto__"==r&&t?t(e,r,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[r]=n}}function Ze(){if(te)return Zt;te=1;var t=Xe(),e=ce();return Zt=function(r,n,o){(void 0!==o&&!e(r[n],o)||void 0===o&&!(n in r))&&t(r,n,o)}}function tr(){if(re)return ee;return re=1,ee=function(t){return function(e,r,n){for(var o=-1,i=Object(e),a=n(e),s=a.length;s--;){var c=a[t?s:++o];if(!1===r(i[c],c,i))break}return e}}}function er(){if(oe)return ne;oe=1;var t=tr()();return ne=t}var rr,nr,or,ir,ar,sr,cr,ur,hr,lr,fr,gr,pr,dr,mr,vr,yr,br,wr,Rr,xr,_r,kr,Pr,Cr,$r,Nr,jr,Er,Br,Or,Tr,Sr,Ar={exports:{}};function Lr(){return rr||(rr=1,t=Ar,e=Ar.exports,r=we(),n=e&&!e.nodeType&&e,o=n&&t&&!t.nodeType&&t,i=o&&o.exports===n?r.Buffer:void 0,a=i?i.allocUnsafe:void 0,t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=a?a(r):new t.constructor(r);return t.copy(n),n}),Ar.exports;var t,e,r,n,o,i,a}function Ur(){if(or)return nr;or=1;var t=we().Uint8Array;return nr=t}function Wr(){if(ar)return ir;ar=1;var t=Ur();return ir=function(e){var r=new e.constructor(e.byteLength);return new t(r).set(new t(e)),r}}function Fr(){if(cr)return sr;cr=1;var t=Wr();return sr=function(e,r){var n=r?t(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}}function Gr(){if(hr)return ur;return hr=1,ur=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}}function Mr(){if(fr)return lr;fr=1;var t=Pe(),e=Object.create,r=function(){function r(){}return function(n){if(!t(n))return{};if(e)return e(n);r.prototype=n;var o=new r;return r.prototype=void 0,o}}();return lr=r}function Ir(){if(pr)return gr;return pr=1,gr=function(t,e){return function(r){return t(e(r))}}}function zr(){if(mr)return dr;mr=1;var t=Ir()(Object.getPrototypeOf,Object);return dr=t}function Hr(){if(yr)return vr;yr=1;var t=Object.prototype;return vr=function(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||t)}}function Dr(){if(wr)return br;wr=1;var t=Mr(),e=zr(),r=Hr();return br=function(n){return"function"!=typeof n.constructor||r(n)?{}:t(e(n))}}function qr(){if(xr)return Rr;return xr=1,Rr=function(t){return null!=t&&"object"==typeof t}}function Vr(){if(kr)return _r;kr=1;var t=ke(),e=qr();return _r=function(r){return e(r)&&"[object Arguments]"==t(r)}}function Jr(){if(Cr)return Pr;Cr=1;var t=Vr(),e=qr(),r=Object.prototype,n=r.hasOwnProperty,o=r.propertyIsEnumerable,i=t(function(){return arguments}())?t:function(t){return e(t)&&n.call(t,"callee")&&!o.call(t,"callee")};return Pr=i}function Kr(){if(Nr)return $r;Nr=1;var t=Array.isArray;return $r=t}function Yr(){if(Er)return jr;Er=1;return jr=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}}function Qr(){if(Or)return Br;Or=1;var t=Ce(),e=Yr();return Br=function(r){return null!=r&&e(r.length)&&!t(r)}}function Xr(){if(Sr)return Tr;Sr=1;var t=Qr(),e=qr();return Tr=function(r){return e(r)&&t(r)}}var Zr,tn,en,rn,nn,on,an,sn,cn,un={exports:{}};function hn(){if(tn)return Zr;return tn=1,Zr=function(){return!1}}function ln(){return en||(en=1,function(t,e){var r=we(),n=hn(),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,a=i&&i.exports===o?r.Buffer:void 0,s=(a?a.isBuffer:void 0)||n;t.exports=s}(un,un.exports)),un.exports}function fn(){if(nn)return rn;nn=1;var t=ke(),e=zr(),r=qr(),n=Function.prototype,o=Object.prototype,i=n.toString,a=o.hasOwnProperty,s=i.call(Object);return rn=function(n){if(!r(n)||"[object Object]"!=t(n))return!1;var o=e(n);if(null===o)return!0;var c=a.call(o,"constructor")&&o.constructor;return"function"==typeof c&&c instanceof c&&i.call(c)==s}}function gn(){if(an)return on;an=1;var t=ke(),e=Yr(),r=qr(),n={};return n["[object Float32Array]"]=n["[object Float64Array]"]=n["[object Int8Array]"]=n["[object Int16Array]"]=n["[object Int32Array]"]=n["[object Uint8Array]"]=n["[object Uint8ClampedArray]"]=n["[object Uint16Array]"]=n["[object Uint32Array]"]=!0,n["[object Arguments]"]=n["[object Array]"]=n["[object ArrayBuffer]"]=n["[object Boolean]"]=n["[object DataView]"]=n["[object Date]"]=n["[object Error]"]=n["[object Function]"]=n["[object Map]"]=n["[object Number]"]=n["[object Object]"]=n["[object RegExp]"]=n["[object Set]"]=n["[object String]"]=n["[object WeakMap]"]=!1,on=function(o){return r(o)&&e(o.length)&&!!n[t(o)]}}function pn(){if(cn)return sn;return cn=1,sn=function(t){return function(e){return t(e)}}}var dn,mn,vn,yn,bn,wn,Rn,xn,_n,kn,Pn,Cn,$n,Nn,jn,En,Bn,On,Tn,Sn,An,Ln,Un,Wn,Fn,Gn,Mn,In,zn,Hn,Dn,qn,Vn,Jn,Kn,Yn,Qn,Xn,Zn,to,eo,ro,no,oo,io,ao,so,co,uo,ho={exports:{}};function lo(){return dn||(dn=1,t=ho,e=ho.exports,r=be(),n=e&&!e.nodeType&&e,o=n&&t&&!t.nodeType&&t,i=o&&o.exports===n&&r.process,a=function(){try{var t=o&&o.require&&o.require("util").types;return t||i&&i.binding&&i.binding("util")}catch(t){}}(),t.exports=a),ho.exports;var t,e,r,n,o,i,a}function fo(){if(vn)return mn;vn=1;var t=gn(),e=pn(),r=lo(),n=r&&r.isTypedArray,o=n?e(n):t;return mn=o}function go(){if(bn)return yn;return bn=1,yn=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}}function po(){if(Rn)return wn;Rn=1;var t=Xe(),e=ce(),r=Object.prototype.hasOwnProperty;return wn=function(n,o,i){var a=n[o];r.call(n,o)&&e(a,i)&&(void 0!==i||o in n)||t(n,o,i)}}function mo(){if(_n)return xn;_n=1;var t=po(),e=Xe();return xn=function(r,n,o,i){var a=!o;o||(o={});for(var s=-1,c=n.length;++s<c;){var u=n[s],h=i?i(o[u],r[u],u,o,r):void 0;void 0===h&&(h=r[u]),a?e(o,u,h):t(o,u,h)}return o}}function vo(){if(Pn)return kn;return Pn=1,kn=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}}function yo(){if($n)return Cn;$n=1;var t=/^(?:0|[1-9]\d*)$/;return Cn=function(e,r){var n=typeof e;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&t.test(e))&&e>-1&&e%1==0&&e<r}}function bo(){if(jn)return Nn;jn=1;var t=vo(),e=Jr(),r=Kr(),n=ln(),o=yo(),i=fo(),a=Object.prototype.hasOwnProperty;return Nn=function(s,c){var u=r(s),h=!u&&e(s),l=!u&&!h&&n(s),f=!u&&!h&&!l&&i(s),g=u||h||l||f,p=g?t(s.length,String):[],d=p.length;for(var m in s)!c&&!a.call(s,m)||g&&("length"==m||l&&("offset"==m||"parent"==m)||f&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||o(m,d))||p.push(m);return p}}function wo(){if(Bn)return En;return Bn=1,En=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}}function Ro(){if(Tn)return On;Tn=1;var t=Pe(),e=Hr(),r=wo(),n=Object.prototype.hasOwnProperty;return On=function(o){if(!t(o))return r(o);var i=e(o),a=[];for(var s in o)("constructor"!=s||!i&&n.call(o,s))&&a.push(s);return a}}function xo(){if(An)return Sn;An=1;var t=bo(),e=Ro(),r=Qr();return Sn=function(n){return r(n)?t(n,!0):e(n)}}function _o(){if(Un)return Ln;Un=1;var t=mo(),e=xo();return Ln=function(r){return t(r,e(r))}}function ko(){if(Fn)return Wn;Fn=1;var t=Ze(),e=Lr(),r=Fr(),n=Gr(),o=Dr(),i=Jr(),a=Kr(),s=Xr(),c=ln(),u=Ce(),h=Pe(),l=fn(),f=fo(),g=go(),p=_o();return Wn=function(d,m,v,y,b,w,R){var x=g(d,v),_=g(m,v),k=R.get(_);if(k)t(d,v,k);else{var P=w?w(x,_,v+"",d,m,R):void 0,C=void 0===P;if(C){var $=a(_),N=!$&&c(_),j=!$&&!N&&f(_);P=_,$||N||j?a(x)?P=x:s(x)?P=n(x):N?(C=!1,P=e(_,!0)):j?(C=!1,P=r(_,!0)):P=[]:l(_)||i(_)?(P=x,i(x)?P=p(x):h(x)&&!u(x)||(P=o(_))):C=!1}C&&(R.set(_,P),b(P,_,y,w,R),R.delete(_)),t(d,v,P)}}}function Po(){if(Mn)return Gn;Mn=1;var t=Ye(),e=Ze(),r=er(),n=ko(),o=Pe(),i=xo(),a=go();return Gn=function s(c,u,h,l,f){c!==u&&r(u,(function(r,i){if(f||(f=new t),o(r))n(c,u,i,h,s,l,f);else{var g=l?l(a(c,i),r,i+"",c,u,f):void 0;void 0===g&&(g=r),e(c,i,g)}}),i)},Gn}function Co(){if(zn)return In;return zn=1,In=function(t){return t}}function $o(){if(Dn)return Hn;return Dn=1,Hn=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}}function No(){if(Vn)return qn;Vn=1;var t=$o(),e=Math.max;return qn=function(r,n,o){return n=e(void 0===n?r.length-1:n,0),function(){for(var i=arguments,a=-1,s=e(i.length-n,0),c=Array(s);++a<s;)c[a]=i[n+a];a=-1;for(var u=Array(n+1);++a<n;)u[a]=i[a];return u[n]=o(c),t(r,this,u)}},qn}function jo(){if(Kn)return Jn;return Kn=1,Jn=function(t){return function(){return t}}}function Eo(){if(Qn)return Yn;Qn=1;var t=jo(),e=Qe();return Yn=e?function(r,n){return e(r,"toString",{configurable:!0,enumerable:!1,value:t(n),writable:!0})}:Co()}function Bo(){if(Zn)return Xn;Zn=1;var t=Date.now;return Xn=function(e){var r=0,n=0;return function(){var o=t(),i=16-(o-n);if(n=o,i>0){if(++r>=800)return arguments[0]}else r=0;return e.apply(void 0,arguments)}},Xn}function Oo(){if(eo)return to;eo=1;var t=Eo(),e=Bo()(t);return to=e}function To(){if(no)return ro;no=1;var t=Co(),e=No(),r=Oo();return ro=function(n,o){return r(e(n,o,t),n+"")}}function So(){if(io)return oo;io=1;var t=ce(),e=Qr(),r=yo(),n=Pe();return oo=function(o,i,a){if(!n(a))return!1;var s=typeof i;return!!("number"==s?e(a)&&r(i,a.length):"string"==s&&i in a)&&t(a[i],o)}}function Ao(){if(so)return ao;so=1;var t=To(),e=So();return ao=function(r){return t((function(t,n){var o=-1,i=n.length,a=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(a=r.length>3&&"function"==typeof a?(i--,a):void 0,s&&e(n[0],n[1],s)&&(a=i<3?void 0:a,i=1),t=Object(t);++o<i;){var c=n[o];c&&r(t,c,o,a)}return t}))}}function Lo(){if(uo)return co;uo=1;var t=Po(),e=Ao()((function(e,r,n){t(e,r,n)}));return co=e}var Uo,Wo,Fo,Go,Mo,Io,zo,Ho,Do,qo,Vo,Jo,Ko,Yo,Qo,Xo,Zo,ti,ei,ri,ni,oi,ii,ai,si=ae(Lo());function ci(){if(Wo)return Uo;Wo=1;var t=ke(),e=qr();return Uo=function(r){return"symbol"==typeof r||e(r)&&"[object Symbol]"==t(r)}}function ui(){if(Go)return Fo;Go=1;var t=Kr(),e=ci(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;return Fo=function(o,i){if(t(o))return!1;var a=typeof o;return!("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=o&&!e(o))||(n.test(o)||!r.test(o)||null!=i&&o in Object(i))}}function hi(){if(Io)return Mo;Io=1;var t=Je();function e(r,n){if("function"!=typeof r||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var o=function(){var t=arguments,e=n?n.apply(this,t):t[0],i=o.cache;if(i.has(e))return i.get(e);var a=r.apply(this,t);return o.cache=i.set(e,a)||i,a};return o.cache=new(e.Cache||t),o}return e.Cache=t,Mo=e}function li(){if(Ho)return zo;Ho=1;var t=hi();return zo=function(e){var r=t(e,(function(t){return 500===n.size&&n.clear(),t})),n=r.cache;return r}}function fi(){if(qo)return Do;qo=1;var t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,e=/\\(\\)?/g,r=li()((function(r){var n=[];return 46===r.charCodeAt(0)&&n.push(""),r.replace(t,(function(t,r,o,i){n.push(o?i.replace(e,"$1"):r||t)})),n}));return Do=r}function gi(){if(Jo)return Vo;return Jo=1,Vo=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}}function pi(){if(Yo)return Ko;Yo=1;var t=Re(),e=gi(),r=Kr(),n=ci(),o=t?t.prototype:void 0,i=o?o.toString:void 0;return Ko=function t(o){if("string"==typeof o)return o;if(r(o))return e(o,t)+"";if(n(o))return i?i.call(o):"";var a=o+"";return"0"==a&&1/o==-1/0?"-0":a},Ko}function di(){if(Xo)return Qo;Xo=1;var t=pi();return Qo=function(e){return null==e?"":t(e)}}function mi(){if(ti)return Zo;ti=1;var t=Kr(),e=ui(),r=fi(),n=di();return Zo=function(o,i){return t(o)?o:e(o,i)?[o]:r(n(o))}}function vi(){if(ri)return ei;ri=1;var t=ci();return ei=function(e){if("string"==typeof e||t(e))return e;var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}}function yi(){if(oi)return ni;oi=1;var t=mi(),e=vi();return ni=function(r,n){for(var o=0,i=(n=t(n,r)).length;null!=r&&o<i;)r=r[e(n[o++])];return o&&o==i?r:void 0}}function bi(){if(ai)return ii;ai=1;var t=yi();return ii=function(e,r,n){var o=null==e?void 0:t(e,r);return void 0===o?n:o}}var wi=ae(bi());const Ri="package.json",xi=[".env.local",".env"];class _i extends t{_env;shared;constructor(t){super(t),this._env=e.searchEnv({logger:this.logger,preloadList:this.feConfig.envOrder||xi}),this.shared=Object.assign({},this.feConfig.release,this.getDefaultShreadOptions(t.shared))}getDefaultShreadOptions(t){return{rootPath:process.cwd(),sourceBranch:this._env.get("FE_RELEASE_BRANCH")||this._env.get("FE_RELEASE_SOURCE_BRANCH")||"master",releaseEnv:this._env.get("FE_RELEASE_ENV")||this._env.get("NODE_ENV")||"development",...t}}get rootPath(){return this.shared.rootPath}get sourceBranch(){return this.shared.sourceBranch}get releaseEnv(){return this.shared.releaseEnv}get env(){return this._env}get workspaces(){return this.getConfig("workspaces.workspaces")}get workspace(){return this.getConfig("workspaces.workspace")}setWorkspaces(t){this.options.workspaces={...this.options.workspaces,workspaces:t}}setConfig(t){this.options=si(this.options,t)}getConfig(t,e){return wi(this.options,t,e)}setShared(t){this.shared=si(this.shared,t)}getPkg(t,e){const r=this.workspace?.packageJson;if(!r)throw new Error("package.json is not found");return t?wi(r,t,e):r}getTemplateContext(){return{...this.shared,...this.workspace,publishPath:this.workspace?.path||"",env:this.releaseEnv,branch:this.sourceBranch}}async runChangesetsCli(t,e){let r="pnpm";try{await this.shell.exec("pnpm -v",{dryRun:!1})}catch{r="npm"}return await this.shell.exec(["pnpm"===r?"pnpm dlx":"npx","@changesets/cli",t,...e??[]])}}function ki(t,...e){return[t,...e]}const Pi={maxWorkspace:3,multiWorkspaceSeparator:"_",workspaceVersionSeparator:"@",batchBranchName:"batch-${timestamp}-${releaseName}-${length}-packages"};class Ci{shell;logger;config;constructor(t,e,r={}){this.shell=t,this.logger=e,this.config={...Pi,...r}}getReleaseBranchName(t,e,r){const n=r.branchName||"release-${tagName}";if("string"!=typeof n)throw new Error("Branch name template is not a string");return this.logger.verbose("Release Branch template is:",n),this.shell.format(n,{pkgName:t,releaseName:t,tagName:e,...r})}getBatchReleaseBranchName(t,e,r,n){const o=this.config.batchBranchName;if("string"!=typeof o)throw new Error("Branch name template is not a string");return this.logger.verbose("Release Batch Branch template is:",o),this.shell.format(o,{pkgName:t,releaseName:t,tagName:e,...r,length:n,timestamp:Date.now()})}getReleaseName(t){if(1===t.length)return t[0].name;const{maxWorkspace:e,multiWorkspaceSeparator:r,workspaceVersionSeparator:n}=this.config;return t.slice(0,e).map((({name:t,version:e})=>`${t}${n}${e}`)).join(r)}getReleaseTagName(t){return 1===t.length?t[0].version:`batch-${t.length}-${(new Date).toISOString().split("T")[0]}`}getReleaseBranchParams(t,e){const r=this.getReleaseTagName(t),n=this.getReleaseName(t);return{tagName:r,releaseBranch:t.length>1?this.getBatchReleaseBranchName(n,r,e,t.length):this.getReleaseBranchName(n,r,e)}}getPRTitle(t,e){const r=this.config.PRTitle||"Release ${env} ${pkgName} ${tagName}";return this.shell.format(r,{...e,tagName:t.tagName,pkgName:t.releaseBranch})}getPRBody(t,e,r){const n=this.config.PRBody,o=t.length>1?t.map((t=>this.shell.format("\n## ${name} ${version}\n${changelog}\n",t))):t[0].changelog,{workspaceVersionSeparator:i}=this.config,a=1===t.length?e.tagName:t.map((t=>`${t.name}${i}${t.version}`)).join(" ");return this.shell.format(n,{...r,tagName:a,changelog:o})}}class $i{context;_octokit=null;constructor(t){this.context=t}getGitHubUserInfo(){const{authorName:t,repoName:e}=this.context.shared;if(!t||!e)throw new Error("Author name or repo name is not set");return{owner:t,repo:e}}getToken(){const{tokenRef:t="GITHUB_TOKEN"}=this.context.getConfig("githubPR"),e=this.context.env.get(t);if(!e)throw new Error(`Token is not set. Please set ${t} environment variable.`);return e}get octokit(){if(this._octokit)return this._octokit;const{timeout:t}=this.context.getConfig("githubPR"),e={auth:this.getToken(),request:{timeout:t}};return this._octokit=new n(e),this._octokit}get logger(){return this.context.logger}get shell(){return this.context.shell}get autoMergeType(){return this.context.shared.autoMergeType||"squash"}get dryRunPRNumber(){return this.context.getConfig("githubPR.dryRunPRNumber","999999")}get autoMergeReleasePR(){return this.context.shared.autoMergeReleasePR||false}async mergePR(t,e){if(!t)return void this.logger.error("Failed to create Pull Request.",t);const r=this.autoMergeType;if(this.context.dryRun){const{repoName:n,authorName:o}=this.context.shared;this.logger.info(`[DRY RUN] Would merge PR #${t} with method '${r}' in repo ${o}/${n}, branch ${e}`)}else await this.octokit.rest.pulls.merge({...this.getGitHubUserInfo(),pull_number:Number(t),merge_method:r})}async checkedPR(t,e){try{await this.octokit.rest.pulls.get({...this.getGitHubUserInfo(),pull_number:Number(t)}),await this.octokit.rest.git.deleteRef({...this.getGitHubUserInfo(),ref:`heads/${e}`}),this.logger.info(`Branch ${e} has been deleted`)}catch(r){if(404===r.status)return void this.logger.warn(`PR #${t} or branch ${e} not found`);throw this.logger.error("Failed to check PR or delete branch",r),r}}async createReleasePRLabel(){const t=this.context.shared.label;if(!(t&&t.name&&t.description&&t.color))throw new Error("Label is not valid, skipping creation");if(this.context.dryRun)return this.logger.info("[DRY RUN] Would create PR label with:",t),t;try{const e=await this.octokit.rest.issues.createLabel({...this.getGitHubUserInfo(),name:t.name,description:t.description,color:t.color.replace("#","")});return this.logger.debug("Create PR label Success",e),t}catch(e){if(422===e.status)return this.logger.warn(`Label ${t.name} already exists, skipping!`),t;throw this.logger.error("Create PR label Failed",e),e}}async createReleasePR(t){if(this.context.getConfig("githubPR.dryRunCreatePR")||this.context.dryRun)return this.logger.info("[DRY RUN] Would create PR with:",{...t,labels:t.labels}),this.dryRunPRNumber;try{const e=await this.octokit.rest.pulls.create({...this.getGitHubUserInfo(),...t}),r=e.data.number;if(!r)throw new Error("CreateReleasePR Failed, prNumber is empty");if(this.logger.debug("Create PR Success",[e?.url]),t.labels&&t.labels.length){const e=await this.octokit.rest.issues.addLabels({...this.getGitHubUserInfo(),issue_number:r,labels:t.labels});this.logger.debug("Add PR label Success",[e.url])}return r.toString()}catch(t){if(422===t.status&&t.message.includes("already exists")){this.logger.warn("PR already exists");const e=t.message.match(/pull request #(\d+)/);return e?e[1]:""}throw this.logger.error("Failed to create PR",t),t}}truncateBody(t){return t&&t.length>=124e3?t.substring(0,124e3)+"...":t}getOctokitReleaseOptions(t){const{releaseName:e,draft:r=!1,preRelease:n=!1,autoGenerate:o=!1,makeLatest:i=!0,releaseNotes:a,discussionCategoryName:s}=this.context.getConfig("githubPR"),c=e,u=o?"":this.truncateBody(String(a));return{name:c,make_latest:i.toString(),body:u,draft:r,prerelease:n,generate_release_notes:o,discussion_category_name:s,tag_name:"",...t,...this.getGitHubUserInfo()}}async createRelease(t){const e=this.getOctokitReleaseOptions({tag_name:t.tagName,body:t.changelog});if(e.name=this.shell.format(e.name,t),this.logger.exec(`octokit repos.createRelease "${e.name}" (${e.tag_name})`,{isDryRun:this.context.dryRun}),!e.tag_name)throw new Error("TagName is undefined");if(this.context.dryRun)return;const r=await this.octokit.repos.createRelease(e);this.logger.verbose(`octokit repos.createRelease: done (${r.headers.location})`)}}var Ni,ji;function Ei(){if(ji)return Ni;ji=1;var t=ke(),e=Kr(),r=qr();return Ni=function(n){return"string"==typeof n||!e(n)&&r(n)&&"[object String]"==t(n)}}var Bi=ae(Ei());class Oi{context;pluginName;props;onlyOne=!0;constructor(t,e,r={}){this.context=t,this.pluginName=e,this.props=r,this.setConfig(this.getInitialProps(r))}getInitialProps(t){const e=this.context.options[this.pluginName],r=wi(this.context.shared,this.pluginName);return e||t?si({},r,t,e):{}}get logger(){return this.context.logger}get shell(){return this.context.shell}get options(){return this.context.getConfig(this.pluginName,{})}getEnv(t,e){return this.context.env.get(t)??e}enabled(t,e){return!0}getConfig(t,e){return t?this.context.getConfig([this.pluginName,...Array.isArray(t)?t:[t]],e):this.context.getConfig(this.pluginName,e)}setConfig(t){this.context.setConfig({[this.pluginName]:t})}onBefore(t){}onExec(t){}onSuccess(t){}onError(t){}async step({label:t,task:e}){this.logger.obtrusive(t);try{const r=await e();return this.logger.info(`${t} - success`),r}catch(t){throw this.logger.error(t),t}}}class Ti extends Oi{async onBefore(){const t=await this.getUserInfo();if(!t)throw new Error("Failed to get repoInfo");let e=this.context.shared.currentBranch;e||(e=await this.getCurrentBranch()),e&&await this.context.shell.exec(`git checkout ${e}`,{dryRun:!1}),this.context.setShared({repoName:t.repoName,authorName:t.authorName,currentBranch:e})}async getCurrentBranch(){return await new Promise((t=>setTimeout(t,100))),this.context.shell.exec("git rev-parse --abbrev-ref HEAD",{dryRun:!1})}async getRemoteUrl(){return(await this.context.shell.exec("git config --get remote.origin.url",{dryRun:!1})).trim()}async getUserInfo(){let t;try{t=await this.getRemoteUrl()}catch{throw new Error("Failed to get git remote url. Please ensure this is a git repository with a valid remote.")}if(!t)throw new Error("Git remote URL is empty. Please set a valid GitHub remote URL.");this.context.logger.verbose("repoUrl: ",t);const e=t.match(/github\.com[:/]([^/]+)\/([^/.]+)(?:\.git)?$/);if(!e)throw new Error("Invalid GitHub repository URL format. Please ensure the remote URL is from GitHub.");const[,r,n]=e;if(!this.isValidString(r)||!this.isValidString(n))throw new Error("Failed to extract owner or repository name from GitHub URL");return{repoName:n,authorName:r}}isValidString(t){return!!t&&Bi(t)}commit(t,e=[]){return this.context.shell.exec(["git","commit","--message",JSON.stringify(t),...e])}}class Si{options;constructor(t){this.options=t}compare(t,e){return"function"==typeof this.options.compare?this.options.compare(t,e):t.startsWith(e)}toChangeLabel(t,e=this.options.changePackagesLabel){return e.replace("${name}",t)}toChangeLabels(t,e=this.options.changePackagesLabel){return t.map((t=>this.toChangeLabel(t,e)))}pick(t,e=this.options.packagesDirectories){const r=[];for(const n of e)for(const e of t)if(this.compare(e,n)){r.push(n);break}return r}}class Ai{static readJson(t){const e=s(t,"utf-8");return JSON.parse(e)}static toWorkspace(t,e){let{root:r,packageJson:n}=t;const o=t.path;if(!o)throw new Error("path is not required!");return r=r||h(e,o),n=n||Ai.readJson(h(r,Ri)),{name:n.name,version:n.version,path:o,root:r,packageJson:n}}}class Li extends Oi{releaseTask=null;workspacesList=[];_skip=!1;releaseLabel;constructor(t){super(t,"workspaces"),this.releaseLabel=new Si({changePackagesLabel:this.context.shared.changePackagesLabel||"change:${name}",packagesDirectories:this.context.shared.packagesDirectories||[]})}enabled(){return!this._skip&&!this.getConfig("skip")}async onBefore(){const t=this.getConfig("workspace");if(t)return this.logger.debug("Use the specified workspace",t),void this.setCurrentWorkspace(t,[]);const e=await this.getWorkspaces();if(this.getConfig("skipCheckPackage")||0===e.length)throw new Error("No changes to publish packages");const{publishPath:r}=this.context.shared;if(r){const t=e.find((t=>o(t.root)===o(r)));if(this.nextSkip(),!t)throw new Error(`No workspace found for: ${r}`);return this.logger.debug(`Workspace of ${r} find!`,i(t.root,Ri)),void this.setCurrentWorkspace(t,[t])}const[n,...a]=e;this.workspacesList=a,this.setCurrentWorkspace(n,e)}nextSkip(){this._skip=!0,this.logger.debug("skip next workspace")}setReleaseTask(t){this.releaseTask=t}setCurrentWorkspace(t,e){this.context.setShared({publishPath:t.path}),this.setConfig({workspace:t,workspaces:e})}getPackages(){const t=this.context.shared.packagesDirectories;return Array.isArray(t)?t:[]}async getGitWorkspaces(){const t=this.context.sourceBranch,e=await this.shell.exec(`git diff --name-only origin/${t}...HEAD`,{dryRun:!1});return"string"==typeof e?e.split("\n"):[]}async getChangedPackages(t,e){if(this.logger.debug("changeLabels",e),Array.isArray(e)&&e.length>0){const r=t.filter((t=>{const r=this.releaseLabel.toChangeLabel(t);return e.includes(r)}));return this.logger.debug("changed by labels",r),r}const r=await this.getGitWorkspaces();return this.logger.debug("changed by git",r),this.releaseLabel.pick(r,t)}async getWorkspaces(){const t=this.getPackages();this.logger.debug("packages",t);const e=await this.getChangedPackages(t,this.getConfig("changeLabels"));this.logger.debug("changedPaths",e);return e.map((t=>Ai.toWorkspace({path:t},this.context.rootPath)))}}function Ui(t,...e){return"function"==typeof t&&t.prototype&&t.prototype.constructor===t?new t(...e):t(...e)}function Wi(t){return t.startsWith(".")?a(t).name:t}async function Fi(t){let e=null;try{e=(await import(t)).default}catch{try{e=(await import(i(process.cwd(),t))).default}catch{const r=l(process.cwd());e=(await import(f(r.resolve(t,{paths:[process.cwd()]})).href)).default}}return[Wi(t),e]}async function Gi(t,e,r=5){const n=g(r),o=e.map((([e,...r])=>n((()=>(async(e,...r)=>{if("string"==typeof e){const[,n]=await Fi(e);return Ui(n,t,...r)}return Ui(e,t,...r)})(e,...r)))));return Promise.all(o)}const Mi={name:"angular",types:[{type:"feat",section:"✨ Features",hidden:!1},{type:"fix",section:"🐞 Bug Fixes",hidden:!1},{type:"chore",section:"🔧 Chores",hidden:!1},{type:"docs",section:"📝 Documentation",hidden:!1},{type:"refactor",section:"♻️ Refactors",hidden:!1},{type:"perf",section:"🚀 Performance",hidden:!1},{type:"test",section:"🚨 Tests",hidden:!1},{type:"style",section:"🎨 Styles",hidden:!1},{type:"ci",section:"🔄 CI",hidden:!1},{type:"build",section:"🚧 Build",hidden:!1},{type:"revert",section:"⏪ Reverts",hidden:!1},{type:"release",section:"🔖 Releases",hidden:!1}]};const Ii=[ki(Li),ki(class extends Oi{constructor(t,e){super(t,"changelog",{increment:"patch",changesetRoot:".changeset",tagTemplate:"${name}@${version}",tagPrefix:"${name}",tagMatch:"${name}@*",...e})}get changesetRoot(){return h(this.context.rootPath,this.getConfig("changesetRoot"))}enabled(){return!this.getConfig("skip")}async onBefore(){if(!c(this.changesetRoot))throw new Error(`Changeset directory ${this.changesetRoot} does not exist`);this.logger.debug(`${this.changesetRoot} exists`)}mergeWorkspaces(t){return t.map((t=>{const e=Ai.toWorkspace({path:t.path},this.context.rootPath),r={...t,version:e.version};return r.tagName=this.generateTagName(r),r}))}async onExec(){const t=await this.step({label:"Generate Changelogs",task:()=>Promise.all(this.context.workspaces.map((t=>this.generateChangelog(t))))});this.getConfig("skipChangeset")?this.logger.debug("Skip generate changeset files"):(await this.step({label:"Changeset Version",task:()=>Promise.all(t.map((t=>this.generateChangesetFile(t))))}),await this.context.runChangesetsCli("version",["--no-changelog"]));const e=this.mergeWorkspaces(t);this.logger.debug("new workspaces",e),this.context.setWorkspaces(e)}getTagPrefix(t){return this.shell.format(this.getConfig("tagPrefix"),t)}async createChangelog({lastTag:t,workspace:e}){const r={releaseCount:1,tagPrefix:this.getTagPrefix(e),warn:this.logger.warn.bind(this.logger),preset:Mi.name},n={version:e.version};let o=t;try{await this.shell.exec(`git rev-parse --verify --quiet "refs/tags/${t}"`,{dryRun:!1}),this.logger.verbose(`Tag '${t}' found for workspace '${e.name}'. Using it as the starting point.`)}catch{this.logger.warn(`Tag '${t}' not found for workspace '${e.name}'. Will generate changelog using commits within path '${e.path}' from the beginning of history or latest available tag.`),o=void 0}const i={debug:this.logger.debug.bind(this.logger),from:o,reverse:!0,path:e.path},a={},s={headerPartial:""};return this.logger.debug("options",r),this.logger.debug("context",n),this.logger.debug("gitRawCommitsOpts",i),new Promise(((t,c)=>{let u="";const h=p(r,n,i,a,s);h.on("data",(t=>{u+=t.toString()})),h.on("error",(t=>{this.logger.error(`Error during conventional-changelog stream for workspace '${e.name}':`,t),c(new Error(`Failed to generate changelog for ${e.name}: ${t.message}`))})),h.on("end",(()=>{!u&&o?this.logger.warn(`No commits found for workspace '${e.name}' since tag '${o}' within path '${e.path}'. Changelog will be empty.`):u||this.logger.info(`No commits found for workspace '${e.name}' within path '${e.path}'. Changelog will be empty.`),t(this.tranformChangelog(u,Mi.types))}))}))}tranformChangelog(t,e){return t}async generateChangelog(t){const e=await this.getTagName(t);this.logger.verbose("tagName is:",e);const r=await this.createChangelog({workspace:t,lastTag:e});return{...t,lastTag:e,changelog:r}}generateTagName(t){try{const e=this.getConfig("tagTemplate");return this.shell.format(e,t)}catch(e){return console.error(`Error generating tag name for ${t.name}:`,e),`${t.name}-v0.0.0`}}async getTagName(t){try{const e=this.generateTagName(t),r=this.shell.format(this.getConfig("tagMatch"),t),n=await this.shell.exec(`git for-each-ref --sort=-creatordate --format "%(refname:short)|%(creatordate:iso8601)" "refs/tags/${r}"`,{dryRun:!1});if(this.logger.debug("tagsOutput",n),!n)return e;const o=n.split("\n").filter(Boolean);if(0===o.length)return e;return o[0].split("|")[0]}catch(e){console.error(`Error getting tag for ${t.name}:`,e);return this.generateTagName(t)}}getIncrement(){const t=this.context.getConfig("workspaces.changeLabels");if(Array.isArray(t)&&t.length>0){if(t.includes("increment:major"))return"major";if(t.includes("increment:minor"))return"minor"}return this.getConfig("increment","patch")}async generateChangesetFile(t){const{name:e,version:r}=t,n=`${e}-${r}`.replace(/[\/\\]/g,"_"),o=h(this.changesetRoot,`${n}.md`),i=this.getIncrement();this.logger.verbose("increment is:",[i]);const a=this.shell.format("---\n'${name}': '${increment}'\n---\n${changelog}",{...t,increment:i});if(this.context.dryRun)return this.logger.info(`Changeset [${o}] will be created, content is:`),void this.logger.log(a);c(o)?this.logger.info(`Changeset ${n} already exists`):u(o,a,"utf-8")}},{}),ki(class extends Ti{context;releaseParams;githubManager;constructor(t,e){super(t,"githubPR",{releaseName:"Release ${name} v${version}",...e}),this.context=t,this.githubManager=new $i(this.context),this.releaseParams=new Ci(t.shell,t.logger,{PRTitle:this.getConfig("PRTitle",this.context.shared.PRTitle),PRBody:this.getConfig("PRBody",this.context.shared.PRBody),...this.props})}enabled(t){return!this.getConfig("skip")&&("onExec"===t?!this.isPublish:"onSuccess"!==t||this.isPublish)}get isPublish(){return!this.getConfig("releasePR")}async isGithubRepository(){try{return(await this.getRemoteUrl()).includes("github.com")}catch{return!1}}async onBefore(){this.logger.verbose("GithubPR onBefore");if(!await this.isGithubRepository())throw new Error("Current repository is not a GitHub repository. GitHub PR workflow is only available for GitHub repositories.");if(await super.onBefore(),this.isPublish){const t=this.getEnv("NPM_TOKEN");if(!t)throw new Error("NPM_TOKEN is not set");await this.shell.exec(`npm config set //registry.npmjs.org/:_authToken=${t}`)}}async onExec(){const t=this.context.workspaces;await this.step({label:"Release Commit",task:()=>this.relesaeCommit(t)});const e=await this.step({label:"Create Release Branch",task:()=>this.createReleaseBranch(t)});await this.releasePullRequest(t,e)}async onSuccess(){const t=this.context.workspaces;this.getConfig("dryRunCreatePR")||(await this.context.runChangesetsCli("publish"),await this.shell.exec("git push origin --tags")),await this.step({label:"Release Github",task:()=>Promise.all(t.map((t=>(this.logger.debug(t),this.githubManager.createRelease(t)))))})}async relesaeCommit(t){const e=this.getConfig("commitArgs",[]);if(1===t.length)return await this.shell.exec("git add ."),void await this.commitWorkspace(t[0],e);await this.shell.exec("git add .");const r=`chore(tag): ${t.map((t=>`${t.name} v${t.version}`)).join(",")}`;await this.commit(r,e)}async releasePullRequest(t,e){const r=await this.step({label:"Create Release PR",task:()=>this.createReleasePR(t,e)});if(this.githubManager.autoMergeReleasePR){const{releaseBranch:t}=e;return await this.step({label:`Merge Release PR(${r})`,task:()=>this.githubManager.mergePR(r,t)}),void await this.step({label:`Checked Release PR(${r})`,task:()=>this.githubManager.checkedPR(r,t)})}this.logger.info(`Please manually merge PR(#${r}) and complete the publishing process afterwards`)}async commitWorkspace(t,e=[]){const r=this.shell.format(this.getConfig("commitMessage","chore(tag): ${name} v${version}"),t);return await this.commit(r,e)}async createReleaseBranch(t){const e=this.releaseParams.getReleaseBranchParams(t,this.context.getTemplateContext()),{tagName:r,releaseBranch:n}=e;if("string"!=typeof r)throw new Error("Tag name is not a string");const{sourceBranch:o,currentBranch:i}=this.context.shared;this.context.logger.verbose("PR TagName is:",r),this.context.logger.verbose("PR CurrentBranch is:",i),this.context.logger.verbose("PR SourceBranch is:",o),this.context.logger.verbose("PR ReleaseBranch is:",n);try{await this.context.shell.exec(`git fetch origin ${o} ${i}`),await this.context.shell.exec(`git checkout -b ${n} ${i}`),await this.context.shell.exec(`git push origin ${n}`)}catch(t){throw t.message.includes("remote: Permission to ")&&this.context.logger.warn('Token maybe not allow Workflow permissions, can you try to open "Workflow permissions" -> "Read and write permissions" for this token?'),t}return{tagName:r,releaseBranch:n}}async createReleasePR(t,e){const r=[(await this.githubManager.createReleasePRLabel()).name],n=this.context.getTemplateContext(),o=this.releaseParams.getPRTitle(e,n),i=this.releaseParams.getPRBody(t,e,n);return this.githubManager.createReleasePR({title:o,body:i,base:this.context.sourceBranch,head:e.releaseBranch,labels:r})}},{})];class zi{executor;defaultTuples;context;constructor(t={},e=new r,n=Ii){this.executor=e,this.defaultTuples=n,this.context=new _i(t)}getContext(){return this.context}async usePlugins(t){t=t||this.context.shared.plugins||[];const e=await Gi(this.context,[...this.defaultTuples,...t]);return e.forEach((t=>{t instanceof Li&&t.setReleaseTask(this),this.executor.use(t)})),e}async run(){return this.executor.exec(this.context,(t=>Promise.resolve(t)))}async exec(t){if("false"===this.context.env.get("FE_RELEASE"))throw new Error("Skip Release");return await this.usePlugins(t),this.run()}}var Hi,Di,qi,Vi;function Ji(){if(Di)return Hi;Di=1;var t=po(),e=mi(),r=yo(),n=Pe(),o=vi();return Hi=function(i,a,s,c){if(!n(i))return i;for(var u=-1,h=(a=e(a,i)).length,l=h-1,f=i;null!=f&&++u<h;){var g=o(a[u]),p=s;if("__proto__"===g||"constructor"===g||"prototype"===g)return i;if(u!=l){var d=f[g];void 0===(p=c?c(d,g,f):void 0)&&(p=n(d)?d:r(a[u+1])?[]:{})}t(f,g,p),f=f[g]}return i}}function Ki(){if(Vi)return qi;Vi=1;var t=Ji();return qi=function(e,r,n){return null==e?e:t(e,r,n)}}var Yi=ae(Ki());function Qi(t,e){return Object.entries(t).reduce(((t,[r,n])=>(r.includes(".")?Yi(t,r,n):Yi(t,e?`${e}.${r}`:r,n),t)),{})}export{Oi as Plugin,_i as ReleaseContext,Si as ReleaseLabel,zi as ReleaseTask,Ui as factory,Fi as load,Gi as loaderPluginsFromPluginTuples,Qi as reduceOptions,ki as tuple};
|
|
1
|
+
import{FeScriptContext as t}from"@qlover/scripts-context";import{Env as e}from"@qlover/env-loader";import{AsyncExecutor as r}from"@qlover/fe-corekit";import{Octokit as n}from"@octokit/rest";import{resolve as o,join as i,parse as s}from"node:path";import{readFileSync as a,existsSync as c,writeFileSync as u}from"fs";import{join as h}from"path";import{createRequire as l}from"node:module";import{pathToFileURL as f}from"node:url";import g from"p-limit";var p,m,d,v,y,b,w,R,x,_,k,P,C,$,N,j,E,B,O,T,S,A,L,W,U,F,M,G,H,z,I,D,q,V,J,K,Y,Q,X,Z,tt,et,rt,nt,ot,it,st,at,ct,ut,ht,lt,ft,gt,pt,mt,dt,vt,yt,bt,wt,Rt,xt,_t,kt,Pt,Ct,$t,Nt,jt,Et,Bt,Ot,Tt,St,At,Lt,Wt,Ut,Ft,Mt,Gt,Ht,zt,It,Dt,qt,Vt,Jt,Kt,Yt,Qt,Xt,Zt,te,ee,re,ne,oe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ie(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function se(){if(m)return p;return m=1,p=function(){this.__data__=[],this.size=0}}function ae(){if(v)return d;return v=1,d=function(t,e){return t===e||t!=t&&e!=e}}function ce(){if(b)return y;b=1;var t=ae();return y=function(e,r){for(var n=e.length;n--;)if(t(e[n][0],r))return n;return-1}}function ue(){if(R)return w;R=1;var t=ce(),e=Array.prototype.splice;return w=function(r){var n=this.__data__,o=t(n,r);return!(o<0)&&(o==n.length-1?n.pop():e.call(n,o,1),--this.size,!0)}}function he(){if(_)return x;_=1;var t=ce();return x=function(e){var r=this.__data__,n=t(r,e);return n<0?void 0:r[n][1]}}function le(){if(P)return k;P=1;var t=ce();return k=function(e){return t(this.__data__,e)>-1}}function fe(){if($)return C;$=1;var t=ce();return C=function(e,r){var n=this.__data__,o=t(n,e);return o<0?(++this.size,n.push([e,r])):n[o][1]=r,this}}function ge(){if(j)return N;j=1;var t=se(),e=ue(),r=he(),n=le(),o=fe();function i(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,N=i}function pe(){if(B)return E;B=1;var t=ge();return E=function(){this.__data__=new t,this.size=0}}function me(){if(T)return O;return T=1,O=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}}function de(){if(A)return S;return A=1,S=function(t){return this.__data__.get(t)}}function ve(){if(W)return L;return W=1,L=function(t){return this.__data__.has(t)}}function ye(){if(F)return U;F=1;var t="object"==typeof oe&&oe&&oe.Object===Object&&oe;return U=t}function be(){if(G)return M;G=1;var t=ye(),e="object"==typeof self&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return M=r}function we(){if(z)return H;z=1;var t=be().Symbol;return H=t}function Re(){if(D)return I;D=1;var t=we(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,o=t?t.toStringTag:void 0;return I=function(t){var e=r.call(t,o),i=t[o];try{t[o]=void 0;var s=!0}catch(t){}var a=n.call(t);return s&&(e?t[o]=i:delete t[o]),a}}function xe(){if(V)return q;V=1;var t=Object.prototype.toString;return q=function(e){return t.call(e)}}function _e(){if(K)return J;K=1;var t=we(),e=Re(),r=xe(),n=t?t.toStringTag:void 0;return J=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":n&&n in Object(t)?e(t):r(t)}}function ke(){if(Q)return Y;return Q=1,Y=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}}function Pe(){if(Z)return X;Z=1;var t=_e(),e=ke();return X=function(r){if(!e(r))return!1;var n=t(r);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}}function Ce(){if(et)return tt;et=1;var t=be()["__core-js_shared__"];return tt=t}function $e(){if(nt)return rt;nt=1;var t,e=Ce(),r=(t=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||""))?"Symbol(src)_1."+t:"";return rt=function(t){return!!r&&r in t}}function Ne(){if(it)return ot;it=1;var t=Function.prototype.toString;return ot=function(e){if(null!=e){try{return t.call(e)}catch(t){}try{return e+""}catch(t){}}return""}}function je(){if(at)return st;at=1;var t=Pe(),e=$e(),r=ke(),n=Ne(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,s=Object.prototype,a=i.toString,c=s.hasOwnProperty,u=RegExp("^"+a.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return st=function(i){return!(!r(i)||e(i))&&(t(i)?u:o).test(n(i))}}function Ee(){if(ut)return ct;return ut=1,ct=function(t,e){return null==t?void 0:t[e]}}function Be(){if(lt)return ht;lt=1;var t=je(),e=Ee();return ht=function(r,n){var o=e(r,n);return t(o)?o:void 0}}function Oe(){if(gt)return ft;gt=1;var t=Be()(be(),"Map");return ft=t}function Te(){if(mt)return pt;mt=1;var t=Be()(Object,"create");return pt=t}function Se(){if(vt)return dt;vt=1;var t=Te();return dt=function(){this.__data__=t?t(null):{},this.size=0}}function Ae(){if(bt)return yt;return bt=1,yt=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}}function Le(){if(Rt)return wt;Rt=1;var t=Te(),e=Object.prototype.hasOwnProperty;return wt=function(r){var n=this.__data__;if(t){var o=n[r];return"__lodash_hash_undefined__"===o?void 0:o}return e.call(n,r)?n[r]:void 0}}function We(){if(_t)return xt;_t=1;var t=Te(),e=Object.prototype.hasOwnProperty;return xt=function(r){var n=this.__data__;return t?void 0!==n[r]:e.call(n,r)}}function Ue(){if(Pt)return kt;Pt=1;var t=Te();return kt=function(e,r){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=t&&void 0===r?"__lodash_hash_undefined__":r,this}}function Fe(){if($t)return Ct;$t=1;var t=Se(),e=Ae(),r=Le(),n=We(),o=Ue();function i(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,Ct=i}function Me(){if(jt)return Nt;jt=1;var t=Fe(),e=ge(),r=Oe();return Nt=function(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}}function Ge(){if(Bt)return Et;return Bt=1,Et=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}}function He(){if(Tt)return Ot;Tt=1;var t=Ge();return Ot=function(e,r){var n=e.__data__;return t(r)?n["string"==typeof r?"string":"hash"]:n.map}}function ze(){if(At)return St;At=1;var t=He();return St=function(e){var r=t(this,e).delete(e);return this.size-=r?1:0,r}}function Ie(){if(Wt)return Lt;Wt=1;var t=He();return Lt=function(e){return t(this,e).get(e)}}function De(){if(Ft)return Ut;Ft=1;var t=He();return Ut=function(e){return t(this,e).has(e)}}function qe(){if(Gt)return Mt;Gt=1;var t=He();return Mt=function(e,r){var n=t(this,e),o=n.size;return n.set(e,r),this.size+=n.size==o?0:1,this}}function Ve(){if(zt)return Ht;zt=1;var t=Me(),e=ze(),r=Ie(),n=De(),o=qe();function i(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,Ht=i}function Je(){if(Dt)return It;Dt=1;var t=ge(),e=Oe(),r=Ve();return It=function(n,o){var i=this.__data__;if(i instanceof t){var s=i.__data__;if(!e||s.length<199)return s.push([n,o]),this.size=++i.size,this;i=this.__data__=new r(s)}return i.set(n,o),this.size=i.size,this}}function Ke(){if(Vt)return qt;Vt=1;var t=ge(),e=pe(),r=me(),n=de(),o=ve(),i=Je();function s(e){var r=this.__data__=new t(e);this.size=r.size}return s.prototype.clear=e,s.prototype.delete=r,s.prototype.get=n,s.prototype.has=o,s.prototype.set=i,qt=s}function Ye(){if(Kt)return Jt;Kt=1;var t=Be(),e=function(){try{var e=t(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();return Jt=e}function Qe(){if(Qt)return Yt;Qt=1;var t=Ye();return Yt=function(e,r,n){"__proto__"==r&&t?t(e,r,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[r]=n}}function Xe(){if(Zt)return Xt;Zt=1;var t=Qe(),e=ae();return Xt=function(r,n,o){(void 0!==o&&!e(r[n],o)||void 0===o&&!(n in r))&&t(r,n,o)}}function Ze(){if(ee)return te;return ee=1,te=function(t){return function(e,r,n){for(var o=-1,i=Object(e),s=n(e),a=s.length;a--;){var c=s[t?a:++o];if(!1===r(i[c],c,i))break}return e}}}function tr(){if(ne)return re;ne=1;var t=Ze()();return re=t}var er,rr,nr,or,ir,sr,ar,cr,ur,hr,lr,fr,gr,pr,mr,dr,vr,yr,br,wr,Rr,xr,_r,kr,Pr,Cr,$r,Nr,jr,Er,Br,Or,Tr,Sr={exports:{}};function Ar(){return er||(er=1,t=Sr,e=Sr.exports,r=be(),n=e&&!e.nodeType&&e,o=n&&t&&!t.nodeType&&t,i=o&&o.exports===n?r.Buffer:void 0,s=i?i.allocUnsafe:void 0,t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=s?s(r):new t.constructor(r);return t.copy(n),n}),Sr.exports;var t,e,r,n,o,i,s}function Lr(){if(nr)return rr;nr=1;var t=be().Uint8Array;return rr=t}function Wr(){if(ir)return or;ir=1;var t=Lr();return or=function(e){var r=new e.constructor(e.byteLength);return new t(r).set(new t(e)),r}}function Ur(){if(ar)return sr;ar=1;var t=Wr();return sr=function(e,r){var n=r?t(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}}function Fr(){if(ur)return cr;return ur=1,cr=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}}function Mr(){if(lr)return hr;lr=1;var t=ke(),e=Object.create,r=function(){function r(){}return function(n){if(!t(n))return{};if(e)return e(n);r.prototype=n;var o=new r;return r.prototype=void 0,o}}();return hr=r}function Gr(){if(gr)return fr;return gr=1,fr=function(t,e){return function(r){return t(e(r))}}}function Hr(){if(mr)return pr;mr=1;var t=Gr()(Object.getPrototypeOf,Object);return pr=t}function zr(){if(vr)return dr;vr=1;var t=Object.prototype;return dr=function(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||t)}}function Ir(){if(br)return yr;br=1;var t=Mr(),e=Hr(),r=zr();return yr=function(n){return"function"!=typeof n.constructor||r(n)?{}:t(e(n))}}function Dr(){if(Rr)return wr;return Rr=1,wr=function(t){return null!=t&&"object"==typeof t}}function qr(){if(_r)return xr;_r=1;var t=_e(),e=Dr();return xr=function(r){return e(r)&&"[object Arguments]"==t(r)}}function Vr(){if(Pr)return kr;Pr=1;var t=qr(),e=Dr(),r=Object.prototype,n=r.hasOwnProperty,o=r.propertyIsEnumerable,i=t(function(){return arguments}())?t:function(t){return e(t)&&n.call(t,"callee")&&!o.call(t,"callee")};return kr=i}function Jr(){if($r)return Cr;$r=1;var t=Array.isArray;return Cr=t}function Kr(){if(jr)return Nr;jr=1;return Nr=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}}function Yr(){if(Br)return Er;Br=1;var t=Pe(),e=Kr();return Er=function(r){return null!=r&&e(r.length)&&!t(r)}}function Qr(){if(Tr)return Or;Tr=1;var t=Yr(),e=Dr();return Or=function(r){return e(r)&&t(r)}}var Xr,Zr,tn,en,rn,nn,on,sn,an,cn={exports:{}};function un(){if(Zr)return Xr;return Zr=1,Xr=function(){return!1}}function hn(){return tn||(tn=1,function(t,e){var r=be(),n=un(),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,s=i&&i.exports===o?r.Buffer:void 0,a=(s?s.isBuffer:void 0)||n;t.exports=a}(cn,cn.exports)),cn.exports}function ln(){if(rn)return en;rn=1;var t=_e(),e=Hr(),r=Dr(),n=Function.prototype,o=Object.prototype,i=n.toString,s=o.hasOwnProperty,a=i.call(Object);return en=function(n){if(!r(n)||"[object Object]"!=t(n))return!1;var o=e(n);if(null===o)return!0;var c=s.call(o,"constructor")&&o.constructor;return"function"==typeof c&&c instanceof c&&i.call(c)==a}}function fn(){if(on)return nn;on=1;var t=_e(),e=Kr(),r=Dr(),n={};return n["[object Float32Array]"]=n["[object Float64Array]"]=n["[object Int8Array]"]=n["[object Int16Array]"]=n["[object Int32Array]"]=n["[object Uint8Array]"]=n["[object Uint8ClampedArray]"]=n["[object Uint16Array]"]=n["[object Uint32Array]"]=!0,n["[object Arguments]"]=n["[object Array]"]=n["[object ArrayBuffer]"]=n["[object Boolean]"]=n["[object DataView]"]=n["[object Date]"]=n["[object Error]"]=n["[object Function]"]=n["[object Map]"]=n["[object Number]"]=n["[object Object]"]=n["[object RegExp]"]=n["[object Set]"]=n["[object String]"]=n["[object WeakMap]"]=!1,nn=function(o){return r(o)&&e(o.length)&&!!n[t(o)]}}function gn(){if(an)return sn;return an=1,sn=function(t){return function(e){return t(e)}}}var pn,mn,dn,vn,yn,bn,wn,Rn,xn,_n,kn,Pn,Cn,$n,Nn,jn,En,Bn,On,Tn,Sn,An,Ln,Wn,Un,Fn,Mn,Gn,Hn,zn,In,Dn,qn,Vn,Jn,Kn,Yn,Qn,Xn,Zn,to,eo,ro,no,oo,io,so,ao,co,uo={exports:{}};function ho(){return pn||(pn=1,t=uo,e=uo.exports,r=ye(),n=e&&!e.nodeType&&e,o=n&&t&&!t.nodeType&&t,i=o&&o.exports===n&&r.process,s=function(){try{var t=o&&o.require&&o.require("util").types;return t||i&&i.binding&&i.binding("util")}catch(t){}}(),t.exports=s),uo.exports;var t,e,r,n,o,i,s}function lo(){if(dn)return mn;dn=1;var t=fn(),e=gn(),r=ho(),n=r&&r.isTypedArray,o=n?e(n):t;return mn=o}function fo(){if(yn)return vn;return yn=1,vn=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}}function go(){if(wn)return bn;wn=1;var t=Qe(),e=ae(),r=Object.prototype.hasOwnProperty;return bn=function(n,o,i){var s=n[o];r.call(n,o)&&e(s,i)&&(void 0!==i||o in n)||t(n,o,i)}}function po(){if(xn)return Rn;xn=1;var t=go(),e=Qe();return Rn=function(r,n,o,i){var s=!o;o||(o={});for(var a=-1,c=n.length;++a<c;){var u=n[a],h=i?i(o[u],r[u],u,o,r):void 0;void 0===h&&(h=r[u]),s?e(o,u,h):t(o,u,h)}return o}}function mo(){if(kn)return _n;return kn=1,_n=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}}function vo(){if(Cn)return Pn;Cn=1;var t=/^(?:0|[1-9]\d*)$/;return Pn=function(e,r){var n=typeof e;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&t.test(e))&&e>-1&&e%1==0&&e<r}}function yo(){if(Nn)return $n;Nn=1;var t=mo(),e=Vr(),r=Jr(),n=hn(),o=vo(),i=lo(),s=Object.prototype.hasOwnProperty;return $n=function(a,c){var u=r(a),h=!u&&e(a),l=!u&&!h&&n(a),f=!u&&!h&&!l&&i(a),g=u||h||l||f,p=g?t(a.length,String):[],m=p.length;for(var d in a)!c&&!s.call(a,d)||g&&("length"==d||l&&("offset"==d||"parent"==d)||f&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||o(d,m))||p.push(d);return p}}function bo(){if(En)return jn;return En=1,jn=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}}function wo(){if(On)return Bn;On=1;var t=ke(),e=zr(),r=bo(),n=Object.prototype.hasOwnProperty;return Bn=function(o){if(!t(o))return r(o);var i=e(o),s=[];for(var a in o)("constructor"!=a||!i&&n.call(o,a))&&s.push(a);return s}}function Ro(){if(Sn)return Tn;Sn=1;var t=yo(),e=wo(),r=Yr();return Tn=function(n){return r(n)?t(n,!0):e(n)}}function xo(){if(Ln)return An;Ln=1;var t=po(),e=Ro();return An=function(r){return t(r,e(r))}}function _o(){if(Un)return Wn;Un=1;var t=Xe(),e=Ar(),r=Ur(),n=Fr(),o=Ir(),i=Vr(),s=Jr(),a=Qr(),c=hn(),u=Pe(),h=ke(),l=ln(),f=lo(),g=fo(),p=xo();return Wn=function(m,d,v,y,b,w,R){var x=g(m,v),_=g(d,v),k=R.get(_);if(k)t(m,v,k);else{var P=w?w(x,_,v+"",m,d,R):void 0,C=void 0===P;if(C){var $=s(_),N=!$&&c(_),j=!$&&!N&&f(_);P=_,$||N||j?s(x)?P=x:a(x)?P=n(x):N?(C=!1,P=e(_,!0)):j?(C=!1,P=r(_,!0)):P=[]:l(_)||i(_)?(P=x,i(x)?P=p(x):h(x)&&!u(x)||(P=o(_))):C=!1}C&&(R.set(_,P),b(P,_,y,w,R),R.delete(_)),t(m,v,P)}}}function ko(){if(Mn)return Fn;Mn=1;var t=Ke(),e=Xe(),r=tr(),n=_o(),o=ke(),i=Ro(),s=fo();return Fn=function a(c,u,h,l,f){c!==u&&r(u,(function(r,i){if(f||(f=new t),o(r))n(c,u,i,h,a,l,f);else{var g=l?l(s(c,i),r,i+"",c,u,f):void 0;void 0===g&&(g=r),e(c,i,g)}}),i)},Fn}function Po(){if(Hn)return Gn;return Hn=1,Gn=function(t){return t}}function Co(){if(In)return zn;return In=1,zn=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}}function $o(){if(qn)return Dn;qn=1;var t=Co(),e=Math.max;return Dn=function(r,n,o){return n=e(void 0===n?r.length-1:n,0),function(){for(var i=arguments,s=-1,a=e(i.length-n,0),c=Array(a);++s<a;)c[s]=i[n+s];s=-1;for(var u=Array(n+1);++s<n;)u[s]=i[s];return u[n]=o(c),t(r,this,u)}},Dn}function No(){if(Jn)return Vn;return Jn=1,Vn=function(t){return function(){return t}}}function jo(){if(Yn)return Kn;Yn=1;var t=No(),e=Ye();return Kn=e?function(r,n){return e(r,"toString",{configurable:!0,enumerable:!1,value:t(n),writable:!0})}:Po()}function Eo(){if(Xn)return Qn;Xn=1;var t=Date.now;return Qn=function(e){var r=0,n=0;return function(){var o=t(),i=16-(o-n);if(n=o,i>0){if(++r>=800)return arguments[0]}else r=0;return e.apply(void 0,arguments)}},Qn}function Bo(){if(to)return Zn;to=1;var t=jo(),e=Eo()(t);return Zn=e}function Oo(){if(ro)return eo;ro=1;var t=Po(),e=$o(),r=Bo();return eo=function(n,o){return r(e(n,o,t),n+"")}}function To(){if(oo)return no;oo=1;var t=ae(),e=Yr(),r=vo(),n=ke();return no=function(o,i,s){if(!n(s))return!1;var a=typeof i;return!!("number"==a?e(s)&&r(i,s.length):"string"==a&&i in s)&&t(s[i],o)}}function So(){if(so)return io;so=1;var t=Oo(),e=To();return io=function(r){return t((function(t,n){var o=-1,i=n.length,s=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(s=r.length>3&&"function"==typeof s?(i--,s):void 0,a&&e(n[0],n[1],a)&&(s=i<3?void 0:s,i=1),t=Object(t);++o<i;){var c=n[o];c&&r(t,c,o,s)}return t}))}}function Ao(){if(co)return ao;co=1;var t=ko(),e=So()((function(e,r,n){t(e,r,n)}));return ao=e}var Lo,Wo,Uo,Fo,Mo,Go,Ho,zo,Io,Do,qo,Vo,Jo,Ko,Yo,Qo,Xo,Zo,ti,ei,ri,ni,oi,ii,si=ie(Ao());function ai(){if(Wo)return Lo;Wo=1;var t=_e(),e=Dr();return Lo=function(r){return"symbol"==typeof r||e(r)&&"[object Symbol]"==t(r)}}function ci(){if(Fo)return Uo;Fo=1;var t=Jr(),e=ai(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;return Uo=function(o,i){if(t(o))return!1;var s=typeof o;return!("number"!=s&&"symbol"!=s&&"boolean"!=s&&null!=o&&!e(o))||(n.test(o)||!r.test(o)||null!=i&&o in Object(i))}}function ui(){if(Go)return Mo;Go=1;var t=Ve();function e(r,n){if("function"!=typeof r||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var o=function(){var t=arguments,e=n?n.apply(this,t):t[0],i=o.cache;if(i.has(e))return i.get(e);var s=r.apply(this,t);return o.cache=i.set(e,s)||i,s};return o.cache=new(e.Cache||t),o}return e.Cache=t,Mo=e}function hi(){if(zo)return Ho;zo=1;var t=ui();return Ho=function(e){var r=t(e,(function(t){return 500===n.size&&n.clear(),t})),n=r.cache;return r}}function li(){if(Do)return Io;Do=1;var t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,e=/\\(\\)?/g,r=hi()((function(r){var n=[];return 46===r.charCodeAt(0)&&n.push(""),r.replace(t,(function(t,r,o,i){n.push(o?i.replace(e,"$1"):r||t)})),n}));return Io=r}function fi(){if(Vo)return qo;return Vo=1,qo=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}}function gi(){if(Ko)return Jo;Ko=1;var t=we(),e=fi(),r=Jr(),n=ai(),o=t?t.prototype:void 0,i=o?o.toString:void 0;return Jo=function t(o){if("string"==typeof o)return o;if(r(o))return e(o,t)+"";if(n(o))return i?i.call(o):"";var s=o+"";return"0"==s&&1/o==-1/0?"-0":s},Jo}function pi(){if(Qo)return Yo;Qo=1;var t=gi();return Yo=function(e){return null==e?"":t(e)}}function mi(){if(Zo)return Xo;Zo=1;var t=Jr(),e=ci(),r=li(),n=pi();return Xo=function(o,i){return t(o)?o:e(o,i)?[o]:r(n(o))}}function di(){if(ei)return ti;ei=1;var t=ai();return ti=function(e){if("string"==typeof e||t(e))return e;var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}}function vi(){if(ni)return ri;ni=1;var t=mi(),e=di();return ri=function(r,n){for(var o=0,i=(n=t(n,r)).length;null!=r&&o<i;)r=r[e(n[o++])];return o&&o==i?r:void 0}}function yi(){if(ii)return oi;ii=1;var t=vi();return oi=function(e,r,n){var o=null==e?void 0:t(e,r);return void 0===o?n:o}}var bi=ie(yi());const wi="package.json",Ri=[".env.local",".env"];class xi extends t{_env;shared;constructor(t){super(t),this._env=e.searchEnv({logger:this.logger,preloadList:this.feConfig.envOrder||Ri}),this.shared=Object.assign({},this.feConfig.release,this.getDefaultShreadOptions(t.shared))}getDefaultShreadOptions(t){return{rootPath:process.cwd(),sourceBranch:this._env.get("FE_RELEASE_BRANCH")||this._env.get("FE_RELEASE_SOURCE_BRANCH")||"master",releaseEnv:this._env.get("FE_RELEASE_ENV")||this._env.get("NODE_ENV")||"development",...t}}get rootPath(){return this.shared.rootPath}get sourceBranch(){return this.shared.sourceBranch}get releaseEnv(){return this.shared.releaseEnv}get env(){return this._env}get workspaces(){return this.getConfig("workspaces.workspaces")}get workspace(){return this.getConfig("workspaces.workspace")}setWorkspaces(t){this.options.workspaces={...this.options.workspaces,workspaces:t}}setConfig(t){this.options=si(this.options,t)}getConfig(t,e){return bi(this.options,t,e)}setShared(t){this.shared=si(this.shared,t)}getPkg(t,e){const r=this.workspace?.packageJson;if(!r)throw new Error("package.json is not found");return t?bi(r,t,e):r}getTemplateContext(){return{...this.shared,...this.workspace,publishPath:this.workspace?.path||"",env:this.releaseEnv,branch:this.sourceBranch}}async runChangesetsCli(t,e){let r="pnpm";try{await this.shell.exec("pnpm -v",{dryRun:!1})}catch{r="npm"}return await this.shell.exec(["pnpm"===r?"pnpm dlx":"npx","@changesets/cli",t,...e??[]])}}function _i(t,...e){return[t,...e]}const ki={maxWorkspace:3,multiWorkspaceSeparator:"_",workspaceVersionSeparator:"@",batchBranchName:"batch-${timestamp}-${releaseName}-${length}-packages"};class Pi{shell;logger;config;constructor(t,e,r={}){this.shell=t,this.logger=e,this.config={...ki,...r}}getReleaseBranchName(t,e,r){const n=r.branchName||"release-${tagName}";if("string"!=typeof n)throw new Error("Branch name template is not a string");return this.logger.verbose("Release Branch template is:",n),this.shell.format(n,{pkgName:t,releaseName:t,tagName:e,...r})}getBatchReleaseBranchName(t,e,r,n){const o=this.config.batchBranchName;if("string"!=typeof o)throw new Error("Branch name template is not a string");return this.logger.verbose("Release Batch Branch template is:",o),this.shell.format(o,{pkgName:t,releaseName:t,tagName:e,...r,length:n,timestamp:Date.now()})}getReleaseName(t){if(1===t.length)return t[0].name;const{maxWorkspace:e,multiWorkspaceSeparator:r,workspaceVersionSeparator:n}=this.config;return t.slice(0,e).map((({name:t,version:e})=>`${t}${n}${e}`)).join(r)}getReleaseTagName(t){return 1===t.length?t[0].version:`batch-${t.length}-${(new Date).toISOString().split("T")[0]}`}getReleaseBranchParams(t,e){const r=this.getReleaseTagName(t),n=this.getReleaseName(t);return{tagName:r,releaseBranch:t.length>1?this.getBatchReleaseBranchName(n,r,e,t.length):this.getReleaseBranchName(n,r,e)}}getPRTitle(t,e){const r=this.config.PRTitle||"Release ${env} ${pkgName} ${tagName}";return this.shell.format(r,{...e,tagName:t.tagName,pkgName:t.releaseBranch})}getPRBody(t,e,r){const n=this.config.PRBody,o=t.length>1?t.map((t=>this.shell.format("\n## ${name} ${version}\n${changelog}\n",t))).join("\n"):t[0].changelog,{workspaceVersionSeparator:i}=this.config,s=1===t.length?e.tagName:t.map((t=>`${t.name}${i}${t.version}`)).join(" ");return this.shell.format(n,{...r,tagName:s,changelog:o})}}class Ci{context;_octokit=null;constructor(t){this.context=t}getGitHubUserInfo(){const{authorName:t,repoName:e}=this.context.shared;if(!t||!e)throw new Error("Author name or repo name is not set");return{owner:t,repo:e}}getToken(){const{tokenRef:t="GITHUB_TOKEN"}=this.context.getConfig("githubPR"),e=this.context.env.get(t);if(!e)throw new Error(`Token is not set. Please set ${t} environment variable.`);return e}get octokit(){if(this._octokit)return this._octokit;const{timeout:t}=this.context.getConfig("githubPR"),e={auth:this.getToken(),request:{timeout:t}};return this._octokit=new n(e),this._octokit}get logger(){return this.context.logger}get shell(){return this.context.shell}get autoMergeType(){return this.context.shared.autoMergeType||"squash"}get dryRunPRNumber(){return this.context.getConfig("githubPR.dryRunPRNumber","999999")}get autoMergeReleasePR(){return this.context.shared.autoMergeReleasePR||false}async mergePR(t,e){if(!t)return void this.logger.error("Failed to create Pull Request.",t);const r=this.autoMergeType;if(this.context.dryRun){const{repoName:n,authorName:o}=this.context.shared;this.logger.info(`[DRY RUN] Would merge PR #${t} with method '${r}' in repo ${o}/${n}, branch ${e}`)}else await this.octokit.rest.pulls.merge({...this.getGitHubUserInfo(),pull_number:Number(t),merge_method:r})}async checkedPR(t,e){try{await this.octokit.rest.pulls.get({...this.getGitHubUserInfo(),pull_number:Number(t)}),await this.octokit.rest.git.deleteRef({...this.getGitHubUserInfo(),ref:`heads/${e}`}),this.logger.info(`Branch ${e} has been deleted`)}catch(r){if(404===r.status)return void this.logger.warn(`PR #${t} or branch ${e} not found`);throw this.logger.error("Failed to check PR or delete branch",r),r}}async createReleasePRLabel(){const t=this.context.shared.label;if(!(t&&t.name&&t.description&&t.color))throw new Error("Label is not valid, skipping creation");if(this.context.dryRun)return this.logger.info("[DRY RUN] Would create PR label with:",t),t;try{const e=await this.octokit.rest.issues.createLabel({...this.getGitHubUserInfo(),name:t.name,description:t.description,color:t.color.replace("#","")});return this.logger.debug("Create PR label Success",e),t}catch(e){if(422===e.status)return this.logger.warn(`Label ${t.name} already exists, skipping!`),t;throw this.logger.error("Create PR label Failed",e),e}}async createReleasePR(t){if(this.context.getConfig("githubPR.dryRunCreatePR")||this.context.dryRun)return this.logger.info("[DRY RUN] Would create PR with:",{...t,labels:t.labels}),this.dryRunPRNumber;try{const e=await this.octokit.rest.pulls.create({...this.getGitHubUserInfo(),...t}),r=e.data.number;if(!r)throw new Error("CreateReleasePR Failed, prNumber is empty");if(this.logger.debug("Create PR Success",[e?.url]),t.labels&&t.labels.length){const e=await this.octokit.rest.issues.addLabels({...this.getGitHubUserInfo(),issue_number:r,labels:t.labels});this.logger.debug("Add PR label Success",[e.url])}return r.toString()}catch(t){if(422===t.status&&t.message.includes("already exists")){this.logger.warn("PR already exists");const e=t.message.match(/pull request #(\d+)/);return e?e[1]:""}throw this.logger.error("Failed to create PR",t),t}}truncateBody(t){return t&&t.length>=124e3?t.substring(0,124e3)+"...":t}getOctokitReleaseOptions(t){const{releaseName:e,draft:r=!1,preRelease:n=!1,autoGenerate:o=!1,makeLatest:i=!0,releaseNotes:s,discussionCategoryName:a}=this.context.getConfig("githubPR"),c=e,u=o?"":this.truncateBody(String(s));return{name:c,make_latest:i.toString(),body:u,draft:r,prerelease:n,generate_release_notes:o,discussion_category_name:a,tag_name:"",...t,...this.getGitHubUserInfo()}}async createRelease(t){const e=this.getOctokitReleaseOptions({tag_name:t.tagName,body:t.changelog});if(e.name=this.shell.format(e.name,t),this.logger.exec(`octokit repos.createRelease "${e.name}" (${e.tag_name})`,{isDryRun:this.context.dryRun}),!e.tag_name)throw new Error("TagName is undefined");if(this.context.dryRun)return;const r=await this.octokit.repos.createRelease(e);this.logger.verbose(`octokit repos.createRelease: done (${r.headers.location})`)}}var $i,Ni;function ji(){if(Ni)return $i;Ni=1;var t=_e(),e=Jr(),r=Dr();return $i=function(n){return"string"==typeof n||!e(n)&&r(n)&&"[object String]"==t(n)}}var Ei=ie(ji());class Bi{context;pluginName;props;onlyOne=!0;constructor(t,e,r={}){this.context=t,this.pluginName=e,this.props=r,this.setConfig(this.getInitialProps(r))}getInitialProps(t){const e=this.context.options[this.pluginName],r=bi(this.context.shared,this.pluginName);return e||t?si({},r,t,e):{}}get logger(){return this.context.logger}get shell(){return this.context.shell}get options(){return this.context.getConfig(this.pluginName,{})}getEnv(t,e){return this.context.env.get(t)??e}enabled(t,e){return!0}getConfig(t,e){return t?this.context.getConfig([this.pluginName,...Array.isArray(t)?t:[t]],e):this.context.getConfig(this.pluginName,e)}setConfig(t){this.context.setConfig({[this.pluginName]:t})}onBefore(t){}onExec(t){}onSuccess(t){}onError(t){}async step({label:t,task:e}){this.logger.obtrusive(t);try{const r=await e();return this.logger.info(`${t} - success`),r}catch(t){throw this.logger.error(t),t}}}class Oi extends Bi{async onBefore(){const t=await this.getUserInfo();if(!t)throw new Error("Failed to get repoInfo");let e=this.context.shared.currentBranch;e||(e=await this.getCurrentBranch()),e&&await this.context.shell.exec(`git checkout ${e}`,{dryRun:!1}),this.context.setShared({repoName:t.repoName,authorName:t.authorName,currentBranch:e})}async getCurrentBranch(){return await new Promise((t=>setTimeout(t,100))),this.context.shell.exec("git rev-parse --abbrev-ref HEAD",{dryRun:!1})}async getRemoteUrl(){return(await this.context.shell.exec("git config --get remote.origin.url",{dryRun:!1})).trim()}async getUserInfo(){let t;try{t=await this.getRemoteUrl()}catch{throw new Error("Failed to get git remote url. Please ensure this is a git repository with a valid remote.")}if(!t)throw new Error("Git remote URL is empty. Please set a valid GitHub remote URL.");this.context.logger.verbose("repoUrl: ",t);const e=t.match(/github\.com[:/]([^/]+)\/([^/.]+)(?:\.git)?$/);if(!e)throw new Error("Invalid GitHub repository URL format. Please ensure the remote URL is from GitHub.");const[,r,n]=e;if(!this.isValidString(r)||!this.isValidString(n))throw new Error("Failed to extract owner or repository name from GitHub URL");return{repoName:n,authorName:r}}isValidString(t){return!!t&&Ei(t)}commit(t,e=[]){return this.context.shell.exec(["git","commit","--message",JSON.stringify(t),...e])}}class Ti{options;constructor(t){this.options=t}compare(t,e){return"function"==typeof this.options.compare?this.options.compare(t,e):t.startsWith(e)}toChangeLabel(t,e=this.options.changePackagesLabel){return e.replace("${name}",t)}toChangeLabels(t,e=this.options.changePackagesLabel){return t.map((t=>this.toChangeLabel(t,e)))}pick(t,e=this.options.packagesDirectories){const r=[];for(const n of e)for(const e of t)if(this.compare(e,n)){r.push(n);break}return r}}class Si{static readJson(t){const e=a(t,"utf-8");return JSON.parse(e)}static toWorkspace(t,e){let{root:r,packageJson:n}=t;const o=t.path;if(!o)throw new Error("path is not required!");return r=r||h(e,o),n=n||Si.readJson(h(r,wi)),{name:n.name,version:n.version,path:o,root:r,packageJson:n}}}class Ai extends Bi{releaseTask=null;workspacesList=[];_skip=!1;releaseLabel;constructor(t){super(t,"workspaces"),this.releaseLabel=new Ti({changePackagesLabel:this.context.shared.changePackagesLabel||"change:${name}",packagesDirectories:this.context.shared.packagesDirectories||[]})}enabled(){return!this._skip&&!this.getConfig("skip")}async onBefore(){const t=this.getConfig("workspace");if(t)return this.logger.debug("Use the specified workspace",t),void this.setCurrentWorkspace(t,[]);const e=await this.getWorkspaces();if(this.getConfig("skipCheckPackage")||0===e.length)throw new Error("No changes to publish packages");const{publishPath:r}=this.context.shared;if(r){const t=e.find((t=>o(t.root)===o(r)));if(this.nextSkip(),!t)throw new Error(`No workspace found for: ${r}`);return this.logger.debug(`Workspace of ${r} find!`,i(t.root,wi)),void this.setCurrentWorkspace(t,[t])}const[n,...s]=e;this.workspacesList=s,this.setCurrentWorkspace(n,e)}nextSkip(){this._skip=!0,this.logger.debug("skip next workspace")}setReleaseTask(t){this.releaseTask=t}setCurrentWorkspace(t,e){this.context.setShared({publishPath:t.path}),this.setConfig({workspace:t,workspaces:e})}getPackages(){const t=this.context.shared.packagesDirectories;return Array.isArray(t)?t:[]}async getGitWorkspaces(){const t=this.context.sourceBranch,e=await this.shell.exec(`git diff --name-only origin/${t}...HEAD`,{dryRun:!1});return"string"==typeof e?e.split("\n"):[]}async getChangedPackages(t,e){if(this.logger.debug("changeLabels",e),Array.isArray(e)&&e.length>0){const r=t.filter((t=>{const r=this.releaseLabel.toChangeLabel(t);return e.includes(r)}));return this.logger.debug("changed by labels",r),r}const r=await this.getGitWorkspaces();return this.logger.debug("changed by git",r),this.releaseLabel.pick(r,t)}async getWorkspaces(){const t=this.getPackages();this.logger.debug("packages",t);const e=await this.getChangedPackages(t,this.getConfig("changeLabels"));this.logger.debug("changedPaths",e);return e.map((t=>Si.toWorkspace({path:t},this.context.rootPath)))}}function Li(t,...e){return"function"==typeof t&&t.prototype&&t.prototype.constructor===t?new t(...e):t(...e)}function Wi(t){return t.startsWith(".")?s(t).name:t}async function Ui(t){let e=null;try{e=(await import(t)).default}catch{try{e=(await import(i(process.cwd(),t))).default}catch{const r=l(process.cwd());e=(await import(f(r.resolve(t,{paths:[process.cwd()]})).href)).default}}return[Wi(t),e]}async function Fi(t,e,r=5){const n=g(r),o=e.map((([e,...r])=>n((()=>(async(e,...r)=>{if("string"==typeof e){const[,n]=await Ui(e);return Li(n,t,...r)}return Li(e,t,...r)})(e,...r)))));return Promise.all(o)}class Mi{formatFlatCommits(t,e,r){const{types:n=[],formatTemplate:o="* ${message}${prRef}\n"}=e,i=new Map;for(const e of t){const t=e.type||"other";i.has(t)||i.set(t,[]),i.get(t).push(e)}const s=[];for(const{type:t,section:e,hidden:a}of n){if(a)continue;const n=i.get(t);if(n?.length){s.push(`${e||t}`);for(const t of n){const e=t.prNumber?` (#${t.prNumber})`:"";if(s.push(r.format(o,{...t,prRef:e})),t.body){const e=t.body.split("\n").map((t=>` ${t}`));s.push(e.join("\n"))}}}}return s}}class Gi{shell;options;constructor(t,e){this.shell=t,this.options=e}parseCommitBody(t){const e=t.split("\n").filter(Boolean),r=[];let n=null;for(let t=0;t<e.length;t++){const o=e[t].trim();if(o.startsWith("Co-authored-by:")||"---------"===o||0===o.length)continue;const i=o.match(/^\*?\s*(?:([a-z]+)(?:\((.*?)\))?: )?(.+)$/i);if(i&&o.startsWith("*")){n&&r.push({...n,body:n.bodyLines?.join("\n").trim()});const[t,e,s,a]=i;n={matchRaw:t,raw:o,type:e?.toLowerCase(),scope:s?.trim(),message:a.trim(),bodyLines:[]}}else n&&o.startsWith("-")&&n.bodyLines?.push(o)}return n&&r.push({...n,body:n.bodyLines?.join("\n").trim()}),r}async getPRCommits(t){const{from:e,to:r,directory:n,format:o}={...this.options,...t};return(await this.getLog({from:e,to:r,directory:n,format:o,noMerges:!1})).split("\n----------------------\n").filter(Boolean).map((t=>{const[e,r,...n]=t.trim().split("\n"),o=n.join("\n"),i=r.match(/\(#(\d+)\)/),s=r.replace(/\s*\(#\d+\)\s*$/,"").match(/^(?:([a-z]+)(?:\((.*?)\))?: )?(.+)$/i);return{hash:e,raw:{title:r,body:o},title:s?{type:s[1]?.toLowerCase(),scope:s[2]?.trim(),message:s[3].trim()}:{message:r.replace(/\s*\(#\d+\)\s*$/,"").trim()},commits:this.parseCommitBody(o),prNumber:i?.[1]}}))}async hasTag(t){return this.shell.exec(`git tag --list "${t}"`,{dryRun:!1}).then((()=>!0)).catch((()=>!1))}async resolveTag(t,e){if(t)try{if(await this.shell.exec(`git tag --list "${t}"`,{dryRun:!1}).then((t=>!!t.trim())))return t}catch{}return"root"===e?this.shell.exec("git rev-list --max-parents=0 HEAD",{dryRun:!1}).then((t=>t.trim())):"HEAD"}async getLog(t){const{directory:e,format:r="%H%n%s%n%b%n----------------------",noMerges:n=!0}=t,o=await this.resolveTag(t.from,"root"),i=await this.resolveTag(t.to,"HEAD"),s=`git log --pretty=format:"${r}" ${n?"--no-merges":""} ${o===i?i:`${o}..${i}`} ${e?`-- "${e}"`:""}`;return this.shell.exec(s.trim(),{dryRun:!1})}flatCommits(t){const e=[];for(const r of t){const t={title:r.title,raw:r.raw,hash:r.hash,prNumber:r.prNumber},n=r.commits.map((e=>({...e,prNumber:r.prNumber,hash:r.hash,parentHash:r.hash,parentCommit:t})));e.push(...n)}return e}formatFlatCommits(t,e){const{types:r=[],formatter:n}={...this.options,...e};return(n||new Mi).formatFlatCommits(t,{types:r},this.shell)}}const Hi=[_i(Ai),_i(class extends Bi{constructor(t,e){super(t,"changelog",{increment:"patch",changesetRoot:".changeset",tagTemplate:"${name}@${version}",tagPrefix:"${name}",tagMatch:"${name}@*",...e})}get changesetRoot(){return h(this.context.rootPath,this.getConfig("changesetRoot"))}enabled(){return!this.getConfig("skip")}async onBefore(){if(!c(this.changesetRoot))throw new Error(`Changeset directory ${this.changesetRoot} does not exist`);this.logger.debug(`${this.changesetRoot} exists`)}mergeWorkspaces(t){return t.map((t=>{const e=Si.toWorkspace({path:t.path},this.context.rootPath),r={...t,version:e.version};return r.tagName=this.generateTagName(r),r}))}async onExec(){const t=await this.step({label:"Generate Changelogs",task:()=>Promise.all(this.context.workspaces.map((t=>this.generateChangelog(t))))});this.getConfig("skipChangeset")?this.logger.debug("Skip generate changeset files"):(await this.step({label:"Changeset Version",task:()=>Promise.all(t.map((t=>this.generateChangesetFile(t))))}),await this.context.runChangesetsCli("version",["--no-changelog"]));const e=this.mergeWorkspaces(t);this.logger.debug("new workspaces",e),this.context.setWorkspaces(e)}getTagPrefix(t){return this.shell.format(this.getConfig("tagPrefix"),t)}async createChangelog({lastTag:t,workspace:e}){const r=new Gi(this.context.shell,{...this.getConfig("gitChangelogOptions"),from:t,directory:e.path});return r.getPRCommits().then((t=>{const e=r.flatCommits(t);return r.formatFlatCommits(e).join("\n")}))}async generateChangelog(t){const e=await this.getTagName(t);this.logger.verbose("tagName is:",e);const r=await this.createChangelog({workspace:t,lastTag:e});return{...t,lastTag:e,changelog:r}}generateTagName(t){try{const e=this.getConfig("tagTemplate");return this.shell.format(e,t)}catch(e){return console.error(`Error generating tag name for ${t.name}:`,e),`${t.name}-v0.0.0`}}async getTagName(t){try{const e=this.generateTagName(t),r=this.shell.format(this.getConfig("tagMatch"),t),n=await this.shell.exec(`git for-each-ref --sort=-creatordate --format "%(refname:short)|%(creatordate:iso8601)" "refs/tags/${r}"`,{dryRun:!1});if(this.logger.debug("tagsOutput",n),!n)return e;const o=n.split("\n").filter(Boolean);if(0===o.length)return e;return o[0].split("|")[0]}catch(e){console.error(`Error getting tag for ${t.name}:`,e);return this.generateTagName(t)}}getIncrement(){const t=this.context.getConfig("workspaces.changeLabels");if(Array.isArray(t)&&t.length>0){if(t.includes("increment:major"))return"major";if(t.includes("increment:minor"))return"minor"}return this.getConfig("increment","patch")}async generateChangesetFile(t){const{name:e,version:r}=t,n=`${e}-${r}`.replace(/[\/\\]/g,"_"),o=h(this.changesetRoot,`${n}.md`),i=this.getIncrement();this.logger.verbose("increment is:",[i]);const s=this.shell.format("---\n'${name}': '${increment}'\n---\n${changelog}",{...t,increment:i});if(this.context.dryRun)return this.logger.info(`Changeset [${o}] will be created, content is:`),void this.logger.log(s);c(o)?this.logger.info(`Changeset ${n} already exists`):u(o,s,"utf-8")}},{}),_i(class extends Oi{context;releaseParams;githubManager;constructor(t,e){super(t,"githubPR",{releaseName:"Release ${name} v${version}",...e}),this.context=t,this.githubManager=new Ci(this.context),this.releaseParams=new Pi(t.shell,t.logger,{PRTitle:this.getConfig("PRTitle",this.context.shared.PRTitle),PRBody:this.getConfig("PRBody",this.context.shared.PRBody),...this.props})}enabled(t){return!this.getConfig("skip")&&("onExec"===t?!this.isPublish:"onSuccess"!==t||this.isPublish)}get isPublish(){return!this.getConfig("releasePR")}async isGithubRepository(){try{return(await this.getRemoteUrl()).includes("github.com")}catch{return!1}}async onBefore(){this.logger.verbose("GithubPR onBefore");if(!await this.isGithubRepository())throw new Error("Current repository is not a GitHub repository. GitHub PR workflow is only available for GitHub repositories.");if(await super.onBefore(),this.isPublish){const t=this.getEnv("NPM_TOKEN");if(!t)throw new Error("NPM_TOKEN is not set");await this.shell.exec(`npm config set //registry.npmjs.org/:_authToken=${t}`)}}async onExec(){const t=this.context.workspaces;await this.step({label:"Release Commit",task:()=>this.relesaeCommit(t)});const e=await this.step({label:"Create Release Branch",task:()=>this.createReleaseBranch(t)});await this.releasePullRequest(t,e)}async onSuccess(){const t=this.context.workspaces;this.getConfig("dryRunCreatePR")||(await this.context.runChangesetsCli("publish"),await this.shell.exec("git push origin --tags")),await this.step({label:"Release Github",task:()=>Promise.all(t.map((t=>(this.logger.debug(t),this.githubManager.createRelease(t)))))})}async relesaeCommit(t){const e=this.getConfig("commitArgs",[]);if(1===t.length)return await this.shell.exec("git add ."),void await this.commitWorkspace(t[0],e);await this.shell.exec("git add .");const r=`chore(tag): ${t.map((t=>`${t.name} v${t.version}`)).join(",")}`;await this.commit(r,e)}async releasePullRequest(t,e){const r=await this.step({label:"Create Release PR",task:()=>this.createReleasePR(t,e)});if(this.githubManager.autoMergeReleasePR){const{releaseBranch:t}=e;return await this.step({label:`Merge Release PR(${r})`,task:()=>this.githubManager.mergePR(r,t)}),void await this.step({label:`Checked Release PR(${r})`,task:()=>this.githubManager.checkedPR(r,t)})}this.logger.info(`Please manually merge PR(#${r}) and complete the publishing process afterwards`)}async commitWorkspace(t,e=[]){const r=this.shell.format(this.getConfig("commitMessage","chore(tag): ${name} v${version}"),t);return await this.commit(r,e)}async createReleaseBranch(t){const e=this.releaseParams.getReleaseBranchParams(t,this.context.getTemplateContext()),{tagName:r,releaseBranch:n}=e;if("string"!=typeof r)throw new Error("Tag name is not a string");const{sourceBranch:o,currentBranch:i}=this.context.shared;this.context.logger.verbose("PR TagName is:",r),this.context.logger.verbose("PR CurrentBranch is:",i),this.context.logger.verbose("PR SourceBranch is:",o),this.context.logger.verbose("PR ReleaseBranch is:",n);try{await this.context.shell.exec(`git fetch origin ${o} ${i}`),await this.context.shell.exec(`git checkout -b ${n} ${i}`),await this.context.shell.exec(`git push origin ${n}`)}catch(t){throw t.message.includes("remote: Permission to ")&&this.context.logger.warn('Token maybe not allow Workflow permissions, can you try to open "Workflow permissions" -> "Read and write permissions" for this token?'),t}return{tagName:r,releaseBranch:n}}async createReleasePR(t,e){let r=[(await this.githubManager.createReleasePRLabel()).name];if(this.getConfig("pushChangeLabels")){const t=this.context.getConfig("workspaces.changeLabels");Array.isArray(t)&&t.length>0&&r.push(...t)}r=Array.from(new Set(r)),this.logger.verbose("Release PR labels:",r);const n=this.context.getTemplateContext(),o=this.releaseParams.getPRTitle(e,n),i=this.releaseParams.getPRBody(t,e,n);return this.githubManager.createReleasePR({title:o,body:i,base:this.context.sourceBranch,head:e.releaseBranch,labels:r})}},{})];class zi{executor;defaultTuples;context;constructor(t={},e=new r,n=Hi){this.executor=e,this.defaultTuples=n,this.context=new xi(t)}getContext(){return this.context}async usePlugins(t){t=t||this.context.shared.plugins||[];const e=await Fi(this.context,[...this.defaultTuples,...t]);return e.forEach((t=>{t instanceof Ai&&t.setReleaseTask(this),this.executor.use(t)})),e}async run(){return this.executor.exec(this.context,(t=>Promise.resolve(t)))}async exec(t){if("false"===this.context.env.get("FE_RELEASE"))throw new Error("Skip Release");return await this.usePlugins(t),this.run()}}var Ii,Di,qi,Vi;function Ji(){if(Di)return Ii;Di=1;var t=go(),e=mi(),r=vo(),n=ke(),o=di();return Ii=function(i,s,a,c){if(!n(i))return i;for(var u=-1,h=(s=e(s,i)).length,l=h-1,f=i;null!=f&&++u<h;){var g=o(s[u]),p=a;if("__proto__"===g||"constructor"===g||"prototype"===g)return i;if(u!=l){var m=f[g];void 0===(p=c?c(m,g,f):void 0)&&(p=n(m)?m:r(s[u+1])?[]:{})}t(f,g,p),f=f[g]}return i}}function Ki(){if(Vi)return qi;Vi=1;var t=Ji();return qi=function(e,r,n){return null==e?e:t(e,r,n)}}var Yi=ie(Ki());function Qi(t,e){return Object.entries(t).reduce(((t,[r,n])=>(r.includes(".")?Yi(t,r,n):Yi(t,e?`${e}.${r}`:r,n),t)),{})}export{Bi as Plugin,xi as ReleaseContext,Ti as ReleaseLabel,zi as ReleaseTask,Li as factory,Ui as load,Fi as loaderPluginsFromPluginTuples,Qi as reduceOptions,_i as tuple};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qlover/fe-release",
|
|
3
3
|
"description": "A tool for releasing front-end projects, supporting multiple release modes and configurations, simplifying the release process and improving efficiency.",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.10",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
7
7
|
"homepage": "https://github.com/qlover/fe-base/tree/master/packages/fe-release",
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@octokit/rest": "^21.0.2",
|
|
49
|
-
"@types/conventional-changelog": "^6.0.0",
|
|
50
49
|
"@types/semver": "^7.7.0",
|
|
51
50
|
"commander": "^11.0.0",
|
|
52
51
|
"p-limit": "^6.2.0",
|
|
@@ -54,10 +53,9 @@
|
|
|
54
53
|
},
|
|
55
54
|
"dependencies": {
|
|
56
55
|
"@octokit/rest": "^21.0.2",
|
|
57
|
-
"@qlover/env-loader": "^0.0.
|
|
58
|
-
"@qlover/fe-corekit": "^1.2.
|
|
56
|
+
"@qlover/env-loader": "^0.0.4",
|
|
57
|
+
"@qlover/fe-corekit": "^1.2.5",
|
|
59
58
|
"@qlover/scripts-context": "^0.0.11",
|
|
60
|
-
"conventional-changelog": "^6.0.0",
|
|
61
59
|
"lodash": "^4.17.21"
|
|
62
60
|
},
|
|
63
61
|
"scripts": {
|