@qlover/fe-release 2.3.4 → 3.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/dist/cli.cjs +6202 -1
- package/dist/cli.js +6206 -1
- package/dist/index.cjs +4265 -1
- package/dist/index.d.ts +43 -97
- package/dist/index.js +4245 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { Env } from '@qlover/env-loader';
|
|
1
|
+
import { AsyncExecutor, ExecutorContext } from '@qlover/fe-corekit';
|
|
2
|
+
import { ScriptPlugin, ScriptContext, ScriptPluginProps, ScriptSharedInterface, ScriptContextInterface, FeReleaseConfig, ShellInterface } from '@qlover/scripts-context';
|
|
3
|
+
export { ScriptPlugin } from '@qlover/scripts-context';
|
|
5
4
|
import { CommitField } from 'gitlog';
|
|
5
|
+
import { LoggerInterface } from '@qlover/logger';
|
|
6
6
|
import { OptionValues } from 'commander';
|
|
7
7
|
|
|
8
|
+
type PluginClass<T extends unknown[] = any[]> = new (...args: T) => ScriptPlugin<ScriptContext<any>, ScriptPluginProps>;
|
|
9
|
+
/**
|
|
10
|
+
* Represents the constructor parameters for a specific Plugin class, excluding the first parameter.
|
|
11
|
+
* This assumes that the constructor parameters are known and can be inferred.
|
|
12
|
+
*/
|
|
13
|
+
type PluginConstructorParams<T extends PluginClass> = T extends new (first: any, ...args: infer P) => unknown ? P : never;
|
|
14
|
+
type PluginTuple<T extends PluginClass> = [
|
|
15
|
+
T | string,
|
|
16
|
+
...PluginConstructorParams<T>
|
|
17
|
+
];
|
|
18
|
+
declare function tuple<T extends PluginClass>(plugin: T | string, ...args: PluginConstructorParams<T>): PluginTuple<T>;
|
|
19
|
+
|
|
8
20
|
declare class ReleaseTask {
|
|
9
21
|
private executor;
|
|
10
22
|
private defaultTuples;
|
|
11
23
|
protected context: ReleaseContext;
|
|
12
|
-
constructor(options?: ReleaseContextOptions
|
|
24
|
+
constructor(options?: Partial<ReleaseContextOptions>, executor?: AsyncExecutor, defaultTuples?: PluginTuple<PluginClass>[]);
|
|
13
25
|
getContext(): ReleaseContext;
|
|
14
|
-
usePlugins(externalTuples?: PluginTuple<PluginClass>[]): Promise<
|
|
26
|
+
usePlugins(externalTuples?: PluginTuple<PluginClass>[]): Promise<ScriptPlugin<ScriptContext<any>, ScriptPluginProps>[]>;
|
|
15
27
|
run(): Promise<unknown>;
|
|
16
28
|
exec(externalTuples?: PluginTuple<PluginClass>[]): Promise<unknown>;
|
|
17
29
|
}
|
|
18
30
|
|
|
19
|
-
|
|
31
|
+
type PackageJson$1 = Record<string, unknown>;
|
|
32
|
+
interface WorkspacesProps extends ScriptPluginProps {
|
|
20
33
|
/**
|
|
21
34
|
* Whether to skip workspaces
|
|
22
35
|
*
|
|
@@ -74,7 +87,7 @@ interface WorkspaceValue {
|
|
|
74
87
|
/**
|
|
75
88
|
* The package.json of the workspace
|
|
76
89
|
*/
|
|
77
|
-
packageJson: PackageJson;
|
|
90
|
+
packageJson: PackageJson$1;
|
|
78
91
|
/**
|
|
79
92
|
* The tag name of the workspace
|
|
80
93
|
* @private
|
|
@@ -139,7 +152,7 @@ type ReleaseParamsConfig = {
|
|
|
139
152
|
PRBody?: string;
|
|
140
153
|
};
|
|
141
154
|
|
|
142
|
-
interface GitBaseProps {
|
|
155
|
+
interface GitBaseProps extends ScriptPluginProps {
|
|
143
156
|
/**
|
|
144
157
|
* The token for the GitHub API
|
|
145
158
|
*
|
|
@@ -248,12 +261,11 @@ type ReleaseReturnValue = {
|
|
|
248
261
|
type DeepPartial<T> = {
|
|
249
262
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
250
263
|
};
|
|
251
|
-
interface ReleaseConfig {
|
|
264
|
+
interface ReleaseConfig extends ScriptSharedInterface {
|
|
252
265
|
githubPR?: GithubPRProps;
|
|
253
266
|
workspaces?: WorkspacesProps;
|
|
254
267
|
}
|
|
255
|
-
interface ReleaseContextOptions<T extends ReleaseConfig = ReleaseConfig> extends
|
|
256
|
-
shared?: SharedReleaseOptions;
|
|
268
|
+
interface ReleaseContextOptions$1<T extends ReleaseConfig = ReleaseConfig> extends ScriptContextInterface<T> {
|
|
257
269
|
}
|
|
258
270
|
type StepOption<T> = {
|
|
259
271
|
label: string;
|
|
@@ -261,7 +273,7 @@ type StepOption<T> = {
|
|
|
261
273
|
task: () => Promise<T>;
|
|
262
274
|
};
|
|
263
275
|
type PackageJson = Record<string, unknown>;
|
|
264
|
-
interface TemplateContext extends
|
|
276
|
+
interface TemplateContext extends ReleaseContextOptions$1, WorkspaceValue {
|
|
265
277
|
publishPath: string;
|
|
266
278
|
/**
|
|
267
279
|
* @deprecated use `releaseEnv` from `shared`
|
|
@@ -273,67 +285,19 @@ interface TemplateContext extends SharedReleaseOptions, WorkspaceValue {
|
|
|
273
285
|
branch: string;
|
|
274
286
|
}
|
|
275
287
|
|
|
276
|
-
|
|
277
|
-
protected context: ReleaseContext;
|
|
278
|
-
readonly pluginName: string;
|
|
279
|
-
protected props: Props;
|
|
280
|
-
readonly onlyOne = true;
|
|
281
|
-
constructor(context: ReleaseContext, pluginName: string, props?: Props);
|
|
282
|
-
getInitialProps(props?: Props): Props;
|
|
283
|
-
get logger(): LoggerInterface;
|
|
284
|
-
get shell(): Shell;
|
|
285
|
-
get options(): Props;
|
|
286
|
-
getEnv(key: string, defaultValue?: string): string | undefined;
|
|
287
|
-
enabled(_name: string, _context: ExecutorReleaseContext): boolean;
|
|
288
|
-
getConfig<T>(keys?: string | string[], defaultValue?: T): T;
|
|
289
|
-
setConfig(config: DeepPartial<Props>): void;
|
|
290
|
-
onBefore?(_context: ExecutorReleaseContext): void | Promise<void>;
|
|
291
|
-
onExec?(_context: ExecutorReleaseContext): void | Promise<void>;
|
|
292
|
-
onSuccess?(_context: ExecutorReleaseContext): void | Promise<void>;
|
|
293
|
-
onError?(_context: ExecutorReleaseContext): void | Promise<void>;
|
|
294
|
-
/**
|
|
295
|
-
* run a step
|
|
296
|
-
*
|
|
297
|
-
* this will log the step and return the result of the task
|
|
298
|
-
*
|
|
299
|
-
* @param label - the label of the step
|
|
300
|
-
* @param task - the task to run
|
|
301
|
-
* @returns the result of the task
|
|
302
|
-
*/
|
|
303
|
-
step<T>({ label, task }: StepOption<T>): Promise<T>;
|
|
288
|
+
interface ReleaseContextOptions extends ScriptContextInterface<ReleaseContextConfig> {
|
|
304
289
|
}
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Represents a class that extends Plugin.
|
|
308
|
-
*/
|
|
309
|
-
type PluginClass<T extends unknown[] = any[]> = new (...args: T) => Plugin;
|
|
310
|
-
/**
|
|
311
|
-
* Represents the constructor parameters for a specific Plugin class, excluding the first parameter.
|
|
312
|
-
* This assumes that the constructor parameters are known and can be inferred.
|
|
313
|
-
*/
|
|
314
|
-
type PluginConstructorParams<T extends PluginClass> = T extends new (first: any, ...args: infer P) => unknown ? P : never;
|
|
315
|
-
type PluginTuple<T extends PluginClass> = [
|
|
316
|
-
T | string,
|
|
317
|
-
...PluginConstructorParams<T>
|
|
318
|
-
];
|
|
319
|
-
declare function tuple<T extends PluginClass>(plugin: T | string, ...args: PluginConstructorParams<T>): PluginTuple<T>;
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* This is the shared options for the release.
|
|
323
|
-
*
|
|
324
|
-
* extends `FeReleaseConfig`
|
|
325
|
-
*/
|
|
326
|
-
interface SharedReleaseOptions extends FeReleaseConfig {
|
|
290
|
+
interface ReleaseContextConfig extends FeReleaseConfig, ScriptSharedInterface {
|
|
327
291
|
/**
|
|
328
|
-
* The
|
|
329
|
-
*
|
|
330
|
-
* default:
|
|
331
|
-
* - first, get from `FE_RELEASE_SOURCE_BRANCH`
|
|
332
|
-
* - second, get from `FE_RELEASE_BRANCH`
|
|
333
|
-
* - `master`
|
|
334
|
-
*
|
|
292
|
+
* The github PR of the project
|
|
293
|
+
* @private
|
|
335
294
|
*/
|
|
336
|
-
|
|
295
|
+
githubPR?: GithubPRProps;
|
|
296
|
+
/**
|
|
297
|
+
* The workspaces of the project
|
|
298
|
+
* @private
|
|
299
|
+
*/
|
|
300
|
+
workspaces?: WorkspacesProps;
|
|
337
301
|
/**
|
|
338
302
|
* The environment of the project
|
|
339
303
|
*
|
|
@@ -343,12 +307,6 @@ interface SharedReleaseOptions extends FeReleaseConfig {
|
|
|
343
307
|
* - `development`
|
|
344
308
|
*/
|
|
345
309
|
releaseEnv?: string;
|
|
346
|
-
/**
|
|
347
|
-
* The root path of the project
|
|
348
|
-
*
|
|
349
|
-
* @default `process.cwd()`
|
|
350
|
-
*/
|
|
351
|
-
rootPath?: string;
|
|
352
310
|
/**
|
|
353
311
|
* Plugins
|
|
354
312
|
*/
|
|
@@ -366,25 +324,14 @@ interface SharedReleaseOptions extends FeReleaseConfig {
|
|
|
366
324
|
*/
|
|
367
325
|
currentBranch?: string;
|
|
368
326
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
protected readonly _env: Env;
|
|
372
|
-
/**
|
|
373
|
-
* Shared Config
|
|
374
|
-
*/
|
|
375
|
-
shared: SharedReleaseOptions;
|
|
376
|
-
constructor(context: ReleaseContextOptions<T>);
|
|
377
|
-
private getDefaultShreadOptions;
|
|
327
|
+
declare class ReleaseContext extends ScriptContext<ReleaseContextConfig> {
|
|
328
|
+
constructor(name: string, options: Partial<ReleaseContextOptions>);
|
|
378
329
|
get rootPath(): string;
|
|
379
330
|
get sourceBranch(): string;
|
|
380
331
|
get releaseEnv(): string;
|
|
381
|
-
get env(): Env;
|
|
382
332
|
get workspaces(): WorkspaceValue[] | undefined;
|
|
383
333
|
get workspace(): WorkspaceValue | undefined;
|
|
384
334
|
setWorkspaces(workspaces: WorkspaceValue[]): void;
|
|
385
|
-
setConfig(config: DeepPartial<ReleaseConfig>): void;
|
|
386
|
-
getConfig<T = unknown>(key: string | string[], defaultValue?: T): T;
|
|
387
|
-
setShared(shared: Partial<SharedReleaseOptions>): void;
|
|
388
335
|
getPkg<T>(key?: string, defaultValue?: T): T;
|
|
389
336
|
getTemplateContext(): TemplateContext;
|
|
390
337
|
runChangesetsCli(name: string, args?: string[]): Promise<string>;
|
|
@@ -431,7 +378,7 @@ interface GitChangelogOptions {
|
|
|
431
378
|
* gitlog default fields
|
|
432
379
|
* @default ["abbrevHash", "hash", "subject", "authorName", "authorDate"]
|
|
433
380
|
*/
|
|
434
|
-
|
|
381
|
+
fields?: CommitField[];
|
|
435
382
|
/**
|
|
436
383
|
* not include merge commit
|
|
437
384
|
* @default true
|
|
@@ -498,7 +445,7 @@ interface ChangeLogInterface {
|
|
|
498
445
|
|
|
499
446
|
declare const CHANGELOG_ALL_FIELDS: CommitField[];
|
|
500
447
|
interface GitChangelogProps extends GitChangelogOptions {
|
|
501
|
-
shell:
|
|
448
|
+
shell: ShellInterface;
|
|
502
449
|
logger: LoggerInterface;
|
|
503
450
|
}
|
|
504
451
|
declare class GitChangelog implements ChangeLogInterface {
|
|
@@ -532,10 +479,10 @@ interface Options extends GitChangelogOptions {
|
|
|
532
479
|
}
|
|
533
480
|
declare class GitChangelogFormatter implements ChangelogFormatter {
|
|
534
481
|
protected options: Options & {
|
|
535
|
-
shell:
|
|
482
|
+
shell: ShellInterface;
|
|
536
483
|
};
|
|
537
484
|
constructor(options: Options & {
|
|
538
|
-
shell:
|
|
485
|
+
shell: ShellInterface;
|
|
539
486
|
});
|
|
540
487
|
format(commits: CommitValue[], options?: Options): string[];
|
|
541
488
|
formatCommit(commit: CommitValue, options?: Options): string;
|
|
@@ -550,12 +497,11 @@ interface GithubChangelogProps extends GitChangelogProps {
|
|
|
550
497
|
}
|
|
551
498
|
|
|
552
499
|
declare function load<T>(pluginName: string): Promise<[string, T]>;
|
|
553
|
-
declare function loaderPluginsFromPluginTuples<T extends
|
|
500
|
+
declare function loaderPluginsFromPluginTuples<T extends ScriptPlugin<ScriptContext<any>, ScriptPluginProps>>(context: ReleaseContext, pluginsTuples: PluginTuple<PluginClass>[], maxLimit?: number): Promise<T[]>;
|
|
554
501
|
|
|
555
502
|
type ConstructorType<T, Args extends unknown[]> = (new (...args: Args) => T) | ((...args: Args) => T);
|
|
556
503
|
declare function factory<T, Args extends unknown[]>(Constructor: ConstructorType<T, Args>, ...args: Args): T;
|
|
557
504
|
|
|
558
505
|
declare function reduceOptions(opts: OptionValues, commonKey?: string): OptionValues;
|
|
559
506
|
|
|
560
|
-
export { CHANGELOG_ALL_FIELDS, GitChangelog, GitChangelogFormatter,
|
|
561
|
-
export type { ConstructorType, DeepPartial, ExecutorReleaseContext, GitChangelogProps, GithubChangelogProps, Options, PackageJson, PluginClass, PluginConstructorParams, PluginTuple, ReleaseConfig, ReleaseContextOptions, ReleaseLabelCompare, ReleaseLabelOptions, ReleaseReturnValue, StepOption, TemplateContext };
|
|
507
|
+
export { CHANGELOG_ALL_FIELDS, type ConstructorType, type DeepPartial, type ExecutorReleaseContext, GitChangelog, GitChangelogFormatter, type GitChangelogProps, type GithubChangelogProps, type Options, type PackageJson, type PluginClass, type PluginConstructorParams, type PluginTuple, type ReleaseConfig, ReleaseContext, type ReleaseContextOptions$1 as ReleaseContextOptions, ReleaseLabel, type ReleaseLabelCompare, type ReleaseLabelOptions, type ReleaseReturnValue, ReleaseTask, type StepOption, type TemplateContext, factory, load, loaderPluginsFromPluginTuples, reduceOptions, tuple };
|