@qlover/fe-release 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +1 -60
- package/dist/cli.js +1 -58
- package/dist/index.cjs +1 -5381
- package/dist/index.d.ts +102 -103
- package/dist/index.js +1 -5371
- package/package.json +11 -11
package/dist/index.d.ts
CHANGED
|
@@ -3,81 +3,6 @@ import { AsyncExecutor, ExecutorContext, ExecutorPlugin, Logger } from '@qlover/
|
|
|
3
3
|
import { Env } from '@qlover/env-loader';
|
|
4
4
|
import { OptionValues } from 'commander';
|
|
5
5
|
|
|
6
|
-
interface InitOptions {
|
|
7
|
-
token?: string;
|
|
8
|
-
repoName?: string;
|
|
9
|
-
authorName?: string;
|
|
10
|
-
}
|
|
11
|
-
interface PullRequestInterface {
|
|
12
|
-
init(params: InitOptions): Promise<unknown>;
|
|
13
|
-
mergePullRequest(params: unknown): Promise<unknown>;
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
* @param params
|
|
17
|
-
*/
|
|
18
|
-
getPullRequest(params: {
|
|
19
|
-
pull_number: number;
|
|
20
|
-
}): Promise<unknown>;
|
|
21
|
-
deleteBranch(params: unknown): Promise<unknown>;
|
|
22
|
-
addPullRequestLabels(params: unknown): Promise<unknown>;
|
|
23
|
-
createPullRequestLabel(params: unknown): Promise<unknown>;
|
|
24
|
-
createPullRequest(params: unknown): Promise<{
|
|
25
|
-
/**
|
|
26
|
-
* pr number
|
|
27
|
-
*/
|
|
28
|
-
number: number;
|
|
29
|
-
[key: string]: unknown;
|
|
30
|
-
}>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface ReleaseItProps extends ReleaseItInstanceOptions {
|
|
34
|
-
/**
|
|
35
|
-
* Receive the `release-it` instance
|
|
36
|
-
*/
|
|
37
|
-
releaseIt: ReleaseItInstanceType;
|
|
38
|
-
}
|
|
39
|
-
type ReleaseItInstanceType = (options: ReleaseItInstanceOptions) => Promise<ReleaseItInstanceResult>;
|
|
40
|
-
type ReleaseItInstanceOptions = Record<string, unknown>;
|
|
41
|
-
type ReleaseItInstanceResult = {
|
|
42
|
-
changelog: string;
|
|
43
|
-
version: string;
|
|
44
|
-
};
|
|
45
|
-
declare class ReleaseIt {
|
|
46
|
-
private context;
|
|
47
|
-
private releaseItInstance;
|
|
48
|
-
private templateOptions;
|
|
49
|
-
private templateJson;
|
|
50
|
-
private lastPath;
|
|
51
|
-
constructor(context: ReleaseContext, props?: ReleaseItProps);
|
|
52
|
-
/**
|
|
53
|
-
* Run release-it in the publish path
|
|
54
|
-
*
|
|
55
|
-
* Because `release-it` only support signle publish path,
|
|
56
|
-
* so we need to change the current working directory to the publish path.
|
|
57
|
-
*
|
|
58
|
-
* @note This method will change the current working directory to the publish path.
|
|
59
|
-
* @param options - The options for the release-it process.
|
|
60
|
-
* @returns The output from the release-it process.
|
|
61
|
-
*/
|
|
62
|
-
run(options?: ReleaseItInstanceOptions): Promise<ReleaseItInstanceResult>;
|
|
63
|
-
getOptions(context?: SharedReleaseOptions, mergeOptions?: Partial<ReleaseItInstanceOptions>): ReleaseItInstanceOptions;
|
|
64
|
-
publishNpm(): Promise<ReleaseItInstanceResult>;
|
|
65
|
-
createChangelog(): Promise<ReleaseItInstanceResult>;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
interface PublishNpmProps {
|
|
69
|
-
npmToken?: string;
|
|
70
|
-
/**
|
|
71
|
-
* Whether to skip setting the npmrc file
|
|
72
|
-
*
|
|
73
|
-
* @default `false`
|
|
74
|
-
*/
|
|
75
|
-
skipNpmrc?: boolean;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
type ConstructorType<T, Args extends unknown[]> = (new (...args: Args) => T) | ((...args: Args) => T);
|
|
79
|
-
declare function factory<T, Args extends unknown[]>(Constructor: ConstructorType<T, Args>, ...args: Args): T;
|
|
80
|
-
|
|
81
6
|
declare class ReleaseTask {
|
|
82
7
|
private executor;
|
|
83
8
|
private defaultTuples;
|
|
@@ -133,6 +58,14 @@ interface WorkspaceValue {
|
|
|
133
58
|
* The package.json of the workspace
|
|
134
59
|
*/
|
|
135
60
|
packageJson: PackageJson;
|
|
61
|
+
/**
|
|
62
|
+
* The tag name of the workspace
|
|
63
|
+
*/
|
|
64
|
+
tagName?: string;
|
|
65
|
+
/**
|
|
66
|
+
* The changelog of the workspace
|
|
67
|
+
*/
|
|
68
|
+
changelog?: string;
|
|
136
69
|
}
|
|
137
70
|
|
|
138
71
|
type ReleaseParamsConfig = {
|
|
@@ -176,23 +109,88 @@ type ReleaseParamsConfig = {
|
|
|
176
109
|
PRBody?: string;
|
|
177
110
|
};
|
|
178
111
|
|
|
179
|
-
interface
|
|
112
|
+
interface GitBaseProps {
|
|
180
113
|
/**
|
|
181
|
-
* The
|
|
114
|
+
* The token for the GitHub API
|
|
182
115
|
*
|
|
183
|
-
* @default `
|
|
116
|
+
* @default `GITHUB_TOKEN`
|
|
184
117
|
*/
|
|
185
|
-
|
|
118
|
+
tokenRef?: string;
|
|
186
119
|
/**
|
|
187
|
-
*
|
|
120
|
+
* The timeout for the GitHub API
|
|
121
|
+
*/
|
|
122
|
+
timeout?: number;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface GithubPRProps extends ReleaseParamsConfig, GitBaseProps {
|
|
126
|
+
/**
|
|
127
|
+
* The command to run before the release
|
|
128
|
+
*
|
|
129
|
+
* @default `pnpm dlx`
|
|
130
|
+
*/
|
|
131
|
+
commandPrefix?: string;
|
|
132
|
+
/**
|
|
133
|
+
* Whether to publish a PR
|
|
188
134
|
*
|
|
189
135
|
* @default `false`
|
|
190
136
|
*/
|
|
191
|
-
|
|
137
|
+
releasePR?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* The commit message of the release
|
|
140
|
+
*
|
|
141
|
+
* support WorkspaceValue
|
|
142
|
+
*
|
|
143
|
+
* @default 'chore(tag): {{name}} v${version}'
|
|
144
|
+
*/
|
|
145
|
+
commitMessage?: string;
|
|
192
146
|
/**
|
|
193
|
-
* The
|
|
147
|
+
* The commit args of the release
|
|
148
|
+
*
|
|
149
|
+
* @default []
|
|
150
|
+
*/
|
|
151
|
+
commitArgs?: string[];
|
|
152
|
+
/**
|
|
153
|
+
* The release name of the release
|
|
154
|
+
*
|
|
155
|
+
* @default 'Release ${name} v${version}'
|
|
156
|
+
*/
|
|
157
|
+
releaseName?: string;
|
|
158
|
+
/**
|
|
159
|
+
* Whether to create a draft release
|
|
160
|
+
*
|
|
161
|
+
* @default false
|
|
162
|
+
*/
|
|
163
|
+
draft?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Whether to create a pre-release
|
|
166
|
+
*
|
|
167
|
+
* @default false
|
|
168
|
+
*/
|
|
169
|
+
preRelease?: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Whether to auto-generate the release notes
|
|
172
|
+
*
|
|
173
|
+
* @default false
|
|
174
|
+
*/
|
|
175
|
+
autoGenerate?: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Whether to make the latest release
|
|
178
|
+
*
|
|
179
|
+
* @default true
|
|
180
|
+
*/
|
|
181
|
+
makeLatest?: boolean | 'true' | 'false' | 'legacy';
|
|
182
|
+
/**
|
|
183
|
+
* The release notes of the release
|
|
184
|
+
*
|
|
185
|
+
* @default undefined
|
|
186
|
+
*/
|
|
187
|
+
releaseNotes?: string;
|
|
188
|
+
/**
|
|
189
|
+
* The discussion category name of the release
|
|
190
|
+
*
|
|
191
|
+
* @default undefined
|
|
194
192
|
*/
|
|
195
|
-
|
|
193
|
+
discussionCategoryName?: string;
|
|
196
194
|
}
|
|
197
195
|
|
|
198
196
|
interface ExecutorReleaseContext extends ExecutorContext<ReleaseContext> {
|
|
@@ -206,9 +204,7 @@ type DeepPartial<T> = {
|
|
|
206
204
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
207
205
|
};
|
|
208
206
|
interface ReleaseConfig {
|
|
209
|
-
|
|
210
|
-
githubPR?: ReleasePullRequestProps;
|
|
211
|
-
releaseIt: ReleaseItProps;
|
|
207
|
+
githubPR?: GithubPRProps;
|
|
212
208
|
workspaces?: WorkspacesProps;
|
|
213
209
|
}
|
|
214
210
|
interface ReleaseContextOptions<T extends ReleaseConfig = ReleaseConfig> extends Omit<FeScriptContextOptions<T>, 'constructor'> {
|
|
@@ -216,6 +212,7 @@ interface ReleaseContextOptions<T extends ReleaseConfig = ReleaseConfig> extends
|
|
|
216
212
|
}
|
|
217
213
|
type StepOption<T> = {
|
|
218
214
|
label: string;
|
|
215
|
+
enabled?: boolean;
|
|
219
216
|
task: () => Promise<T>;
|
|
220
217
|
};
|
|
221
218
|
type PackageJson = Record<string, unknown>;
|
|
@@ -242,7 +239,7 @@ declare abstract class Plugin<Props = unknown> implements ExecutorPlugin<Release
|
|
|
242
239
|
get shell(): Shell;
|
|
243
240
|
get options(): Props;
|
|
244
241
|
getEnv(key: string, defaultValue?: string): string | undefined;
|
|
245
|
-
enabled(): boolean;
|
|
242
|
+
enabled(_name: string, _context: ExecutorReleaseContext): boolean;
|
|
246
243
|
getConfig<T>(keys?: string | string[], defaultValue?: T): T;
|
|
247
244
|
setConfig(config: DeepPartial<Props>): void;
|
|
248
245
|
onBefore?(_context: ExecutorReleaseContext): void | Promise<void>;
|
|
@@ -276,6 +273,11 @@ type PluginTuple<T extends PluginClass> = [
|
|
|
276
273
|
];
|
|
277
274
|
declare function tuple<T extends PluginClass>(plugin: T | string, ...args: PluginConstructorParams<T>): PluginTuple<T>;
|
|
278
275
|
|
|
276
|
+
/**
|
|
277
|
+
* This is the shared options for the release.
|
|
278
|
+
*
|
|
279
|
+
* extends `FeReleaseConfig`
|
|
280
|
+
*/
|
|
279
281
|
interface SharedReleaseOptions extends FeReleaseConfig {
|
|
280
282
|
/**
|
|
281
283
|
* The source branch of the project
|
|
@@ -302,45 +304,39 @@ interface SharedReleaseOptions extends FeReleaseConfig {
|
|
|
302
304
|
* @default `process.cwd()`
|
|
303
305
|
*/
|
|
304
306
|
rootPath?: string;
|
|
305
|
-
/**
|
|
306
|
-
* Whether to publish a PR
|
|
307
|
-
*
|
|
308
|
-
* @default `false`
|
|
309
|
-
*/
|
|
310
|
-
releasePR?: boolean;
|
|
311
307
|
/**
|
|
312
308
|
* Plugins
|
|
313
309
|
*/
|
|
314
310
|
plugins?: PluginTuple<PluginClass<unknown[]>>[];
|
|
311
|
+
/**
|
|
312
|
+
* The name of the repository
|
|
313
|
+
*/
|
|
315
314
|
repoName?: string;
|
|
315
|
+
/**
|
|
316
|
+
* The name of the author
|
|
317
|
+
*/
|
|
316
318
|
authorName?: string;
|
|
317
|
-
currentBranch?: string;
|
|
318
319
|
/**
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
* If true, the PR will be created for all workspaces, instead of creating one PR per workspace.
|
|
322
|
-
*
|
|
323
|
-
* @default `false`
|
|
320
|
+
* The current branch of the project
|
|
324
321
|
*/
|
|
325
|
-
|
|
322
|
+
currentBranch?: string;
|
|
326
323
|
}
|
|
327
324
|
|
|
328
325
|
declare class ReleaseContext<T extends ReleaseConfig = ReleaseConfig> extends FeScriptContext<T> {
|
|
329
326
|
protected readonly _env: Env;
|
|
330
|
-
readonly releaseIt: ReleaseIt;
|
|
331
327
|
/**
|
|
332
328
|
* Shared Config
|
|
333
329
|
*/
|
|
334
330
|
shared: SharedReleaseOptions;
|
|
335
331
|
constructor(context: ReleaseContextOptions<T>);
|
|
336
332
|
private getDefaultShreadOptions;
|
|
337
|
-
get releasePR(): boolean;
|
|
338
333
|
get rootPath(): string;
|
|
339
334
|
get sourceBranch(): string;
|
|
340
335
|
get releaseEnv(): string;
|
|
341
336
|
get env(): Env;
|
|
342
337
|
get workspaces(): WorkspaceValue[] | undefined;
|
|
343
338
|
get workspace(): WorkspaceValue | undefined;
|
|
339
|
+
setWorkspaces(workspaces: WorkspaceValue[]): void;
|
|
344
340
|
setConfig(config: DeepPartial<ReleaseConfig>): void;
|
|
345
341
|
getConfig<T = unknown>(key: string | string[], defaultValue?: T): T;
|
|
346
342
|
setShared(shared: Partial<SharedReleaseOptions>): void;
|
|
@@ -372,7 +368,10 @@ declare class ReleaseLabel {
|
|
|
372
368
|
declare function load<T>(pluginName: string): Promise<[string, T]>;
|
|
373
369
|
declare function loaderPluginsFromPluginTuples<T extends Plugin<unknown>>(context: ReleaseContext, pluginsTuples: PluginTuple<PluginClass>[], maxLimit?: number): Promise<T[]>;
|
|
374
370
|
|
|
371
|
+
type ConstructorType<T, Args extends unknown[]> = (new (...args: Args) => T) | ((...args: Args) => T);
|
|
372
|
+
declare function factory<T, Args extends unknown[]>(Constructor: ConstructorType<T, Args>, ...args: Args): T;
|
|
373
|
+
|
|
375
374
|
declare function reduceOptions(opts: OptionValues, commonKey?: string): OptionValues;
|
|
376
375
|
|
|
377
376
|
export { Plugin, ReleaseContext, ReleaseLabel, ReleaseTask, factory, load, loaderPluginsFromPluginTuples, reduceOptions, tuple };
|
|
378
|
-
export type { ConstructorType, DeepPartial, ExecutorReleaseContext,
|
|
377
|
+
export type { ConstructorType, DeepPartial, ExecutorReleaseContext, PackageJson, PluginClass, PluginConstructorParams, PluginTuple, ReleaseConfig, ReleaseContextOptions, ReleaseLabelCompare, ReleaseLabelOptions, ReleaseReturnValue, StepOption, TemplateContext };
|