@qlover/fe-release 1.0.9 โ 2.0.0
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/README.md +209 -35
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,62 +1,236 @@
|
|
|
1
1
|
# Fe-release
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@qlover/fe-release)
|
|
4
|
+
[](https://github.com/your-repo/fe-release/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
A professional front-end release automation tool built on top of [@changesets/cli](https://github.com/changesets/changesets), providing enhanced workflows for automated PR management and release processes.
|
|
7
|
+
|
|
8
|
+
## ๐ Table of Contents
|
|
9
|
+
|
|
10
|
+
- [Features](#features)
|
|
11
|
+
- [Installation](#installation)
|
|
12
|
+
- [Quick Start](#quick-start)
|
|
13
|
+
- [Usage](#usage)
|
|
14
|
+
- [Configuration](#configuration)
|
|
15
|
+
- [Workflows](#workflows)
|
|
16
|
+
- [Plugin System](#plugin-system)
|
|
17
|
+
- [API Reference](#api-reference)
|
|
18
|
+
- [Troubleshooting](#troubleshooting)
|
|
19
|
+
- [Contributing](#contributing)
|
|
20
|
+
- [License](#license)
|
|
21
|
+
|
|
22
|
+
## โจ Features
|
|
23
|
+
|
|
24
|
+
- **Automated Version Management**
|
|
25
|
+
- Powered by `@changesets/cli` for reliable version control
|
|
26
|
+
- Automatic version bumping based on changes
|
|
27
|
+
- Configurable version increment strategies
|
|
28
|
+
|
|
29
|
+
- **Flexible Release Workflows**
|
|
30
|
+
- Manual release process for direct control
|
|
31
|
+
- PR-based automated release workflow (GitHub)
|
|
32
|
+
- Customizable release strategies
|
|
33
|
+
|
|
34
|
+
- **GitHub Integration**
|
|
35
|
+
- Automated PR creation and management
|
|
36
|
+
- Smart PR labeling system
|
|
37
|
+
- Automated release notes generation
|
|
38
|
+
- GitHub Actions integration
|
|
39
|
+
|
|
40
|
+
- **Workspace Support**
|
|
41
|
+
- First-class monorepo support
|
|
42
|
+
- Multi-package release coordination
|
|
43
|
+
- Dependency graph awareness
|
|
44
|
+
- Selective package publishing
|
|
45
|
+
|
|
46
|
+
- **Extensive Configuration**
|
|
47
|
+
- Rich CLI options
|
|
48
|
+
- Configurable via `fe-config.json`
|
|
49
|
+
- Environment variable support
|
|
50
|
+
- Plugin system for customization
|
|
51
|
+
|
|
52
|
+
## ๐ Installation
|
|
8
53
|
|
|
9
54
|
```bash
|
|
55
|
+
# Using npm
|
|
10
56
|
npm install @qlover/fe-release
|
|
57
|
+
|
|
58
|
+
# Using yarn
|
|
59
|
+
yarn add @qlover/fe-release
|
|
60
|
+
|
|
61
|
+
# Using pnpm
|
|
62
|
+
pnpm add @qlover/fe-release
|
|
11
63
|
```
|
|
12
64
|
|
|
13
|
-
##
|
|
65
|
+
## ๐ Quick Start
|
|
14
66
|
|
|
67
|
+
1. **Basic Release**
|
|
15
68
|
```bash
|
|
16
|
-
|
|
17
|
-
|
|
69
|
+
# Create a release PR
|
|
70
|
+
fe-release -P
|
|
18
71
|
|
|
19
|
-
|
|
72
|
+
# Perform a dry run
|
|
73
|
+
fe-release --dry-run
|
|
74
|
+
```
|
|
20
75
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
- `-h, --help`๏ผshow help information.
|
|
76
|
+
2. **Workspace Release**
|
|
77
|
+
```bash
|
|
78
|
+
# Release multiple packages
|
|
79
|
+
fe-release --workspaces.change-labels=pkg1,pkg2 -P
|
|
80
|
+
```
|
|
27
81
|
|
|
28
|
-
|
|
82
|
+
## ๐ป Usage
|
|
29
83
|
|
|
30
|
-
|
|
84
|
+
### Command Line Interface
|
|
31
85
|
|
|
32
86
|
```bash
|
|
33
|
-
fe-release
|
|
34
|
-
# or
|
|
35
|
-
fe-release -v
|
|
87
|
+
fe-release [options]
|
|
36
88
|
```
|
|
37
89
|
|
|
38
|
-
|
|
90
|
+
#### Core Options
|
|
91
|
+
|
|
92
|
+
| Option | Description | Default |
|
|
93
|
+
|--------|-------------|---------|
|
|
94
|
+
| `-v, --version` | Output version | - |
|
|
95
|
+
| `-d, --dry-run` | Preview without making changes | `false` |
|
|
96
|
+
| `-V, --verbose` | Show detailed logs | `false` |
|
|
97
|
+
| `-p, --publish-path` | Package publish path | - |
|
|
98
|
+
| `-P, --githubPR.release-PR` | Create release PR | `false` |
|
|
99
|
+
|
|
100
|
+
#### Advanced Options
|
|
101
|
+
|
|
102
|
+
| Option | Description | Default |
|
|
103
|
+
|--------|-------------|---------|
|
|
104
|
+
| `-b, --branch-name` | Release branch template | `release-${pkgName}-${tagName}` |
|
|
105
|
+
| `-s, --source-branch` | Source branch | `master` |
|
|
106
|
+
| `-i, --changelog.increment` | Version increment type | `patch` |
|
|
107
|
+
| `--changelog.skip` | Skip changelog generation | `false` |
|
|
108
|
+
| `--packages-directories` | Changed package directories | - |
|
|
109
|
+
| `-l, --workspaces.change-labels` | Change labels | - |
|
|
110
|
+
|
|
111
|
+
## โ๏ธ Configuration
|
|
112
|
+
|
|
113
|
+
### Environment Variables
|
|
114
|
+
|
|
115
|
+
| Variable | Description | Default |
|
|
116
|
+
|----------|-------------|---------|
|
|
117
|
+
| `FE_RELEASE` | Enable/disable release | `true` |
|
|
118
|
+
| `FE_RELEASE_BRANCH` | Source branch | - |
|
|
119
|
+
| `FE_RELEASE_ENV` | Release environment | - |
|
|
120
|
+
|
|
121
|
+
### fe-config.json
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"release": {
|
|
126
|
+
"publishPath": "",
|
|
127
|
+
"autoMergeReleasePR": false,
|
|
128
|
+
"autoMergeType": "squash",
|
|
129
|
+
"branchName": "release-${pkgName}-${tagName}",
|
|
130
|
+
"PRTitle": "[${pkgName} Release] Branch:${branch}, Tag:${tagName}, Env:${env}",
|
|
131
|
+
"packagesDirectories": ["packages/*"],
|
|
132
|
+
"maxWorkspace": 3,
|
|
133
|
+
"multiWorkspaceSeparator": "_",
|
|
134
|
+
"workspaceVersionSeparator": "@"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
39
138
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
139
|
+
#### Configuration Options
|
|
140
|
+
|
|
141
|
+
| Option | Description | Default |
|
|
142
|
+
|--------|-------------|---------|
|
|
143
|
+
| `publishPath` | Package publish directory | - |
|
|
144
|
+
| `autoMergeReleasePR` | Auto-merge release PRs | `false` |
|
|
145
|
+
| `autoMergeType` | Merge strategy | `squash` |
|
|
146
|
+
| `branchName` | Branch name template | `release-${pkgName}-${tagName}` |
|
|
147
|
+
| `PRTitle` | PR title template | See above |
|
|
148
|
+
| `maxWorkspace` | Max workspaces per release | `3` |
|
|
149
|
+
|
|
150
|
+
## ๐ Workflows
|
|
151
|
+
|
|
152
|
+
### Manual Release Flow
|
|
153
|
+
|
|
154
|
+
```mermaid
|
|
155
|
+
graph LR
|
|
156
|
+
A[Code Changes] --> B[Run fe-release]
|
|
157
|
+
B --> C[Version Update]
|
|
158
|
+
C --> D[Changelog Gen]
|
|
159
|
+
D --> E[Git Tag]
|
|
160
|
+
E --> F[NPM Publish]
|
|
161
|
+
F --> G[GitHub Release]
|
|
44
162
|
```
|
|
45
163
|
|
|
46
|
-
|
|
164
|
+
### PR-based Release Flow (GitHub)
|
|
47
165
|
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
166
|
+
```mermaid
|
|
167
|
+
graph LR
|
|
168
|
+
A[PR Created] --> B[Auto Label]
|
|
169
|
+
B --> C[Release PR]
|
|
170
|
+
C --> D[Version + Changelog]
|
|
171
|
+
D --> E[CI Release]
|
|
172
|
+
E --> F[Publish + Tag]
|
|
52
173
|
```
|
|
53
174
|
|
|
54
|
-
|
|
175
|
+
## ๐ Plugin System
|
|
176
|
+
|
|
177
|
+
### Built-in Plugins
|
|
55
178
|
|
|
179
|
+
- **GithubPR**: Handles GitHub PR automation
|
|
180
|
+
- **Workspaces**: Manages workspace releases
|
|
181
|
+
- **Changelog**: Generates changelogs
|
|
182
|
+
|
|
183
|
+
### Custom Plugin Example
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
import { Plugin } from '@qlover/fe-release';
|
|
187
|
+
|
|
188
|
+
class CustomPlugin extends Plugin {
|
|
189
|
+
async apply(context) {
|
|
190
|
+
// Plugin logic
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## ๐ Troubleshooting
|
|
196
|
+
|
|
197
|
+
### Common Issues
|
|
198
|
+
|
|
199
|
+
1. **Release Skipped**
|
|
200
|
+
```bash
|
|
201
|
+
Error: Skip Release
|
|
202
|
+
```
|
|
203
|
+
Solution: Check `FE_RELEASE` environment variable
|
|
204
|
+
|
|
205
|
+
2. **PR Creation Failed**
|
|
206
|
+
- Verify GitHub token permissions
|
|
207
|
+
- Check repository access
|
|
208
|
+
- Validate branch existence
|
|
209
|
+
|
|
210
|
+
### Debug Mode
|
|
211
|
+
|
|
212
|
+
Enable verbose logging:
|
|
56
213
|
```bash
|
|
57
|
-
fe-release
|
|
58
|
-
# or
|
|
59
|
-
fe-release -p ./path/to/package
|
|
214
|
+
fe-release -V
|
|
60
215
|
```
|
|
61
216
|
|
|
62
|
-
|
|
217
|
+
## ๐ค Contributing
|
|
218
|
+
|
|
219
|
+
1. Fork the repository
|
|
220
|
+
2. Create your feature branch
|
|
221
|
+
3. Commit your changes
|
|
222
|
+
4. Push to the branch
|
|
223
|
+
5. Create a Pull Request
|
|
224
|
+
|
|
225
|
+
## ๐ License
|
|
226
|
+
|
|
227
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
228
|
+
|
|
229
|
+
## ๐ Acknowledgments
|
|
230
|
+
|
|
231
|
+
- [@changesets/cli](https://github.com/changesets/changesets) team
|
|
232
|
+
- All contributors to this project
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
For more information, please visit our [documentation](https://your-docs-url.com).
|
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("node:fs"),require("node:module"),require("node:url"),require("p-limit"),require("conventional-changelog"),require("path"),require("fs");const n=["patch","minor","major"],t=e=>e.split(",").filter((e=>null!=e&&""!=e));(async function(){const{shared:i,...a}=function(){const i=new e.Command;return i.version("
|
|
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("node:fs"),require("node:module"),require("node:url"),require("p-limit"),require("conventional-changelog"),require("path"),require("fs");const n=["patch","minor","major"],t=e=>e.split(",").filter((e=>null!=e&&""!=e));(async function(){const{shared:i,...a}=function(){const i=new e.Command;return i.version("2.0.0","-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(!n.includes(e)&&!r.valid(e))throw new Error(`Invalid increment(-i) Must be one of [${n.join(", ")}] or valid version string(semver)`);return e}),"patch").option("--changelog.skip","Whether to skip the changelog").option("--packages-directories <packagesDirectories>","The packages that have been changed, multiple values use `,` to split, map to feConfig.release.packagesDirectories",t).option("--githubPR.dry-run-create-PR","Whether to dry run the creation of the pull request").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",t).option("--githubPR.command-prefix <commandPrefix>","The command prefix of the release, call @changeset/cli command","pnpm dlx"),i.parse(),o.reduceOptions(i.opts(),"shared")}(),{dryRun:s,verbose:c,...l}=i,h=Object.assign(a,{});await new o.ReleaseTask({dryRun:s,verbose:c,options:h,shared:l}).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 r,reduceOptions as t}from"./index.js";import"@qlover/scripts-context";import"@qlover/env-loader";import"@qlover/fe-corekit";import"@octokit/rest";import"node:path";import"node:fs";import"node:module";import"node:url";import"p-limit";import"conventional-changelog";import"path";import"fs";const n=["patch","minor","major"],i=e=>e.split(",").filter((e=>null!=e&&""!=e));(async function(){const{shared:a,...s}=function(){const r=new e;return r.version("
|
|
2
|
+
import{Command as e}from"commander";import o from"semver";import{ReleaseTask as r,reduceOptions as t}from"./index.js";import"@qlover/scripts-context";import"@qlover/env-loader";import"@qlover/fe-corekit";import"@octokit/rest";import"node:path";import"node:fs";import"node:module";import"node:url";import"p-limit";import"conventional-changelog";import"path";import"fs";const n=["patch","minor","major"],i=e=>e.split(",").filter((e=>null!=e&&""!=e));(async function(){const{shared:a,...s}=function(){const r=new e;return r.version("2.0.0","-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(!n.includes(e)&&!o.valid(e))throw new Error(`Invalid increment(-i) Must be one of [${n.join(", ")}] or valid version string(semver)`);return e}),"patch").option("--changelog.skip","Whether to skip the changelog").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("-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).option("--githubPR.command-prefix <commandPrefix>","The command prefix of the release, call @changeset/cli command","pnpm dlx"),r.parse(),t(r.opts(),"shared")}(),{dryRun:p,verbose:c,...h}=a,l=Object.assign(s,{});await new r({dryRun:p,verbose:c,options:l,shared:h}).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,u,c,h,l,f,g,p,d,v,m,y,b,w,x,R,_,k,P,C,$,j,N,E,B,O,T,S,A,L,F,U,W,q,M,I,z,G,D,H,V,J,K,Y,Q,X,Z,ee,te,re,ne,oe,ie,se,ae,ue,ce,he,le,fe,ge,pe,de,ve,me,ye,be,we,xe,Re,_e,ke,Pe,Ce,$e,je,Ne,Ee,Be,Oe,Te,Se,Ae,Le,Fe,Ue,We,qe,Me,Ie,ze,Ge=require("@qlover/scripts-context"),De=require("@qlover/env-loader"),He=require("@qlover/fe-corekit"),Ve=require("@octokit/rest"),Je=require("node:path"),Ke=require("node:fs"),Ye=require("node:module"),Qe=require("node:url"),Xe=require("p-limit"),Ze=require("conventional-changelog"),et=require("path"),tt=require("fs"),rt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function nt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ot(){if(t)return e;return t=1,e=function(){this.__data__=[],this.size=0}}function it(){if(n)return r;return n=1,r=function(e,t){return e===t||e!=e&&t!=t}}function st(){if(i)return o;i=1;var e=it();return o=function(t,r){for(var n=t.length;n--;)if(e(t[n][0],r))return n;return-1}}function at(){if(a)return s;a=1;var e=st(),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 ut(){if(c)return u;c=1;var e=st();return u=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=st();return h=function(t){return e(this.__data__,t)>-1}}function ht(){if(g)return f;g=1;var e=st();return f=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 lt(){if(d)return p;d=1;var e=ot(),t=at(),r=ut(),n=ct(),o=ht();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 ft(){if(m)return v;m=1;var e=lt();return v=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 pt(){if(x)return w;return x=1,w=function(e){return this.__data__.get(e)}}function dt(){if(_)return R;return _=1,R=function(e){return this.__data__.has(e)}}function vt(){if(P)return k;P=1;var e="object"==typeof rt&&rt&&rt.Object===Object&&rt;return k=e}function mt(){if($)return C;$=1;var e=vt(),t="object"==typeof self&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return C=r}function yt(){if(N)return j;N=1;var e=mt().Symbol;return j=e}function bt(){if(B)return E;B=1;var e=yt(),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 wt(){if(T)return O;T=1;var e=Object.prototype.toString;return O=function(t){return e.call(t)}}function xt(){if(A)return S;A=1;var e=yt(),t=bt(),r=wt(),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 Rt(){if(F)return L;return F=1,L=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}}function _t(){if(W)return U;W=1;var e=xt(),t=Rt();return U=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 kt(){if(M)return q;M=1;var e=mt()["__core-js_shared__"];return q=e}function Pt(){if(z)return I;z=1;var e,t=kt(),r=(e=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return I=function(e){return!!r&&r in e}}function Ct(){if(D)return G;D=1;var e=Function.prototype.toString;return G=function(t){if(null!=t){try{return e.call(t)}catch(e){}try{return t+""}catch(e){}}return""}}function $t(){if(V)return H;V=1;var e=_t(),t=Pt(),r=Rt(),n=Ct(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,s=Object.prototype,a=i.toString,u=s.hasOwnProperty,c=RegExp("^"+a.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return H=function(i){return!(!r(i)||t(i))&&(e(i)?c:o).test(n(i))}}function jt(){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=$t(),t=jt();return Y=function(r,n){var o=t(r,n);return e(o)?o:void 0}}function Et(){if(Z)return X;Z=1;var e=Nt()(mt(),"Map");return X=e}function Bt(){if(te)return ee;te=1;var e=Nt()(Object,"create");return ee=e}function Ot(){if(ne)return re;ne=1;var e=Bt();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 St(){if(ae)return se;ae=1;var e=Bt(),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 At(){if(ce)return ue;ce=1;var e=Bt(),t=Object.prototype.hasOwnProperty;return ue=function(r){var n=this.__data__;return e?void 0!==n[r]:t.call(n,r)}}function Lt(){if(le)return he;le=1;var e=Bt();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 Ft(){if(ge)return fe;ge=1;var e=Ot(),t=Tt(),r=St(),n=At(),o=Lt();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,fe=i}function Ut(){if(de)return pe;de=1;var e=Ft(),t=lt(),r=Et();return pe=function(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}}function Wt(){if(me)return ve;return me=1,ve=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}}function qt(){if(be)return ye;be=1;var e=Wt();return ye=function(t,r){var n=t.__data__;return e(r)?n["string"==typeof r?"string":"hash"]:n.map}}function Mt(){if(xe)return we;xe=1;var e=qt();return we=function(t){var r=e(this,t).delete(t);return this.size-=r?1:0,r}}function It(){if(_e)return Re;_e=1;var e=qt();return Re=function(t){return e(this,t).get(t)}}function zt(){if(Pe)return ke;Pe=1;var e=qt();return ke=function(t){return e(this,t).has(t)}}function Gt(){if($e)return Ce;$e=1;var e=qt();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 Dt(){if(Ne)return je;Ne=1;var e=Ut(),t=Mt(),r=It(),n=zt(),o=Gt();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,je=i}function Ht(){if(Be)return Ee;Be=1;var e=lt(),t=Et(),r=Dt();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 Vt(){if(Te)return Oe;Te=1;var e=lt(),t=ft(),r=gt(),n=pt(),o=dt(),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,Oe=s}function Jt(){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 Kt(){if(Fe)return Le;Fe=1;var e=Jt();return Le=function(t,r,n){"__proto__"==r&&e?e(t,r,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[r]=n}}function Yt(){if(We)return Ue;We=1;var e=Kt(),t=it();return Ue=function(r,n,o){(void 0!==o&&!t(r[n],o)||void 0===o&&!(n in r))&&e(r,n,o)}}function Qt(){if(Me)return qe;return Me=1,qe=function(e){return function(t,r,n){for(var o=-1,i=Object(t),s=n(t),a=s.length;a--;){var u=s[e?a:++o];if(!1===r(i[u],u,i))break}return t}}}function Xt(){if(ze)return Ie;ze=1;var e=Qt()();return Ie=e}var Zt,er,tr,rr,nr,or,ir,sr,ar,ur,cr,hr,lr,fr,gr,pr,dr,vr,mr,yr,br,wr,xr,Rr,_r,kr,Pr,Cr,$r,jr,Nr,Er,Br,Or={exports:{}};function Tr(){return Zt||(Zt=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 Sr(){if(tr)return er;tr=1;var e=mt().Uint8Array;return er=e}function Ar(){if(nr)return rr;nr=1;var e=Sr();return rr=function(t){var r=new t.constructor(t.byteLength);return new e(r).set(new e(t)),r}}function Lr(){if(ir)return or;ir=1;var e=Ar();return or=function(t,r){var n=r?e(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}}function Fr(){if(ar)return sr;return ar=1,sr=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 ur;cr=1;var e=Rt(),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 ur=r}function Wr(){if(lr)return hr;return lr=1,hr=function(e,t){return function(r){return e(t(r))}}}function qr(){if(gr)return fr;gr=1;var e=Wr()(Object.getPrototypeOf,Object);return fr=e}function Mr(){if(dr)return pr;dr=1;var e=Object.prototype;return pr=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}}function Ir(){if(mr)return vr;mr=1;var e=Ur(),t=qr(),r=Mr();return vr=function(n){return"function"!=typeof n.constructor||r(n)?{}:e(t(n))}}function zr(){if(br)return yr;return br=1,yr=function(e){return null!=e&&"object"==typeof e}}function Gr(){if(xr)return wr;xr=1;var e=xt(),t=zr();return wr=function(r){return t(r)&&"[object Arguments]"==e(r)}}function Dr(){if(_r)return Rr;_r=1;var e=Gr(),t=zr(),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 Rr=i}function Hr(){if(Pr)return kr;Pr=1;var e=Array.isArray;return kr=e}function Vr(){if($r)return Cr;$r=1;return Cr=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}}function Jr(){if(Nr)return jr;Nr=1;var e=_t(),t=Vr();return jr=function(r){return null!=r&&t(r.length)&&!e(r)}}function Kr(){if(Br)return Er;Br=1;var e=Jr(),t=zr();return Er=function(r){return t(r)&&e(r)}}var Yr,Qr,Xr,Zr,en,tn,rn,nn,on,sn={exports:{}};function an(){if(Qr)return Yr;return Qr=1,Yr=function(){return!1}}function un(){return Xr||(Xr=1,function(e,t){var r=mt(),n=an(),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}(sn,sn.exports)),sn.exports}function cn(){if(en)return Zr;en=1;var e=xt(),t=qr(),r=zr(),n=Function.prototype,o=Object.prototype,i=n.toString,s=o.hasOwnProperty,a=i.call(Object);return Zr=function(n){if(!r(n)||"[object Object]"!=e(n))return!1;var o=t(n);if(null===o)return!0;var u=s.call(o,"constructor")&&o.constructor;return"function"==typeof u&&u instanceof u&&i.call(u)==a}}function hn(){if(rn)return tn;rn=1;var e=xt(),t=Vr(),r=zr(),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,tn=function(o){return r(o)&&t(o.length)&&!!n[e(o)]}}function ln(){if(on)return nn;return on=1,nn=function(e){return function(t){return e(t)}}}var fn,gn,pn,dn,vn,mn,yn,bn,wn,xn,Rn,_n,kn,Pn,Cn,$n,jn,Nn,En,Bn,On,Tn,Sn,An,Ln,Fn,Un,Wn,qn,Mn,In,zn,Gn,Dn,Hn,Vn,Jn,Kn,Yn,Qn,Xn,Zn,eo,to,ro,no,oo,io,so,ao={exports:{}};function uo(){return fn||(fn=1,function(e,t){var r=vt(),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}(ao,ao.exports)),ao.exports}function co(){if(pn)return gn;pn=1;var e=hn(),t=ln(),r=uo(),n=r&&r.isTypedArray,o=n?t(n):e;return gn=o}function ho(){if(vn)return dn;return vn=1,dn=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}}function lo(){if(yn)return mn;yn=1;var e=Kt(),t=it(),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 fo(){if(wn)return bn;wn=1;var e=lo(),t=Kt();return bn=function(r,n,o,i){var s=!o;o||(o={});for(var a=-1,u=n.length;++a<u;){var c=n[a],h=i?i(o[c],r[c],c,o,r):void 0;void 0===h&&(h=r[c]),s?t(o,c,h):e(o,c,h)}return o}}function go(){if(Rn)return xn;return Rn=1,xn=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}}function po(){if(kn)return _n;kn=1;var e=/^(?:0|[1-9]\d*)$/;return _n=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 vo(){if(Cn)return Pn;Cn=1;var e=go(),t=Dr(),r=Hr(),n=un(),o=po(),i=co(),s=Object.prototype.hasOwnProperty;return Pn=function(a,u){var c=r(a),h=!c&&t(a),l=!c&&!h&&n(a),f=!c&&!h&&!l&&i(a),g=c||h||l||f,p=g?e(a.length,String):[],d=p.length;for(var v in a)!u&&!s.call(a,v)||g&&("length"==v||l&&("offset"==v||"parent"==v)||f&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||o(v,d))||p.push(v);return p}}function mo(){if(jn)return $n;return jn=1,$n=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}}function yo(){if(En)return Nn;En=1;var e=Rt(),t=Mr(),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 bo(){if(On)return Bn;On=1;var e=vo(),t=yo(),r=Jr();return Bn=function(n){return r(n)?e(n,!0):t(n)}}function wo(){if(Sn)return Tn;Sn=1;var e=fo(),t=bo();return Tn=function(r){return e(r,t(r))}}function xo(){if(Ln)return An;Ln=1;var e=Yt(),t=Tr(),r=Lr(),n=Fr(),o=Ir(),i=Dr(),s=Hr(),a=Kr(),u=un(),c=_t(),h=Rt(),l=cn(),f=co(),g=ho(),p=wo();return An=function(d,v,m,y,b,w,x){var R=g(d,m),_=g(v,m),k=x.get(_);if(k)e(d,m,k);else{var P=w?w(R,_,m+"",d,v,x):void 0,C=void 0===P;if(C){var $=s(_),j=!$&&u(_),N=!$&&!j&&f(_);P=_,$||j||N?s(R)?P=R:a(R)?P=n(R):j?(C=!1,P=t(_,!0)):N?(C=!1,P=r(_,!0)):P=[]:l(_)||i(_)?(P=R,i(R)?P=p(R):h(R)&&!c(R)||(P=o(_))):C=!1}C&&(x.set(_,P),b(P,_,y,w,x),x.delete(_)),e(d,m,P)}}}function Ro(){if(Un)return Fn;Un=1;var e=Vt(),t=Yt(),r=Xt(),n=xo(),o=Rt(),i=bo(),s=ho();return Fn=function a(u,c,h,l,f){u!==c&&r(c,(function(r,i){if(f||(f=new e),o(r))n(u,c,i,h,a,l,f);else{var g=l?l(s(u,i),r,i+"",u,c,f):void 0;void 0===g&&(g=r),t(u,i,g)}}),i)},Fn}function _o(){if(qn)return Wn;return qn=1,Wn=function(e){return e}}function ko(){if(In)return Mn;return In=1,Mn=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 Po(){if(Gn)return zn;Gn=1;var e=ko(),t=Math.max;return zn=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),u=Array(a);++s<a;)u[s]=i[n+s];s=-1;for(var c=Array(n+1);++s<n;)c[s]=i[s];return c[n]=o(u),e(r,this,c)}},zn}function Co(){if(Hn)return Dn;return Hn=1,Dn=function(e){return function(){return e}}}function $o(){if(Jn)return Vn;Jn=1;var e=Co(),t=Jt();return Vn=t?function(r,n){return t(r,"toString",{configurable:!0,enumerable:!1,value:e(n),writable:!0})}:_o()}function jo(){if(Yn)return Kn;Yn=1;var e=Date.now;return Kn=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)}},Kn}function No(){if(Xn)return Qn;Xn=1;var e=$o(),t=jo()(e);return Qn=t}function Eo(){if(eo)return Zn;eo=1;var e=_o(),t=Po(),r=No();return Zn=function(n,o){return r(t(n,o,e),n+"")}}function Bo(){if(ro)return to;ro=1;var e=it(),t=Jr(),r=po(),n=Rt();return to=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(oo)return no;oo=1;var e=Eo(),t=Bo();return no=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 u=n[o];u&&r(e,u,o,s)}return e}))}}function To(){if(so)return io;so=1;var e=Ro(),t=Oo()((function(t,r,n){e(t,r,n)}));return io=t}var So,Ao,Lo,Fo,Uo,Wo,qo,Mo,Io,zo,Go,Do,Ho,Vo,Jo,Ko,Yo,Qo,Xo,Zo,ei,ti,ri,ni,oi=nt(To());function ii(){if(Ao)return So;Ao=1;var e=xt(),t=zr();return So=function(r){return"symbol"==typeof r||t(r)&&"[object Symbol]"==e(r)}}function si(){if(Fo)return Lo;Fo=1;var e=Hr(),t=ii(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;return Lo=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 ai(){if(Wo)return Uo;Wo=1;var e=Dt();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 ui(){if(Mo)return qo;Mo=1;var e=ai();return qo=function(t){var r=e(t,(function(e){return 500===n.size&&n.clear(),e})),n=r.cache;return r}}function ci(){if(zo)return Io;zo=1;var e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,r=ui()((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 Io=r}function hi(){if(Do)return Go;return Do=1,Go=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 li(){if(Vo)return Ho;Vo=1;var e=yt(),t=hi(),r=Hr(),n=ii(),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 fi(){if(Ko)return Jo;Ko=1;var e=li();return Jo=function(t){return null==t?"":e(t)}}function gi(){if(Qo)return Yo;Qo=1;var e=Hr(),t=si(),r=ci(),n=fi();return Yo=function(o,i){return e(o)?o:t(o,i)?[o]:r(n(o))}}function pi(){if(Zo)return Xo;Zo=1;var e=ii();return Xo=function(t){if("string"==typeof t||e(t))return t;var r=t+"";return"0"==r&&1/t==-1/0?"-0":r}}function di(){if(ti)return ei;ti=1;var e=gi(),t=pi();return ei=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},ei}function vi(){if(ni)return ri;ni=1;var e=di();return ri=function(t,r,n){var o=null==t?void 0:e(t,r);return void 0===o?n:o},ri}var mi=nt(vi());const yi="package.json",bi=[".env.local",".env"];class wi extends Ge.FeScriptContext{_env;shared;constructor(e){super(e),this._env=De.Env.searchEnv({logger:this.logger,preloadList:this.feConfig.envOrder||bi}),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=oi(this.options,e)}getConfig(e,t){return mi(this.options,e,t)}setShared(e){this.shared=oi(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}}}function xi(e,...t){return[e,...t]}const Ri={maxWorkspace:3,multiWorkspaceSeparator:"_",workspaceVersionSeparator:"@",batchBranchName:"batch-${releaseName}-${length}-packages"};class _i{shell;logger;config;constructor(e,t,r={}){this.shell=e,this.logger=t,this.config={...Ri,...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})}getReleaseName(e){if(1===e.length)return e[0].name;const{maxWorkspace:t,multiWorkspaceSeparator:r,workspaceVersionSeparator:n}=this.config;return e.slice(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 ki{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"),u=t,c=o?"":this.truncateBody(String(s));return{name:u,make_latest:i.toString(),body:c,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.context.dryRun)return void this.logger.exec(`octokit repos.createRelease "${t.name}" (${t.tag_name})`);const r=await this.octokit.repos.createRelease(t);this.logger.verbose(`octokit repos.createRelease: done (${r.headers.location})`)}}var Pi,Ci;function $i(){if(Ci)return Pi;Ci=1;var e=xt(),t=Hr(),r=zr();return Pi=function(n){return"string"==typeof n||!t(n)&&r(n)&&"[object String]"==e(n)}}var ji=nt($i());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];return t||e?oi({},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 Ei 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 getUserInfo(){let e;try{e=(await this.context.shell.exec("git config --get remote.origin.url",{dryRun:!1})).trim()}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&&ji(e)}}class Bi{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 extends Ni{releaseTask=null;workspacesList=[];_skip=!1;releaseLabel;constructor(e){super(e,"workspaces"),this.releaseLabel=new Bi({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,yi)),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"):[]}readJson(e){const t=Ke.readFileSync(e,"utf-8");return JSON.parse(t)}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(),t=await this.getChangedPackages(e,this.getConfig("changeLabels"));this.logger.debug("changedPaths",t);const r=t.map((e=>this.toWorkspace({path:e})));return r}toWorkspace(e){let{root:t,packageJson:r}=e;const n=e.path;if(!n)throw new Error("path is not required!");return t=t||Je.join(this.context.rootPath,n),r=r||this.readJson(Je.join(t,yi)),{name:r.name,version:r.version,path:n,root:t,packageJson:r}}}function Ti(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=Ye.createRequire(process.cwd());t=(await import(Qe.pathToFileURL(r.resolve(e,{paths:[process.cwd()]})).href)).default}}return[Si(e),t]}async function Li(e,t,r=5){const n=Xe(r),o=t.map((([t,...r])=>n((()=>(async(t,...r)=>{if("string"==typeof t){const[,n]=await Ai(t);return Ti(n,e,...r)}return Ti(t,e,...r)})(t,...r)))));return Promise.all(o)}const Fi={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 Ui=[xi(Oi),xi(class extends Ni{constructor(e,t){super(e,"changelog",{increment:"patch",changesetRoot:".changeset",tagTemplate:"${name}@${version}",tagPrefix:"${name}",tagMatch:"${name}@*",...t})}get changesetRoot(){return et.join(this.context.rootPath,this.getConfig("changesetRoot"))}enabled(){return!this.getConfig("skip")}async onBefore(){if(!tt.existsSync(this.changesetRoot))throw new Error(`Changeset directory ${this.changesetRoot} does not exist`);this.logger.debug(`${this.changesetRoot} exists`)}async onExec(){const e=this.context.workspaces,t=await this.step({label:"Generate Changelogs",task:()=>Promise.all(e.map((e=>this.generate(e))))});this.logger.debug("changelogs",t),this.context.setWorkspaces(t),this.getConfig("skipChangeset")||await this.step({label:"Create Changeset Files",task:()=>Promise.all(t.map((e=>this.generateChangesetFile(e))))})}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:Fi.name},n={version:t.version},o={debug:this.logger.debug.bind(this.logger),from:e,reverse:!0},i={},s={};return this.context.dryRun?(this.logger.info("[Dry Run] Changelog is dry run"),new Promise((e=>{e("## Dry Run Changelog")}))):new Promise(((e,t)=>{let a="";Ze(r,n,o,i,s).on("data",(e=>{a+=e.toString()})).on("end",(()=>{e(this.tranformChangelog(a,Fi.types))})).on("error",t)}))}tranformChangelog(e,t){return e}async generate(e){const t=await this.getTagName(e);this.logger.verbose("tagName is:",t);const r=await this.createChangelog({workspace:e,lastTag:t});return{...e,tagName:t,changelog:r}}async 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=await 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 await 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=et.join(this.changesetRoot,`${n}.md`),i=this.shell.format("---\n'${name}': '${increment}'\n---\n${changelog}",{...e,increment:this.getIncrement()});if(this.context.dryRun)return this.logger.info(`Changeset [${o}] will be created, content is:`),void this.logger.log(i);tt.existsSync(o)?this.logger.info(`Changeset ${n} already exists`):tt.writeFileSync(o,i,"utf-8")}},{}),xi(class extends Ei{context;releaseParams;githubManager;constructor(e,t){super(e,"githubPR",{commandPrefix:"pnpm dlx",releaseName:"Release ${name} v${version}",...t}),this.context=e,this.githubManager=new ki(this.context),this.releaseParams=new _i(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"onExec"===e?!this.isPublish:"onSuccess"!==e||this.isPublish}get isPublish(){return!this.getConfig("releasePR")}async onBefore(){if(this.logger.verbose("GithubPR onBefore"),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.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;await this.runChangesetsCli("publish"),await this.shell.exec("git push origin --tags"),await this.step({label:"Release Github",task:()=>Promise.all(e.map((e=>this.githubManager.createRelease(e))))})}async relesaeCommit(e){const t=this.getConfig("commitArgs",[]);if(await this.runChangesetsCli("version",["--no-changelog"]),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.shell.exec(["git","commit","--message",r,...t])}runChangesetsCli(e,t){return this.shell.exec([this.getConfig("commandPrefix","npx"),"@changesets/cli",e,...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.shell.exec(["git","commit","--message",`"${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,qi,Mi,Ii;function zi(){if(qi)return Wi;qi=1;var e=lo(),t=gi(),r=po(),n=Rt(),o=pi();return Wi=function(i,s,a,u){if(!n(i))return i;for(var c=-1,h=(s=t(s,i)).length,l=h-1,f=i;null!=f&&++c<h;){var g=o(s[c]),p=a;if("__proto__"===g||"constructor"===g||"prototype"===g)return i;if(c!=l){var d=f[g];void 0===(p=u?u(d,g,f):void 0)&&(p=n(d)?d:r(s[c+1])?[]:{})}e(f,g,p),f=f[g]}return i},Wi}function Gi(){if(Ii)return Mi;Ii=1;var e=zi();return Mi=function(t,r,n){return null==t?t:e(t,r,n)},Mi}var Di=nt(Gi());exports.Plugin=Ni,exports.ReleaseContext=wi,exports.ReleaseLabel=Bi,exports.ReleaseTask=class{executor;defaultTuples;context;constructor(e={},t=new He.AsyncExecutor,r=Ui){this.executor=t,this.defaultTuples=r,this.context=new wi(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 Oi&&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=Ti,exports.load=Ai,exports.loaderPluginsFromPluginTuples=Li,exports.reduceOptions=function(e,t){return Object.entries(e).reduce(((e,[r,n])=>(r.includes(".")?Di(e,r,n):Di(e,t?`${t}.${r}`:r,n),e)),{})},exports.tuple=xi;
|
|
1
|
+
"use strict";var e,t,r,n,o,i,s,a,u,c,h,l,f,g,p,d,v,m,y,b,w,x,R,_,k,P,C,$,j,N,E,B,O,T,S,A,L,U,F,W,G,q,M,I,z,D,H,V,J,K,Y,Q,X,Z,ee,te,re,ne,oe,ie,se,ae,ue,ce,he,le,fe,ge,pe,de,ve,me,ye,be,we,xe,Re,_e,ke,Pe,Ce,$e,je,Ne,Ee,Be,Oe,Te,Se,Ae,Le,Ue,Fe,We,Ge,qe,Me,Ie,ze=require("@qlover/scripts-context"),De=require("@qlover/env-loader"),He=require("@qlover/fe-corekit"),Ve=require("@octokit/rest"),Je=require("node:path"),Ke=require("node:fs"),Ye=require("node:module"),Qe=require("node:url"),Xe=require("p-limit"),Ze=require("conventional-changelog"),et=require("path"),tt=require("fs"),rt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function nt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ot(){if(t)return e;return t=1,e=function(){this.__data__=[],this.size=0}}function it(){if(n)return r;return n=1,r=function(e,t){return e===t||e!=e&&t!=t}}function st(){if(i)return o;i=1;var e=it();return o=function(t,r){for(var n=t.length;n--;)if(e(t[n][0],r))return n;return-1}}function at(){if(a)return s;a=1;var e=st(),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 ut(){if(c)return u;c=1;var e=st();return u=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=st();return h=function(t){return e(this.__data__,t)>-1}}function ht(){if(g)return f;g=1;var e=st();return f=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 lt(){if(d)return p;d=1;var e=ot(),t=at(),r=ut(),n=ct(),o=ht();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 ft(){if(m)return v;m=1;var e=lt();return v=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 pt(){if(x)return w;return x=1,w=function(e){return this.__data__.get(e)}}function dt(){if(_)return R;return _=1,R=function(e){return this.__data__.has(e)}}function vt(){if(P)return k;P=1;var e="object"==typeof rt&&rt&&rt.Object===Object&&rt;return k=e}function mt(){if($)return C;$=1;var e=vt(),t="object"==typeof self&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return C=r}function yt(){if(N)return j;N=1;var e=mt().Symbol;return j=e}function bt(){if(B)return E;B=1;var e=yt(),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 wt(){if(T)return O;T=1;var e=Object.prototype.toString;return O=function(t){return e.call(t)}}function xt(){if(A)return S;A=1;var e=yt(),t=bt(),r=wt(),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 Rt(){if(U)return L;return U=1,L=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}}function _t(){if(W)return F;W=1;var e=xt(),t=Rt();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 kt(){if(q)return G;q=1;var e=mt()["__core-js_shared__"];return G=e}function Pt(){if(I)return M;I=1;var e,t=kt(),r=(e=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return M=function(e){return!!r&&r in e}}function Ct(){if(D)return z;D=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 $t(){if(V)return H;V=1;var e=_t(),t=Pt(),r=Rt(),n=Ct(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,s=Object.prototype,a=i.toString,u=s.hasOwnProperty,c=RegExp("^"+a.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return H=function(i){return!(!r(i)||t(i))&&(e(i)?c:o).test(n(i))}}function jt(){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=$t(),t=jt();return Y=function(r,n){var o=t(r,n);return e(o)?o:void 0}}function Et(){if(Z)return X;Z=1;var e=Nt()(mt(),"Map");return X=e}function Bt(){if(te)return ee;te=1;var e=Nt()(Object,"create");return ee=e}function Ot(){if(ne)return re;ne=1;var e=Bt();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 St(){if(ae)return se;ae=1;var e=Bt(),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 At(){if(ce)return ue;ce=1;var e=Bt(),t=Object.prototype.hasOwnProperty;return ue=function(r){var n=this.__data__;return e?void 0!==n[r]:t.call(n,r)}}function Lt(){if(le)return he;le=1;var e=Bt();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 Ut(){if(ge)return fe;ge=1;var e=Ot(),t=Tt(),r=St(),n=At(),o=Lt();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,fe=i}function Ft(){if(de)return pe;de=1;var e=Ut(),t=lt(),r=Et();return pe=function(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}}function Wt(){if(me)return ve;return me=1,ve=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}}function Gt(){if(be)return ye;be=1;var e=Wt();return ye=function(t,r){var n=t.__data__;return e(r)?n["string"==typeof r?"string":"hash"]:n.map}}function qt(){if(xe)return we;xe=1;var e=Gt();return we=function(t){var r=e(this,t).delete(t);return this.size-=r?1:0,r}}function Mt(){if(_e)return Re;_e=1;var e=Gt();return Re=function(t){return e(this,t).get(t)}}function It(){if(Pe)return ke;Pe=1;var e=Gt();return ke=function(t){return e(this,t).has(t)}}function zt(){if($e)return Ce;$e=1;var e=Gt();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 Dt(){if(Ne)return je;Ne=1;var e=Ft(),t=qt(),r=Mt(),n=It(),o=zt();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,je=i}function Ht(){if(Be)return Ee;Be=1;var e=lt(),t=Et(),r=Dt();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 Vt(){if(Te)return Oe;Te=1;var e=lt(),t=ft(),r=gt(),n=pt(),o=dt(),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,Oe=s}function Jt(){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 Kt(){if(Ue)return Le;Ue=1;var e=Jt();return Le=function(t,r,n){"__proto__"==r&&e?e(t,r,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[r]=n}}function Yt(){if(We)return Fe;We=1;var e=Kt(),t=it();return Fe=function(r,n,o){(void 0!==o&&!t(r[n],o)||void 0===o&&!(n in r))&&e(r,n,o)}}function Qt(){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 u=s[e?a:++o];if(!1===r(i[u],u,i))break}return t}}}function Xt(){if(Ie)return Me;Ie=1;var e=Qt()();return Me=e}var Zt,er,tr,rr,nr,or,ir,sr,ar,ur,cr,hr,lr,fr,gr,pr,dr,vr,mr,yr,br,wr,xr,Rr,_r,kr,Pr,Cr,$r,jr,Nr,Er,Br,Or={exports:{}};function Tr(){return Zt||(Zt=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 Sr(){if(tr)return er;tr=1;var e=mt().Uint8Array;return er=e}function Ar(){if(nr)return rr;nr=1;var e=Sr();return rr=function(t){var r=new t.constructor(t.byteLength);return new e(r).set(new e(t)),r}}function Lr(){if(ir)return or;ir=1;var e=Ar();return or=function(t,r){var n=r?e(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}}function Ur(){if(ar)return sr;return ar=1,sr=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}}function Fr(){if(cr)return ur;cr=1;var e=Rt(),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 ur=r}function Wr(){if(lr)return hr;return lr=1,hr=function(e,t){return function(r){return e(t(r))}}}function Gr(){if(gr)return fr;gr=1;var e=Wr()(Object.getPrototypeOf,Object);return fr=e}function qr(){if(dr)return pr;dr=1;var e=Object.prototype;return pr=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}}function Mr(){if(mr)return vr;mr=1;var e=Fr(),t=Gr(),r=qr();return vr=function(n){return"function"!=typeof n.constructor||r(n)?{}:e(t(n))}}function Ir(){if(br)return yr;return br=1,yr=function(e){return null!=e&&"object"==typeof e}}function zr(){if(xr)return wr;xr=1;var e=xt(),t=Ir();return wr=function(r){return t(r)&&"[object Arguments]"==e(r)}}function Dr(){if(_r)return Rr;_r=1;var e=zr(),t=Ir(),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 Rr=i}function Hr(){if(Pr)return kr;Pr=1;var e=Array.isArray;return kr=e}function Vr(){if($r)return Cr;$r=1;return Cr=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}}function Jr(){if(Nr)return jr;Nr=1;var e=_t(),t=Vr();return jr=function(r){return null!=r&&t(r.length)&&!e(r)}}function Kr(){if(Br)return Er;Br=1;var e=Jr(),t=Ir();return Er=function(r){return t(r)&&e(r)}}var Yr,Qr,Xr,Zr,en,tn,rn,nn,on,sn={exports:{}};function an(){if(Qr)return Yr;return Qr=1,Yr=function(){return!1}}function un(){return Xr||(Xr=1,function(e,t){var r=mt(),n=an(),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}(sn,sn.exports)),sn.exports}function cn(){if(en)return Zr;en=1;var e=xt(),t=Gr(),r=Ir(),n=Function.prototype,o=Object.prototype,i=n.toString,s=o.hasOwnProperty,a=i.call(Object);return Zr=function(n){if(!r(n)||"[object Object]"!=e(n))return!1;var o=t(n);if(null===o)return!0;var u=s.call(o,"constructor")&&o.constructor;return"function"==typeof u&&u instanceof u&&i.call(u)==a}}function hn(){if(rn)return tn;rn=1;var e=xt(),t=Vr(),r=Ir(),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,tn=function(o){return r(o)&&t(o.length)&&!!n[e(o)]}}function ln(){if(on)return nn;return on=1,nn=function(e){return function(t){return e(t)}}}var fn,gn,pn,dn,vn,mn,yn,bn,wn,xn,Rn,_n,kn,Pn,Cn,$n,jn,Nn,En,Bn,On,Tn,Sn,An,Ln,Un,Fn,Wn,Gn,qn,Mn,In,zn,Dn,Hn,Vn,Jn,Kn,Yn,Qn,Xn,Zn,eo,to,ro,no,oo,io,so,ao={exports:{}};function uo(){return fn||(fn=1,function(e,t){var r=vt(),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}(ao,ao.exports)),ao.exports}function co(){if(pn)return gn;pn=1;var e=hn(),t=ln(),r=uo(),n=r&&r.isTypedArray,o=n?t(n):e;return gn=o}function ho(){if(vn)return dn;return vn=1,dn=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}}function lo(){if(yn)return mn;yn=1;var e=Kt(),t=it(),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 fo(){if(wn)return bn;wn=1;var e=lo(),t=Kt();return bn=function(r,n,o,i){var s=!o;o||(o={});for(var a=-1,u=n.length;++a<u;){var c=n[a],h=i?i(o[c],r[c],c,o,r):void 0;void 0===h&&(h=r[c]),s?t(o,c,h):e(o,c,h)}return o}}function go(){if(Rn)return xn;return Rn=1,xn=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}}function po(){if(kn)return _n;kn=1;var e=/^(?:0|[1-9]\d*)$/;return _n=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 vo(){if(Cn)return Pn;Cn=1;var e=go(),t=Dr(),r=Hr(),n=un(),o=po(),i=co(),s=Object.prototype.hasOwnProperty;return Pn=function(a,u){var c=r(a),h=!c&&t(a),l=!c&&!h&&n(a),f=!c&&!h&&!l&&i(a),g=c||h||l||f,p=g?e(a.length,String):[],d=p.length;for(var v in a)!u&&!s.call(a,v)||g&&("length"==v||l&&("offset"==v||"parent"==v)||f&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||o(v,d))||p.push(v);return p}}function mo(){if(jn)return $n;return jn=1,$n=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}}function yo(){if(En)return Nn;En=1;var e=Rt(),t=qr(),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 bo(){if(On)return Bn;On=1;var e=vo(),t=yo(),r=Jr();return Bn=function(n){return r(n)?e(n,!0):t(n)}}function wo(){if(Sn)return Tn;Sn=1;var e=fo(),t=bo();return Tn=function(r){return e(r,t(r))}}function xo(){if(Ln)return An;Ln=1;var e=Yt(),t=Tr(),r=Lr(),n=Ur(),o=Mr(),i=Dr(),s=Hr(),a=Kr(),u=un(),c=_t(),h=Rt(),l=cn(),f=co(),g=ho(),p=wo();return An=function(d,v,m,y,b,w,x){var R=g(d,m),_=g(v,m),k=x.get(_);if(k)e(d,m,k);else{var P=w?w(R,_,m+"",d,v,x):void 0,C=void 0===P;if(C){var $=s(_),j=!$&&u(_),N=!$&&!j&&f(_);P=_,$||j||N?s(R)?P=R:a(R)?P=n(R):j?(C=!1,P=t(_,!0)):N?(C=!1,P=r(_,!0)):P=[]:l(_)||i(_)?(P=R,i(R)?P=p(R):h(R)&&!c(R)||(P=o(_))):C=!1}C&&(x.set(_,P),b(P,_,y,w,x),x.delete(_)),e(d,m,P)}}}function Ro(){if(Fn)return Un;Fn=1;var e=Vt(),t=Yt(),r=Xt(),n=xo(),o=Rt(),i=bo(),s=ho();return Un=function a(u,c,h,l,f){u!==c&&r(c,(function(r,i){if(f||(f=new e),o(r))n(u,c,i,h,a,l,f);else{var g=l?l(s(u,i),r,i+"",u,c,f):void 0;void 0===g&&(g=r),t(u,i,g)}}),i)},Un}function _o(){if(Gn)return Wn;return Gn=1,Wn=function(e){return e}}function ko(){if(Mn)return qn;return Mn=1,qn=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 Po(){if(zn)return In;zn=1;var e=ko(),t=Math.max;return In=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),u=Array(a);++s<a;)u[s]=i[n+s];s=-1;for(var c=Array(n+1);++s<n;)c[s]=i[s];return c[n]=o(u),e(r,this,c)}},In}function Co(){if(Hn)return Dn;return Hn=1,Dn=function(e){return function(){return e}}}function $o(){if(Jn)return Vn;Jn=1;var e=Co(),t=Jt();return Vn=t?function(r,n){return t(r,"toString",{configurable:!0,enumerable:!1,value:e(n),writable:!0})}:_o()}function jo(){if(Yn)return Kn;Yn=1;var e=Date.now;return Kn=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)}},Kn}function No(){if(Xn)return Qn;Xn=1;var e=$o(),t=jo()(e);return Qn=t}function Eo(){if(eo)return Zn;eo=1;var e=_o(),t=Po(),r=No();return Zn=function(n,o){return r(t(n,o,e),n+"")}}function Bo(){if(ro)return to;ro=1;var e=it(),t=Jr(),r=po(),n=Rt();return to=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(oo)return no;oo=1;var e=Eo(),t=Bo();return no=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 u=n[o];u&&r(e,u,o,s)}return e}))}}function To(){if(so)return io;so=1;var e=Ro(),t=Oo()((function(t,r,n){e(t,r,n)}));return io=t}var So,Ao,Lo,Uo,Fo,Wo,Go,qo,Mo,Io,zo,Do,Ho,Vo,Jo,Ko,Yo,Qo,Xo,Zo,ei,ti,ri,ni,oi=nt(To());function ii(){if(Ao)return So;Ao=1;var e=xt(),t=Ir();return So=function(r){return"symbol"==typeof r||t(r)&&"[object Symbol]"==e(r)}}function si(){if(Uo)return Lo;Uo=1;var e=Hr(),t=ii(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;return Lo=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 ai(){if(Wo)return Fo;Wo=1;var e=Dt();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,Fo=t}function ui(){if(qo)return Go;qo=1;var e=ai();return Go=function(t){var r=e(t,(function(e){return 500===n.size&&n.clear(),e})),n=r.cache;return r}}function ci(){if(Io)return Mo;Io=1;var e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,r=ui()((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 Mo=r}function hi(){if(Do)return zo;return Do=1,zo=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 li(){if(Vo)return Ho;Vo=1;var e=yt(),t=hi(),r=Hr(),n=ii(),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 fi(){if(Ko)return Jo;Ko=1;var e=li();return Jo=function(t){return null==t?"":e(t)}}function gi(){if(Qo)return Yo;Qo=1;var e=Hr(),t=si(),r=ci(),n=fi();return Yo=function(o,i){return e(o)?o:t(o,i)?[o]:r(n(o))}}function pi(){if(Zo)return Xo;Zo=1;var e=ii();return Xo=function(t){if("string"==typeof t||e(t))return t;var r=t+"";return"0"==r&&1/t==-1/0?"-0":r}}function di(){if(ti)return ei;ti=1;var e=gi(),t=pi();return ei=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},ei}function vi(){if(ni)return ri;ni=1;var e=di();return ri=function(t,r,n){var o=null==t?void 0:e(t,r);return void 0===o?n:o},ri}var mi=nt(vi());const yi="package.json",bi=[".env.local",".env"];class wi extends ze.FeScriptContext{_env;shared;constructor(e){super(e),this._env=De.Env.searchEnv({logger:this.logger,preloadList:this.feConfig.envOrder||bi}),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=oi(this.options,e)}getConfig(e,t){return mi(this.options,e,t)}setShared(e){this.shared=oi(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}}}function xi(e,...t){return[e,...t]}const Ri={maxWorkspace:3,multiWorkspaceSeparator:"_",workspaceVersionSeparator:"@",batchBranchName:"batch-${releaseName}-${length}-packages"};class _i{shell;logger;config;constructor(e,t,r={}){this.shell=e,this.logger=t,this.config={...Ri,...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})}getReleaseName(e){if(1===e.length)return e[0].name;const{maxWorkspace:t,multiWorkspaceSeparator:r,workspaceVersionSeparator:n}=this.config;return e.slice(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 ki{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"),u=t,c=o?"":this.truncateBody(String(s));return{name:u,make_latest:i.toString(),body:c,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 Pi,Ci;function $i(){if(Ci)return Pi;Ci=1;var e=xt(),t=Hr(),r=Ir();return Pi=function(n){return"string"==typeof n||!t(n)&&r(n)&&"[object String]"==e(n)}}var ji=nt($i());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];return t||e?oi({},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 Ei 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&&ji(e)}}class Bi{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 extends Ni{releaseTask=null;workspacesList=[];_skip=!1;releaseLabel;constructor(e){super(e,"workspaces"),this.releaseLabel=new Bi({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,yi)),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"):[]}readJson(e){const t=Ke.readFileSync(e,"utf-8");return JSON.parse(t)}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(),t=await this.getChangedPackages(e,this.getConfig("changeLabels"));this.logger.debug("changedPaths",t);const r=t.map((e=>this.toWorkspace({path:e})));return r}toWorkspace(e){let{root:t,packageJson:r}=e;const n=e.path;if(!n)throw new Error("path is not required!");return t=t||Je.join(this.context.rootPath,n),r=r||this.readJson(Je.join(t,yi)),{name:r.name,version:r.version,path:n,root:t,packageJson:r}}}function Ti(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=Ye.createRequire(process.cwd());t=(await import(Qe.pathToFileURL(r.resolve(e,{paths:[process.cwd()]})).href)).default}}return[Si(e),t]}async function Li(e,t,r=5){const n=Xe(r),o=t.map((([t,...r])=>n((()=>(async(t,...r)=>{if("string"==typeof t){const[,n]=await Ai(t);return Ti(n,e,...r)}return Ti(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=[xi(Oi),xi(class extends Ni{constructor(e,t){super(e,"changelog",{increment:"patch",changesetRoot:".changeset",tagTemplate:"${name}@${version}",tagPrefix:"${name}",tagMatch:"${name}@*",...t})}get changesetRoot(){return et.join(this.context.rootPath,this.getConfig("changesetRoot"))}enabled(){return!this.getConfig("skip")}async onBefore(){if(!tt.existsSync(this.changesetRoot))throw new Error(`Changeset directory ${this.changesetRoot} does not exist`);this.logger.debug(`${this.changesetRoot} exists`)}async onExec(){const e=this.context.workspaces,t=await this.step({label:"Generate Changelogs",task:()=>Promise.all(e.map((e=>this.generate(e))))});this.logger.debug("changelogs",t),this.context.setWorkspaces(t),this.getConfig("skipChangeset")||await this.step({label:"Create Changeset Files",task:()=>Promise.all(t.map((e=>this.generateChangesetFile(e))))})}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},o={debug:this.logger.debug.bind(this.logger),from:e,reverse:!0},i={},s={};return this.context.dryRun?(this.logger.info("[Dry Run] Changelog is dry run"),new Promise((e=>{e("## Dry Run Changelog")}))):new Promise(((e,t)=>{let a="";Ze(r,n,o,i,s).on("data",(e=>{a+=e.toString()})).on("end",(()=>{e(this.tranformChangelog(a,Ui.types))})).on("error",t)}))}tranformChangelog(e,t){return e}async generate(e){const t=await this.getTagName(e);this.logger.verbose("tagName is:",t);const r=await this.createChangelog({workspace:e,lastTag:t});return{...e,tagName:t,changelog:r}}async 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=await 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 await 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=et.join(this.changesetRoot,`${n}.md`),i=this.shell.format("---\n'${name}': '${increment}'\n---\n${changelog}",{...e,increment:this.getIncrement()});if(this.context.dryRun)return this.logger.info(`Changeset [${o}] will be created, content is:`),void this.logger.log(i);tt.existsSync(o)?this.logger.info(`Changeset ${n} already exists`):tt.writeFileSync(o,i,"utf-8")}},{}),xi(class extends Ei{context;releaseParams;githubManager;constructor(e,t){super(e,"githubPR",{commandPrefix:"pnpm dlx",releaseName:"Release ${name} v${version}",...t}),this.context=e,this.githubManager=new ki(this.context),this.releaseParams=new _i(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"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.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;await this.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(await this.runChangesetsCli("version",["--no-changelog"]),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.shell.exec(["git","commit","--message",r,...t])}runChangesetsCli(e,t){return this.shell.exec([this.getConfig("commandPrefix","npx"),"@changesets/cli",e,...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.shell.exec(["git","commit","--message",`"${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=lo(),t=gi(),r=po(),n=Rt(),o=pi();return Wi=function(i,s,a,u){if(!n(i))return i;for(var c=-1,h=(s=t(s,i)).length,l=h-1,f=i;null!=f&&++c<h;){var g=o(s[c]),p=a;if("__proto__"===g||"constructor"===g||"prototype"===g)return i;if(c!=l){var d=f[g];void 0===(p=u?u(d,g,f):void 0)&&(p=n(d)?d:r(s[c+1])?[]:{})}e(f,g,p),f=f[g]}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 Di=nt(zi());exports.Plugin=Ni,exports.ReleaseContext=wi,exports.ReleaseLabel=Bi,exports.ReleaseTask=class{executor;defaultTuples;context;constructor(e={},t=new He.AsyncExecutor,r=Fi){this.executor=t,this.defaultTuples=r,this.context=new wi(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 Oi&&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=Ti,exports.load=Ai,exports.loaderPluginsFromPluginTuples=Li,exports.reduceOptions=function(e,t){return Object.entries(e).reduce(((e,[r,n])=>(r.includes(".")?Di(e,r,n):Di(e,t?`${t}.${r}`:r,n),e)),{})},exports.tuple=xi;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FeScriptContext as e}from"@qlover/scripts-context";import{Env as t}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}from"node:fs";import{createRequire as c}from"node:module";import{pathToFileURL as u}from"node:url";import h from"p-limit";import l from"conventional-changelog";import{join as f}from"path";import{existsSync as g,writeFileSync as p}from"fs";var d,m,v,y,b,w,_,x,R,k,P,C,$,N,j,B,E,O,T,S,A,L,U,F,W,M,I,z,G,D,H,q,V,J,K,Y,Q,X,Z,ee,te,re,ne,oe,ie,ae,se,ce,ue,he,le,fe,ge,pe,de,me,ve,ye,be,we,_e,xe,Re,ke,Pe,Ce,$e,Ne,je,Be,Ee,Oe,Te,Se,Ae,Le,Ue,Fe,We,Me,Ie,ze,Ge,De,He,qe,Ve,Je,Ke,Ye,Qe,Xe,Ze,et,tt,rt,nt,ot,it="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function at(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function st(){if(m)return d;return m=1,d=function(){this.__data__=[],this.size=0}}function ct(){if(y)return v;return y=1,v=function(e,t){return e===t||e!=e&&t!=t}}function ut(){if(w)return b;w=1;var e=ct();return b=function(t,r){for(var n=t.length;n--;)if(e(t[n][0],r))return n;return-1}}function ht(){if(x)return _;x=1;var e=ut(),t=Array.prototype.splice;return _=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 lt(){if(k)return R;k=1;var e=ut();return R=function(t){var r=this.__data__,n=e(r,t);return n<0?void 0:r[n][1]}}function ft(){if(C)return P;C=1;var e=ut();return P=function(t){return e(this.__data__,t)>-1}}function gt(){if(N)return $;N=1;var e=ut();return $=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 pt(){if(B)return j;B=1;var e=st(),t=ht(),r=lt(),n=ft(),o=gt();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,j=i}function dt(){if(O)return E;O=1;var e=pt();return E=function(){this.__data__=new e,this.size=0}}function mt(){if(S)return T;return S=1,T=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}}function vt(){if(L)return A;return L=1,A=function(e){return this.__data__.get(e)}}function yt(){if(F)return U;return F=1,U=function(e){return this.__data__.has(e)}}function bt(){if(M)return W;M=1;var e="object"==typeof it&&it&&it.Object===Object&⁢return W=e}function wt(){if(z)return I;z=1;var e=bt(),t="object"==typeof self&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return I=r}function _t(){if(D)return G;D=1;var e=wt().Symbol;return G=e}function xt(){if(q)return H;q=1;var e=_t(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,o=e?e.toStringTag:void 0;return H=function(e){var t=r.call(e,o),i=e[o];try{e[o]=void 0;var a=!0}catch(e){}var s=n.call(e);return a&&(t?e[o]=i:delete e[o]),s}}function Rt(){if(J)return V;J=1;var e=Object.prototype.toString;return V=function(t){return e.call(t)}}function kt(){if(Y)return K;Y=1;var e=_t(),t=xt(),r=Rt(),n=e?e.toStringTag:void 0;return K=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":n&&n in Object(e)?t(e):r(e)}}function Pt(){if(X)return Q;return X=1,Q=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}}function Ct(){if(ee)return Z;ee=1;var e=kt(),t=Pt();return Z=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(re)return te;re=1;var e=wt()["__core-js_shared__"];return te=e}function Nt(){if(oe)return ne;oe=1;var e,t=$t(),r=(e=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return ne=function(e){return!!r&&r in e}}function jt(){if(ae)return ie;ae=1;var e=Function.prototype.toString;return ie=function(t){if(null!=t){try{return e.call(t)}catch(e){}try{return t+""}catch(e){}}return""}}function Bt(){if(ce)return se;ce=1;var e=Ct(),t=Nt(),r=Pt(),n=jt(),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 se=function(i){return!(!r(i)||t(i))&&(e(i)?u:o).test(n(i))}}function Et(){if(he)return ue;return he=1,ue=function(e,t){return null==e?void 0:e[t]}}function Ot(){if(fe)return le;fe=1;var e=Bt(),t=Et();return le=function(r,n){var o=t(r,n);return e(o)?o:void 0}}function Tt(){if(pe)return ge;pe=1;var e=Ot()(wt(),"Map");return ge=e}function St(){if(me)return de;me=1;var e=Ot()(Object,"create");return de=e}function At(){if(ye)return ve;ye=1;var e=St();return ve=function(){this.__data__=e?e(null):{},this.size=0}}function Lt(){if(we)return be;return we=1,be=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}}function Ut(){if(xe)return _e;xe=1;var e=St(),t=Object.prototype.hasOwnProperty;return _e=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 Ft(){if(ke)return Re;ke=1;var e=St(),t=Object.prototype.hasOwnProperty;return Re=function(r){var n=this.__data__;return e?void 0!==n[r]:t.call(n,r)}}function Wt(){if(Ce)return Pe;Ce=1;var e=St();return Pe=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 Mt(){if(Ne)return $e;Ne=1;var e=At(),t=Lt(),r=Ut(),n=Ft(),o=Wt();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,$e=i}function It(){if(Be)return je;Be=1;var e=Mt(),t=pt(),r=Tt();return je=function(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}}function zt(){if(Oe)return Ee;return Oe=1,Ee=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}}function Gt(){if(Se)return Te;Se=1;var e=zt();return Te=function(t,r){var n=t.__data__;return e(r)?n["string"==typeof r?"string":"hash"]:n.map}}function Dt(){if(Le)return Ae;Le=1;var e=Gt();return Ae=function(t){var r=e(this,t).delete(t);return this.size-=r?1:0,r}}function Ht(){if(Fe)return Ue;Fe=1;var e=Gt();return Ue=function(t){return e(this,t).get(t)}}function qt(){if(Me)return We;Me=1;var e=Gt();return We=function(t){return e(this,t).has(t)}}function Vt(){if(ze)return Ie;ze=1;var e=Gt();return Ie=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 Jt(){if(De)return Ge;De=1;var e=It(),t=Dt(),r=Ht(),n=qt(),o=Vt();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 Kt(){if(qe)return He;qe=1;var e=pt(),t=Tt(),r=Jt();return He=function(n,o){var i=this.__data__;if(i instanceof e){var a=i.__data__;if(!t||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 Yt(){if(Je)return Ve;Je=1;var e=pt(),t=dt(),r=mt(),n=vt(),o=yt(),i=Kt();function a(t){var r=this.__data__=new e(t);this.size=r.size}return a.prototype.clear=t,a.prototype.delete=r,a.prototype.get=n,a.prototype.has=o,a.prototype.set=i,Ve=a}function Qt(){if(Ye)return Ke;Ye=1;var e=Ot(),t=function(){try{var t=e(Object,"defineProperty");return t({},"",{}),t}catch(e){}}();return Ke=t}function Xt(){if(Xe)return Qe;Xe=1;var e=Qt();return Qe=function(t,r,n){"__proto__"==r&&e?e(t,r,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[r]=n}}function Zt(){if(et)return Ze;et=1;var e=Xt(),t=ct();return Ze=function(r,n,o){(void 0!==o&&!t(r[n],o)||void 0===o&&!(n in r))&&e(r,n,o)}}function er(){if(rt)return tt;return rt=1,tt=function(e){return function(t,r,n){for(var o=-1,i=Object(t),a=n(t),s=a.length;s--;){var c=a[e?s:++o];if(!1===r(i[c],c,i))break}return t}}}function tr(){if(ot)return nt;ot=1;var e=er()();return nt=e}var rr,nr,or,ir,ar,sr,cr,ur,hr,lr,fr,gr,pr,dr,mr,vr,yr,br,wr,_r,xr,Rr,kr,Pr,Cr,$r,Nr,jr,Br,Er,Or,Tr,Sr,Ar={exports:{}};function Lr(){return rr||(rr=1,e=Ar,t=Ar.exports,r=wt(),n=t&&!t.nodeType&&t,o=n&&e&&!e.nodeType&&e,i=o&&o.exports===n?r.Buffer:void 0,a=i?i.allocUnsafe:void 0,e.exports=function(e,t){if(t)return e.slice();var r=e.length,n=a?a(r):new e.constructor(r);return e.copy(n),n}),Ar.exports;var e,t,r,n,o,i,a}function Ur(){if(or)return nr;or=1;var e=wt().Uint8Array;return nr=e}function Fr(){if(ar)return ir;ar=1;var e=Ur();return ir=function(t){var r=new t.constructor(t.byteLength);return new e(r).set(new e(t)),r}}function Wr(){if(cr)return sr;cr=1;var e=Fr();return sr=function(t,r){var n=r?e(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}}function Mr(){if(hr)return ur;return hr=1,ur=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}}function Ir(){if(fr)return lr;fr=1;var e=Pt(),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 lr=r}function zr(){if(pr)return gr;return pr=1,gr=function(e,t){return function(r){return e(t(r))}}}function Gr(){if(mr)return dr;mr=1;var e=zr()(Object.getPrototypeOf,Object);return dr=e}function Dr(){if(yr)return vr;yr=1;var e=Object.prototype;return vr=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}}function Hr(){if(wr)return br;wr=1;var e=Ir(),t=Gr(),r=Dr();return br=function(n){return"function"!=typeof n.constructor||r(n)?{}:e(t(n))}}function qr(){if(xr)return _r;return xr=1,_r=function(e){return null!=e&&"object"==typeof e}}function Vr(){if(kr)return Rr;kr=1;var e=kt(),t=qr();return Rr=function(r){return t(r)&&"[object Arguments]"==e(r)}}function Jr(){if(Cr)return Pr;Cr=1;var e=Vr(),t=qr(),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 Pr=i}function Kr(){if(Nr)return $r;Nr=1;var e=Array.isArray;return $r=e}function Yr(){if(Br)return jr;Br=1;return jr=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}}function Qr(){if(Or)return Er;Or=1;var e=Ct(),t=Yr();return Er=function(r){return null!=r&&t(r.length)&&!e(r)}}function Xr(){if(Sr)return Tr;Sr=1;var e=Qr(),t=qr();return Tr=function(r){return t(r)&&e(r)}}var Zr,en,tn,rn,nn,on,an,sn,cn,un={exports:{}};function hn(){if(en)return Zr;return en=1,Zr=function(){return!1}}function ln(){return tn||(tn=1,function(e,t){var r=wt(),n=hn(),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o?r.Buffer:void 0,s=(a?a.isBuffer:void 0)||n;e.exports=s}(un,un.exports)),un.exports}function fn(){if(nn)return rn;nn=1;var e=kt(),t=Gr(),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]"!=e(n))return!1;var o=t(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 e=kt(),t=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)&&t(o.length)&&!!n[e(o)]}}function pn(){if(cn)return sn;return cn=1,sn=function(e){return function(t){return e(t)}}}var dn,mn,vn,yn,bn,wn,_n,xn,Rn,kn,Pn,Cn,$n,Nn,jn,Bn,En,On,Tn,Sn,An,Ln,Un,Fn,Wn,Mn,In,zn,Gn,Dn,Hn,qn,Vn,Jn,Kn,Yn,Qn,Xn,Zn,eo,to,ro,no,oo,io,ao,so,co,uo,ho={exports:{}};function lo(){return dn||(dn=1,e=ho,t=ho.exports,r=bt(),n=t&&!t.nodeType&&t,o=n&&e&&!e.nodeType&&e,i=o&&o.exports===n&&r.process,a=function(){try{var e=o&&o.require&&o.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}(),e.exports=a),ho.exports;var e,t,r,n,o,i,a}function fo(){if(vn)return mn;vn=1;var e=gn(),t=pn(),r=lo(),n=r&&r.isTypedArray,o=n?t(n):e;return mn=o}function go(){if(bn)return yn;return bn=1,yn=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}}function po(){if(_n)return wn;_n=1;var e=Xt(),t=ct(),r=Object.prototype.hasOwnProperty;return wn=function(n,o,i){var a=n[o];r.call(n,o)&&t(a,i)&&(void 0!==i||o in n)||e(n,o,i)}}function mo(){if(Rn)return xn;Rn=1;var e=po(),t=Xt();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?t(o,u,h):e(o,u,h)}return o}}function vo(){if(Pn)return kn;return Pn=1,kn=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}}function yo(){if($n)return Cn;$n=1;var e=/^(?:0|[1-9]\d*)$/;return Cn=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 bo(){if(jn)return Nn;jn=1;var e=vo(),t=Jr(),r=Kr(),n=ln(),o=yo(),i=fo(),a=Object.prototype.hasOwnProperty;return Nn=function(s,c){var u=r(s),h=!u&&t(s),l=!u&&!h&&n(s),f=!u&&!h&&!l&&i(s),g=u||h||l||f,p=g?e(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(En)return Bn;return En=1,Bn=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}}function _o(){if(Tn)return On;Tn=1;var e=Pt(),t=Dr(),r=wo(),n=Object.prototype.hasOwnProperty;return On=function(o){if(!e(o))return r(o);var i=t(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 e=bo(),t=_o(),r=Qr();return Sn=function(n){return r(n)?e(n,!0):t(n)}}function Ro(){if(Un)return Ln;Un=1;var e=mo(),t=xo();return Ln=function(r){return e(r,t(r))}}function ko(){if(Wn)return Fn;Wn=1;var e=Zt(),t=Lr(),r=Wr(),n=Mr(),o=Hr(),i=Jr(),a=Kr(),s=Xr(),c=ln(),u=Ct(),h=Pt(),l=fn(),f=fo(),g=go(),p=Ro();return Fn=function(d,m,v,y,b,w,_){var x=g(d,v),R=g(m,v),k=_.get(R);if(k)e(d,v,k);else{var P=w?w(x,R,v+"",d,m,_):void 0,C=void 0===P;if(C){var $=a(R),N=!$&&c(R),j=!$&&!N&&f(R);P=R,$||N||j?a(x)?P=x:s(x)?P=n(x):N?(C=!1,P=t(R,!0)):j?(C=!1,P=r(R,!0)):P=[]:l(R)||i(R)?(P=x,i(x)?P=p(x):h(x)&&!u(x)||(P=o(R))):C=!1}C&&(_.set(R,P),b(P,R,y,w,_),_.delete(R)),e(d,v,P)}}}function Po(){if(In)return Mn;In=1;var e=Yt(),t=Zt(),r=tr(),n=ko(),o=Pt(),i=xo(),a=go();return Mn=function s(c,u,h,l,f){c!==u&&r(u,(function(r,i){if(f||(f=new e),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),t(c,i,g)}}),i)},Mn}function Co(){if(Gn)return zn;return Gn=1,zn=function(e){return e}}function $o(){if(Hn)return Dn;return Hn=1,Dn=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 No(){if(Vn)return qn;Vn=1;var e=$o(),t=Math.max;return qn=function(r,n,o){return n=t(void 0===n?r.length-1:n,0),function(){for(var i=arguments,a=-1,s=t(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),e(r,this,u)}},qn}function jo(){if(Kn)return Jn;return Kn=1,Jn=function(e){return function(){return e}}}function Bo(){if(Qn)return Yn;Qn=1;var e=jo(),t=Qt();return Yn=t?function(r,n){return t(r,"toString",{configurable:!0,enumerable:!1,value:e(n),writable:!0})}:Co()}function Eo(){if(Zn)return Xn;Zn=1;var e=Date.now;return Xn=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)}},Xn}function Oo(){if(to)return eo;to=1;var e=Bo(),t=Eo()(e);return eo=t}function To(){if(no)return ro;no=1;var e=Co(),t=No(),r=Oo();return ro=function(n,o){return r(t(n,o,e),n+"")}}function So(){if(io)return oo;io=1;var e=ct(),t=Qr(),r=yo(),n=Pt();return oo=function(o,i,a){if(!n(a))return!1;var s=typeof i;return!!("number"==s?t(a)&&r(i,a.length):"string"==s&&i in a)&&e(a[i],o)}}function Ao(){if(so)return ao;so=1;var e=To(),t=So();return ao=function(r){return e((function(e,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&&t(n[0],n[1],s)&&(a=i<3?void 0:a,i=1),e=Object(e);++o<i;){var c=n[o];c&&r(e,c,o,a)}return e}))}}function Lo(){if(uo)return co;uo=1;var e=Po(),t=Ao()((function(t,r,n){e(t,r,n)}));return co=t}var Uo,Fo,Wo,Mo,Io,zo,Go,Do,Ho,qo,Vo,Jo,Ko,Yo,Qo,Xo,Zo,ei,ti,ri,ni,oi,ii,ai,si=at(Lo());function ci(){if(Fo)return Uo;Fo=1;var e=kt(),t=qr();return Uo=function(r){return"symbol"==typeof r||t(r)&&"[object Symbol]"==e(r)}}function ui(){if(Mo)return Wo;Mo=1;var e=Kr(),t=ci(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;return Wo=function(o,i){if(e(o))return!1;var a=typeof o;return!("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=o&&!t(o))||(n.test(o)||!r.test(o)||null!=i&&o in Object(i))}}function hi(){if(zo)return Io;zo=1;var e=Jt();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 a=r.apply(this,e);return o.cache=i.set(t,a)||i,a};return o.cache=new(t.Cache||e),o}return t.Cache=e,Io=t}function li(){if(Do)return Go;Do=1;var e=hi();return Go=function(t){var r=e(t,(function(e){return 500===n.size&&n.clear(),e})),n=r.cache;return r}}function fi(){if(qo)return Ho;qo=1;var e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,r=li()((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 Ho=r}function gi(){if(Jo)return Vo;return Jo=1,Vo=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 pi(){if(Yo)return Ko;Yo=1;var e=_t(),t=gi(),r=Kr(),n=ci(),o=e?e.prototype:void 0,i=o?o.toString:void 0;return Ko=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 a=o+"";return"0"==a&&1/o==-1/0?"-0":a},Ko}function di(){if(Xo)return Qo;Xo=1;var e=pi();return Qo=function(t){return null==t?"":e(t)}}function mi(){if(ei)return Zo;ei=1;var e=Kr(),t=ui(),r=fi(),n=di();return Zo=function(o,i){return e(o)?o:t(o,i)?[o]:r(n(o))}}function vi(){if(ri)return ti;ri=1;var e=ci();return ti=function(t){if("string"==typeof t||e(t))return t;var r=t+"";return"0"==r&&1/t==-1/0?"-0":r}}function yi(){if(oi)return ni;oi=1;var e=mi(),t=vi();return ni=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}}function bi(){if(ai)return ii;ai=1;var e=yi();return ii=function(t,r,n){var o=null==t?void 0:e(t,r);return void 0===o?n:o}}var wi=at(bi());const _i="package.json",xi=[".env.local",".env"];class Ri extends e{_env;shared;constructor(e){super(e),this._env=t.searchEnv({logger:this.logger,preloadList:this.feConfig.envOrder||xi}),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=si(this.options,e)}getConfig(e,t){return wi(this.options,e,t)}setShared(e){this.shared=si(this.shared,e)}getPkg(e,t){const r=this.workspace?.packageJson;if(!r)throw new Error("package.json is not found");return e?wi(r,e,t):r}getTemplateContext(){return{...this.shared,...this.workspace,publishPath:this.workspace?.path||"",env:this.releaseEnv,branch:this.sourceBranch}}}function ki(e,...t){return[e,...t]}const Pi={maxWorkspace:3,multiWorkspaceSeparator:"_",workspaceVersionSeparator:"@",batchBranchName:"batch-${releaseName}-${length}-packages"};class Ci{shell;logger;config;constructor(e,t,r={}){this.shell=e,this.logger=t,this.config={...Pi,...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})}getReleaseName(e){if(1===e.length)return e[0].name;const{maxWorkspace:t,multiWorkspaceSeparator:r,workspaceVersionSeparator:n}=this.config;return e.slice(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,a=1===e.length?t.tagName:e.map((e=>`${e.name}${i}${e.version}`)).join(" ");return this.shell.format(n,{...r,tagName:a,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 n(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:a,discussionCategoryName:s}=this.context.getConfig("githubPR"),c=t,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:"",...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.context.dryRun)return void this.logger.exec(`octokit repos.createRelease "${t.name}" (${t.tag_name})`);const r=await this.octokit.repos.createRelease(t);this.logger.verbose(`octokit repos.createRelease: done (${r.headers.location})`)}}var Ni,ji;function Bi(){if(ji)return Ni;ji=1;var e=kt(),t=Kr(),r=qr();return Ni=function(n){return"string"==typeof n||!t(n)&&r(n)&&"[object String]"==e(n)}}var Ei=at(Bi());class Oi{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];return t||e?si({},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 Ti extends Oi{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 getUserInfo(){let e;try{e=(await this.context.shell.exec("git config --get remote.origin.url",{dryRun:!1})).trim()}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&&Ei(e)}}class Si{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 Ai extends Oi{releaseTask=null;workspacesList=[];_skip=!1;releaseLabel;constructor(e){super(e,"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 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=>o(e.root)===o(r)));if(this.nextSkip(),!e)throw new Error(`No workspace found for: ${r}`);return this.logger.debug(`Workspace of ${r} find!`,i(e.root,_i)),void this.setCurrentWorkspace(e,[e])}const[n,...a]=t;this.workspacesList=a,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"):[]}readJson(e){const t=s(e,"utf-8");return JSON.parse(t)}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(),t=await this.getChangedPackages(e,this.getConfig("changeLabels"));this.logger.debug("changedPaths",t);return t.map((e=>this.toWorkspace({path:e})))}toWorkspace(e){let{root:t,packageJson:r}=e;const n=e.path;if(!n)throw new Error("path is not required!");return t=t||i(this.context.rootPath,n),r=r||this.readJson(i(t,_i)),{name:r.name,version:r.version,path:n,root:t,packageJson:r}}}function Li(e,...t){return"function"==typeof e&&e.prototype&&e.prototype.constructor===e?new e(...t):e(...t)}function Ui(e){return e.startsWith(".")?a(e).name:e}async function Fi(e){let t=null;try{t=(await import(e)).default}catch{try{t=(await import(i(process.cwd(),e))).default}catch{const r=c(process.cwd());t=(await import(u(r.resolve(e,{paths:[process.cwd()]})).href)).default}}return[Ui(e),t]}async function Wi(e,t,r=5){const n=h(r),o=t.map((([t,...r])=>n((()=>(async(t,...r)=>{if("string"==typeof t){const[,n]=await Fi(t);return Li(n,e,...r)}return Li(t,e,...r)})(t,...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(Ai),ki(class extends Oi{constructor(e,t){super(e,"changelog",{increment:"patch",changesetRoot:".changeset",tagTemplate:"${name}@${version}",tagPrefix:"${name}",tagMatch:"${name}@*",...t})}get changesetRoot(){return f(this.context.rootPath,this.getConfig("changesetRoot"))}enabled(){return!this.getConfig("skip")}async onBefore(){if(!g(this.changesetRoot))throw new Error(`Changeset directory ${this.changesetRoot} does not exist`);this.logger.debug(`${this.changesetRoot} exists`)}async onExec(){const e=this.context.workspaces,t=await this.step({label:"Generate Changelogs",task:()=>Promise.all(e.map((e=>this.generate(e))))});this.logger.debug("changelogs",t),this.context.setWorkspaces(t),this.getConfig("skipChangeset")||await this.step({label:"Create Changeset Files",task:()=>Promise.all(t.map((e=>this.generateChangesetFile(e))))})}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:Mi.name},n={version:t.version},o={debug:this.logger.debug.bind(this.logger),from:e,reverse:!0},i={},a={};return this.context.dryRun?(this.logger.info("[Dry Run] Changelog is dry run"),new Promise((e=>{e("## Dry Run Changelog")}))):new Promise(((e,t)=>{let s="";l(r,n,o,i,a).on("data",(e=>{s+=e.toString()})).on("end",(()=>{e(this.tranformChangelog(s,Mi.types))})).on("error",t)}))}tranformChangelog(e,t){return e}async generate(e){const t=await this.getTagName(e);this.logger.verbose("tagName is:",t);const r=await this.createChangelog({workspace:e,lastTag:t});return{...e,tagName:t,changelog:r}}async 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=await 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 await 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=f(this.changesetRoot,`${n}.md`),i=this.shell.format("---\n'${name}': '${increment}'\n---\n${changelog}",{...e,increment:this.getIncrement()});if(this.context.dryRun)return this.logger.info(`Changeset [${o}] will be created, content is:`),void this.logger.log(i);g(o)?this.logger.info(`Changeset ${n} already exists`):p(o,i,"utf-8")}},{}),ki(class extends Ti{context;releaseParams;githubManager;constructor(e,t){super(e,"githubPR",{commandPrefix:"pnpm dlx",releaseName:"Release ${name} v${version}",...t}),this.context=e,this.githubManager=new $i(this.context),this.releaseParams=new Ci(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"onExec"===e?!this.isPublish:"onSuccess"!==e||this.isPublish}get isPublish(){return!this.getConfig("releasePR")}async onBefore(){if(this.logger.verbose("GithubPR onBefore"),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.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;await this.runChangesetsCli("publish"),await this.shell.exec("git push origin --tags"),await this.step({label:"Release Github",task:()=>Promise.all(e.map((e=>this.githubManager.createRelease(e))))})}async relesaeCommit(e){const t=this.getConfig("commitArgs",[]);if(await this.runChangesetsCli("version",["--no-changelog"]),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.shell.exec(["git","commit","--message",r,...t])}runChangesetsCli(e,t){return this.shell.exec([this.getConfig("commandPrefix","npx"),"@changesets/cli",e,...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.shell.exec(["git","commit","--message",`"${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})}},{})];class zi{executor;defaultTuples;context;constructor(e={},t=new r,n=Ii){this.executor=t,this.defaultTuples=n,this.context=new Ri(e)}getContext(){return this.context}async usePlugins(e){e=e||this.context.shared.plugins||[];const t=await Wi(this.context,[...this.defaultTuples,...e]);return t.forEach((e=>{e instanceof Ai&&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()}}var Gi,Di,Hi,qi;function Vi(){if(Di)return Gi;Di=1;var e=po(),t=mi(),r=yo(),n=Pt(),o=vi();return Gi=function(i,a,s,c){if(!n(i))return i;for(var u=-1,h=(a=t(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])?[]:{})}e(f,g,p),f=f[g]}return i}}function Ji(){if(qi)return Hi;qi=1;var e=Vi();return Hi=function(t,r,n){return null==t?t:e(t,r,n)}}var Ki=at(Ji());function Yi(e,t){return Object.entries(e).reduce(((e,[r,n])=>(r.includes(".")?Ki(e,r,n):Ki(e,t?`${t}.${r}`:r,n),e)),{})}export{Oi as Plugin,Ri as ReleaseContext,Si as ReleaseLabel,zi as ReleaseTask,Li as factory,Fi as load,Wi as loaderPluginsFromPluginTuples,Yi 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 a}from"node:path";import{readFileSync as s}from"node:fs";import{createRequire as u}from"node:module";import{pathToFileURL as c}from"node:url";import h from"p-limit";import l from"conventional-changelog";import{join as f}from"path";import{existsSync as g,writeFileSync as p}from"fs";var d,m,v,y,b,w,R,_,x,k,P,C,$,N,j,E,B,O,T,S,A,L,U,F,W,G,M,I,z,D,H,q,V,J,K,Y,Q,X,Z,tt,et,rt,nt,ot,it,at,st,ut,ct,ht,lt,ft,gt,pt,dt,mt,vt,yt,bt,wt,Rt,_t,xt,kt,Pt,Ct,$t,Nt,jt,Et,Bt,Ot,Tt,St,At,Lt,Ut,Ft,Wt,Gt,Mt,It,zt,Dt,Ht,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 ue(){if(y)return v;return y=1,v=function(t,e){return t===e||t!=t&&e!=e}}function ce(){if(w)return b;w=1;var t=ue();return b=function(e,r){for(var n=e.length;n--;)if(t(e[n][0],r))return n;return-1}}function he(){if(_)return R;_=1;var t=ce(),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 x;k=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 fe(){if(C)return P;C=1;var t=ce();return P=function(e){return t(this.__data__,e)>-1}}function ge(){if(N)return $;N=1;var t=ce();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(F)return U;return F=1,U=function(t){return this.__data__.has(t)}}function be(){if(G)return W;G=1;var t="object"==typeof ie&&ie&&ie.Object===Object&&ie;return W=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(D)return z;D=1;var t=we().Symbol;return z=t}function _e(){if(q)return H;q=1;var t=Re(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,o=t?t.toStringTag:void 0;return H=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 xe(){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=_e(),r=xe(),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(ut)return st;ut=1;var t=Ce(),e=Ne(),r=Pe(),n=je(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,a=Object.prototype,s=i.toString,u=a.hasOwnProperty,c=RegExp("^"+s.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return st=function(i){return!(!r(i)||e(i))&&(t(i)?c:o).test(n(i))}}function Be(){if(ht)return ct;return ht=1,ct=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(_t)return Rt;_t=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 Fe(){if(kt)return xt;kt=1;var t=Se(),e=Object.prototype.hasOwnProperty;return xt=function(r){var n=this.__data__;return t?void 0!==n[r]:e.call(n,r)}}function We(){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=Fe(),o=We();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 De(){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 He(){if(Ft)return Ut;Ft=1;var t=ze();return Ut=function(e){return t(this,e).get(e)}}function qe(){if(Gt)return Wt;Gt=1;var t=ze();return Wt=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(Dt)return zt;Dt=1;var t=Me(),e=De(),r=He(),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 Ht;qt=1;var t=pe(),e=Te(),r=Je();return Ht=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=ue();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 u=a[t?s:++o];if(!1===r(i[u],u,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,ur,cr,hr,lr,fr,gr,pr,dr,mr,vr,yr,br,wr,Rr,_r,xr,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 Fr(){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 Wr(){if(ur)return sr;ur=1;var t=Fr();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 cr;return hr=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(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 Dr(){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 Hr(){if(wr)return br;wr=1;var t=Mr(),e=zr(),r=Dr();return br=function(n){return"function"!=typeof n.constructor||r(n)?{}:t(e(n))}}function qr(){if(_r)return Rr;return _r=1,Rr=function(t){return null!=t&&"object"==typeof t}}function Vr(){if(kr)return xr;kr=1;var t=ke(),e=qr();return xr=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,un,cn={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}(cn,cn.exports)),cn.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 u=a.call(o,"constructor")&&o.constructor;return"function"==typeof u&&u instanceof u&&i.call(u)==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(un)return sn;return un=1,sn=function(t){return function(e){return t(e)}}}var dn,mn,vn,yn,bn,wn,Rn,_n,xn,kn,Pn,Cn,$n,Nn,jn,En,Bn,On,Tn,Sn,An,Ln,Un,Fn,Wn,Gn,Mn,In,zn,Dn,Hn,qn,Vn,Jn,Kn,Yn,Qn,Xn,Zn,to,eo,ro,no,oo,io,ao,so,uo,co,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=ue(),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(xn)return _n;xn=1;var t=po(),e=Xe();return _n=function(r,n,o,i){var a=!o;o||(o={});for(var s=-1,u=n.length;++s<u;){var c=n[s],h=i?i(o[c],r[c],c,o,r):void 0;void 0===h&&(h=r[c]),a?e(o,c,h):t(o,c,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,u){var c=r(s),h=!c&&e(s),l=!c&&!h&&n(s),f=!c&&!h&&!l&&i(s),g=c||h||l||f,p=g?t(s.length,String):[],d=p.length;for(var m in s)!u&&!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=Dr(),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 _o(){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 xo(){if(Un)return Ln;Un=1;var t=mo(),e=_o();return Ln=function(r){return t(r,e(r))}}function ko(){if(Wn)return Fn;Wn=1;var t=Ze(),e=Lr(),r=Wr(),n=Gr(),o=Hr(),i=Jr(),a=Kr(),s=Xr(),u=ln(),c=Ce(),h=Pe(),l=fn(),f=fo(),g=go(),p=xo();return Fn=function(d,m,v,y,b,w,R){var _=g(d,v),x=g(m,v),k=R.get(x);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(x),N=!$&&u(x),j=!$&&!N&&f(x);P=x,$||N||j?a(_)?P=_:s(_)?P=n(_):N?(C=!1,P=e(x,!0)):j?(C=!1,P=r(x,!0)):P=[]:l(x)||i(x)?(P=_,i(_)?P=p(_):h(_)&&!c(_)||(P=o(x))):C=!1}C&&(R.set(x,P),b(P,x,y,w,R),R.delete(x)),t(d,v,P)}}}function Po(){if(Mn)return Gn;Mn=1;var t=Ye(),e=Ze(),r=er(),n=ko(),o=Pe(),i=_o(),a=go();return Gn=function s(u,c,h,l,f){u!==c&&r(c,(function(r,i){if(f||(f=new t),o(r))n(u,c,i,h,s,l,f);else{var g=l?l(a(u,i),r,i+"",u,c,f):void 0;void 0===g&&(g=r),e(u,i,g)}}),i)},Gn}function Co(){if(zn)return In;return zn=1,In=function(t){return t}}function $o(){if(Hn)return Dn;return Hn=1,Dn=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),u=Array(s);++a<s;)u[a]=i[n+a];a=-1;for(var c=Array(n+1);++a<n;)c[a]=i[a];return c[n]=o(u),t(r,this,c)}},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=ue(),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 u=n[o];u&&r(t,u,o,a)}return t}))}}function Lo(){if(co)return uo;co=1;var t=Po(),e=Ao()((function(e,r,n){t(e,r,n)}));return uo=e}var Uo,Fo,Wo,Go,Mo,Io,zo,Do,Ho,qo,Vo,Jo,Ko,Yo,Qo,Xo,Zo,ti,ei,ri,ni,oi,ii,ai,si=ae(Lo());function ui(){if(Fo)return Uo;Fo=1;var t=ke(),e=qr();return Uo=function(r){return"symbol"==typeof r||e(r)&&"[object Symbol]"==t(r)}}function ci(){if(Go)return Wo;Go=1;var t=Kr(),e=ui(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;return Wo=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(Do)return zo;Do=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 Ho;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 Ho=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=ui(),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=ci(),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=ui();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",_i=[".env.local",".env"];class xi extends t{_env;shared;constructor(t){super(t),this._env=e.searchEnv({logger:this.logger,preloadList:this.feConfig.envOrder||_i}),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}}}function ki(t,...e){return[t,...e]}const Pi={maxWorkspace:3,multiWorkspaceSeparator:"_",workspaceVersionSeparator:"@",batchBranchName:"batch-${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})}getReleaseName(t){if(1===t.length)return t[0].name;const{maxWorkspace:e,multiWorkspaceSeparator:r,workspaceVersionSeparator:n}=this.config;return t.slice(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"),u=e,c=o?"":this.truncateBody(String(a));return{name:u,make_latest:i.toString(),body:c,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];return e||t?si({},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)}}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 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"):[]}readJson(t){const e=s(t,"utf-8");return JSON.parse(e)}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(),e=await this.getChangedPackages(t,this.getConfig("changeLabels"));this.logger.debug("changedPaths",e);return e.map((t=>this.toWorkspace({path:t})))}toWorkspace(t){let{root:e,packageJson:r}=t;const n=t.path;if(!n)throw new Error("path is not required!");return e=e||i(this.context.rootPath,n),r=r||this.readJson(i(e,Ri)),{name:r.name,version:r.version,path:n,root:e,packageJson:r}}}function Li(t,...e){return"function"==typeof t&&t.prototype&&t.prototype.constructor===t?new t(...e):t(...e)}function Ui(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=u(process.cwd());e=(await import(c(r.resolve(t,{paths:[process.cwd()]})).href)).default}}return[Ui(t),e]}async function Wi(t,e,r=5){const n=h(r),o=e.map((([e,...r])=>n((()=>(async(e,...r)=>{if("string"==typeof e){const[,n]=await Fi(e);return Li(n,t,...r)}return Li(e,t,...r)})(e,...r)))));return Promise.all(o)}const Gi={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 Mi=[ki(Ai),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 f(this.context.rootPath,this.getConfig("changesetRoot"))}enabled(){return!this.getConfig("skip")}async onBefore(){if(!g(this.changesetRoot))throw new Error(`Changeset directory ${this.changesetRoot} does not exist`);this.logger.debug(`${this.changesetRoot} exists`)}async onExec(){const t=this.context.workspaces,e=await this.step({label:"Generate Changelogs",task:()=>Promise.all(t.map((t=>this.generate(t))))});this.logger.debug("changelogs",e),this.context.setWorkspaces(e),this.getConfig("skipChangeset")||await this.step({label:"Create Changeset Files",task:()=>Promise.all(e.map((t=>this.generateChangesetFile(t))))})}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:Gi.name},n={version:e.version},o={debug:this.logger.debug.bind(this.logger),from:t,reverse:!0},i={},a={};return this.context.dryRun?(this.logger.info("[Dry Run] Changelog is dry run"),new Promise((t=>{t("## Dry Run Changelog")}))):new Promise(((t,e)=>{let s="";l(r,n,o,i,a).on("data",(t=>{s+=t.toString()})).on("end",(()=>{t(this.tranformChangelog(s,Gi.types))})).on("error",e)}))}tranformChangelog(t,e){return t}async generate(t){const e=await this.getTagName(t);this.logger.verbose("tagName is:",e);const r=await this.createChangelog({workspace:t,lastTag:e});return{...t,tagName:e,changelog:r}}async 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=await 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 await 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=f(this.changesetRoot,`${n}.md`),i=this.shell.format("---\n'${name}': '${increment}'\n---\n${changelog}",{...t,increment:this.getIncrement()});if(this.context.dryRun)return this.logger.info(`Changeset [${o}] will be created, content is:`),void this.logger.log(i);g(o)?this.logger.info(`Changeset ${n} already exists`):p(o,i,"utf-8")}},{}),ki(class extends Ti{context;releaseParams;githubManager;constructor(t,e){super(t,"githubPR",{commandPrefix:"pnpm dlx",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"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.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;await this.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(await this.runChangesetsCli("version",["--no-changelog"]),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.shell.exec(["git","commit","--message",r,...e])}runChangesetsCli(t,e){return this.shell.exec([this.getConfig("commandPrefix","npx"),"@changesets/cli",t,...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.shell.exec(["git","commit","--message",`"${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 Ii{executor;defaultTuples;context;constructor(t={},e=new r,n=Mi){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 Wi(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 zi,Di,Hi,qi;function Vi(){if(Di)return zi;Di=1;var t=po(),e=mi(),r=yo(),n=Pe(),o=vi();return zi=function(i,a,s,u){if(!n(i))return i;for(var c=-1,h=(a=e(a,i)).length,l=h-1,f=i;null!=f&&++c<h;){var g=o(a[c]),p=s;if("__proto__"===g||"constructor"===g||"prototype"===g)return i;if(c!=l){var d=f[g];void 0===(p=u?u(d,g,f):void 0)&&(p=n(d)?d:r(a[c+1])?[]:{})}t(f,g,p),f=f[g]}return i}}function Ji(){if(qi)return Hi;qi=1;var t=Vi();return Hi=function(e,r,n){return null==e?e:t(e,r,n)}}var Ki=ae(Ji());function Yi(t,e){return Object.entries(t).reduce(((t,[r,n])=>(r.includes(".")?Ki(t,r,n):Ki(t,e?`${e}.${r}`:r,n),t)),{})}export{Oi as Plugin,xi as ReleaseContext,Si as ReleaseLabel,Ii as ReleaseTask,Li as factory,Fi as load,Wi as loaderPluginsFromPluginTuples,Yi as reduceOptions,ki 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": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
7
7
|
"homepage": "https://github.com/qlover/fe-base/tree/master/packages/fe-release",
|