fork-version 1.7.6 → 2.0.1
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/CHANGELOG.md +47 -0
- package/README.md +10 -0
- package/dist/{chunk-4M7BP5DG.js → chunk-DZLU4REC.js} +992 -267
- package/dist/chunk-DZLU4REC.js.map +1 -0
- package/dist/{chunk-JAYAB33O.cjs → chunk-GQO6W4DN.cjs} +998 -272
- package/dist/chunk-GQO6W4DN.cjs.map +1 -0
- package/dist/cli.cjs +128 -129
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +118 -120
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +33 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +462 -57
- package/dist/index.d.ts +462 -57
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/package.json +8 -9
- package/dist/chunk-4M7BP5DG.js.map +0 -1
- package/dist/chunk-JAYAB33O.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,69 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ReleaseType } from 'semver';
|
|
3
3
|
|
|
4
|
+
interface ParserOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Pattern to match commit subjects
|
|
7
|
+
* - Expected capture groups: `type` `title`
|
|
8
|
+
* - Optional capture groups: `scope`, `breakingChange`
|
|
9
|
+
*/
|
|
10
|
+
subjectPattern: RegExp | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Pattern to match merge commits
|
|
13
|
+
* - Expected capture groups: `id`, `source`
|
|
14
|
+
*/
|
|
15
|
+
mergePattern: RegExp | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Pattern to match revert commits
|
|
18
|
+
* - Expected capture groups: `subject`, `hash`
|
|
19
|
+
*/
|
|
20
|
+
revertPattern: RegExp | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Pattern to match commented out lines which will be trimmed
|
|
23
|
+
*/
|
|
24
|
+
commentPattern: RegExp | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Pattern to match mentions
|
|
27
|
+
* - Expected capture groups: `username`
|
|
28
|
+
*/
|
|
29
|
+
mentionPattern: RegExp | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* List of action labels to match reference sections
|
|
32
|
+
* @default
|
|
33
|
+
* ["close", "closes", "closed", "fix", "fixes", "fixed", "resolve", "resolves", "resolved"]
|
|
34
|
+
*/
|
|
35
|
+
referenceActions?: string[];
|
|
36
|
+
/**
|
|
37
|
+
* Pattern to match reference sections
|
|
38
|
+
* - Expected capture groups: `action`, `reference`
|
|
39
|
+
*/
|
|
40
|
+
referenceActionPattern: RegExp | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* List of issue prefixes to match issue ids
|
|
43
|
+
* @default
|
|
44
|
+
* ["#"]
|
|
45
|
+
*/
|
|
46
|
+
issuePrefixes?: string[];
|
|
47
|
+
/**
|
|
48
|
+
* Pattern to match issue references
|
|
49
|
+
* - Expected capture groups: `repository`, `prefix`, `issue`
|
|
50
|
+
*/
|
|
51
|
+
issuePattern: RegExp | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* List of keywords to match note titles
|
|
54
|
+
* @default
|
|
55
|
+
* ["BREAKING CHANGE", "BREAKING-CHANGE"]
|
|
56
|
+
*/
|
|
57
|
+
noteKeywords?: string[];
|
|
58
|
+
/**
|
|
59
|
+
* Pattern to match note sections
|
|
60
|
+
* - Expected capture groups: `title`
|
|
61
|
+
* - Optional capture groups: `text`
|
|
62
|
+
*/
|
|
63
|
+
notePattern: RegExp | undefined;
|
|
64
|
+
}
|
|
65
|
+
declare function createParserOptions(userOptions?: Partial<ParserOptions>): ParserOptions;
|
|
66
|
+
|
|
4
67
|
declare const ForkConfigSchema: z.ZodObject<{
|
|
5
68
|
/**
|
|
6
69
|
* If set, Fork-Version will print the current version and exit.
|
|
@@ -145,6 +208,7 @@ declare const ForkConfigSchema: z.ZodObject<{
|
|
|
145
208
|
sign: z.ZodBoolean;
|
|
146
209
|
/**
|
|
147
210
|
* If true, git will run user defined git hooks before committing.
|
|
211
|
+
* @see {@link https://git-scm.com/docs/githooks Git - Git Hooks}
|
|
148
212
|
* @default false
|
|
149
213
|
*/
|
|
150
214
|
verify: z.ZodBoolean;
|
|
@@ -208,30 +272,30 @@ declare const ForkConfigSchema: z.ZodObject<{
|
|
|
208
272
|
releaseCommitMessageFormat: z.ZodOptional<z.ZodString>;
|
|
209
273
|
issuePrefixes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
210
274
|
}, "strip", z.ZodTypeAny, {
|
|
275
|
+
commitUrlFormat?: string | undefined;
|
|
276
|
+
compareUrlFormat?: string | undefined;
|
|
277
|
+
issueUrlFormat?: string | undefined;
|
|
278
|
+
userUrlFormat?: string | undefined;
|
|
279
|
+
releaseCommitMessageFormat?: string | undefined;
|
|
211
280
|
types?: {
|
|
212
281
|
type: string;
|
|
213
282
|
scope?: string | undefined;
|
|
214
283
|
section?: string | undefined;
|
|
215
284
|
hidden?: boolean | undefined;
|
|
216
285
|
}[] | undefined;
|
|
286
|
+
issuePrefixes?: string[] | undefined;
|
|
287
|
+
}, {
|
|
217
288
|
commitUrlFormat?: string | undefined;
|
|
218
289
|
compareUrlFormat?: string | undefined;
|
|
219
290
|
issueUrlFormat?: string | undefined;
|
|
220
291
|
userUrlFormat?: string | undefined;
|
|
221
292
|
releaseCommitMessageFormat?: string | undefined;
|
|
222
|
-
issuePrefixes?: string[] | undefined;
|
|
223
|
-
}, {
|
|
224
293
|
types?: {
|
|
225
294
|
type: string;
|
|
226
295
|
scope?: string | undefined;
|
|
227
296
|
section?: string | undefined;
|
|
228
297
|
hidden?: boolean | undefined;
|
|
229
298
|
}[] | undefined;
|
|
230
|
-
commitUrlFormat?: string | undefined;
|
|
231
|
-
compareUrlFormat?: string | undefined;
|
|
232
|
-
issueUrlFormat?: string | undefined;
|
|
233
|
-
userUrlFormat?: string | undefined;
|
|
234
|
-
releaseCommitMessageFormat?: string | undefined;
|
|
235
299
|
issuePrefixes?: string[] | undefined;
|
|
236
300
|
}>;
|
|
237
301
|
/**
|
|
@@ -241,8 +305,8 @@ declare const ForkConfigSchema: z.ZodObject<{
|
|
|
241
305
|
releaseMessageSuffix: z.ZodOptional<z.ZodString>;
|
|
242
306
|
}, "strip", z.ZodTypeAny, {
|
|
243
307
|
inspectVersion: boolean;
|
|
244
|
-
path: string;
|
|
245
308
|
files: string[];
|
|
309
|
+
path: string;
|
|
246
310
|
changelog: string;
|
|
247
311
|
header: string;
|
|
248
312
|
tagPrefix: string;
|
|
@@ -260,17 +324,17 @@ declare const ForkConfigSchema: z.ZodObject<{
|
|
|
260
324
|
skipCommit: boolean;
|
|
261
325
|
skipTag: boolean;
|
|
262
326
|
changelogPresetConfig: {
|
|
327
|
+
commitUrlFormat?: string | undefined;
|
|
328
|
+
compareUrlFormat?: string | undefined;
|
|
329
|
+
issueUrlFormat?: string | undefined;
|
|
330
|
+
userUrlFormat?: string | undefined;
|
|
331
|
+
releaseCommitMessageFormat?: string | undefined;
|
|
263
332
|
types?: {
|
|
264
333
|
type: string;
|
|
265
334
|
scope?: string | undefined;
|
|
266
335
|
section?: string | undefined;
|
|
267
336
|
hidden?: boolean | undefined;
|
|
268
337
|
}[] | undefined;
|
|
269
|
-
commitUrlFormat?: string | undefined;
|
|
270
|
-
compareUrlFormat?: string | undefined;
|
|
271
|
-
issueUrlFormat?: string | undefined;
|
|
272
|
-
userUrlFormat?: string | undefined;
|
|
273
|
-
releaseCommitMessageFormat?: string | undefined;
|
|
274
338
|
issuePrefixes?: string[] | undefined;
|
|
275
339
|
};
|
|
276
340
|
glob?: string | undefined;
|
|
@@ -281,8 +345,8 @@ declare const ForkConfigSchema: z.ZodObject<{
|
|
|
281
345
|
releaseMessageSuffix?: string | undefined;
|
|
282
346
|
}, {
|
|
283
347
|
inspectVersion: boolean;
|
|
284
|
-
path: string;
|
|
285
348
|
files: string[];
|
|
349
|
+
path: string;
|
|
286
350
|
changelog: string;
|
|
287
351
|
header: string;
|
|
288
352
|
tagPrefix: string;
|
|
@@ -300,17 +364,17 @@ declare const ForkConfigSchema: z.ZodObject<{
|
|
|
300
364
|
skipCommit: boolean;
|
|
301
365
|
skipTag: boolean;
|
|
302
366
|
changelogPresetConfig: {
|
|
367
|
+
commitUrlFormat?: string | undefined;
|
|
368
|
+
compareUrlFormat?: string | undefined;
|
|
369
|
+
issueUrlFormat?: string | undefined;
|
|
370
|
+
userUrlFormat?: string | undefined;
|
|
371
|
+
releaseCommitMessageFormat?: string | undefined;
|
|
303
372
|
types?: {
|
|
304
373
|
type: string;
|
|
305
374
|
scope?: string | undefined;
|
|
306
375
|
section?: string | undefined;
|
|
307
376
|
hidden?: boolean | undefined;
|
|
308
377
|
}[] | undefined;
|
|
309
|
-
commitUrlFormat?: string | undefined;
|
|
310
|
-
compareUrlFormat?: string | undefined;
|
|
311
|
-
issueUrlFormat?: string | undefined;
|
|
312
|
-
userUrlFormat?: string | undefined;
|
|
313
|
-
releaseCommitMessageFormat?: string | undefined;
|
|
314
378
|
issuePrefixes?: string[] | undefined;
|
|
315
379
|
};
|
|
316
380
|
glob?: string | undefined;
|
|
@@ -324,9 +388,6 @@ declare const ForkConfigSchema: z.ZodObject<{
|
|
|
324
388
|
type ForkConfig = z.infer<typeof ForkConfigSchema>;
|
|
325
389
|
type Config = Partial<ForkConfig>;
|
|
326
390
|
|
|
327
|
-
declare function getUserConfig(): Promise<ForkConfig>;
|
|
328
|
-
declare function defineConfig(config: Config): Config;
|
|
329
|
-
|
|
330
391
|
declare class Logger {
|
|
331
392
|
private config;
|
|
332
393
|
disableLogs: boolean;
|
|
@@ -337,6 +398,376 @@ declare class Logger {
|
|
|
337
398
|
debug(...messages: any[]): void;
|
|
338
399
|
}
|
|
339
400
|
|
|
401
|
+
interface CommitMerge {
|
|
402
|
+
id: string;
|
|
403
|
+
source: string;
|
|
404
|
+
}
|
|
405
|
+
interface CommitRevert {
|
|
406
|
+
hash: string;
|
|
407
|
+
subject: string;
|
|
408
|
+
}
|
|
409
|
+
interface CommitReference {
|
|
410
|
+
prefix: string;
|
|
411
|
+
issue: string;
|
|
412
|
+
action: string | null;
|
|
413
|
+
owner: string | null;
|
|
414
|
+
repository: string | null;
|
|
415
|
+
}
|
|
416
|
+
interface CommitNote {
|
|
417
|
+
title: string;
|
|
418
|
+
text: string;
|
|
419
|
+
}
|
|
420
|
+
interface Commit {
|
|
421
|
+
raw: string;
|
|
422
|
+
subject: string;
|
|
423
|
+
body: string;
|
|
424
|
+
hash: string;
|
|
425
|
+
/**
|
|
426
|
+
* Committer date in ISO 8601 format
|
|
427
|
+
* @example
|
|
428
|
+
* "2024-12-22T17:36:50Z"
|
|
429
|
+
*/
|
|
430
|
+
date: string;
|
|
431
|
+
/**
|
|
432
|
+
* Committer name (respects .mailmap)
|
|
433
|
+
*/
|
|
434
|
+
name: string;
|
|
435
|
+
/**
|
|
436
|
+
* Committer email (respects .mailmap)
|
|
437
|
+
*/
|
|
438
|
+
email: string;
|
|
439
|
+
type: string;
|
|
440
|
+
scope: string;
|
|
441
|
+
breakingChange: string;
|
|
442
|
+
title: string;
|
|
443
|
+
merge: CommitMerge | null;
|
|
444
|
+
revert: CommitRevert | null;
|
|
445
|
+
mentions: string[];
|
|
446
|
+
references: CommitReference[];
|
|
447
|
+
notes: CommitNote[];
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
declare class CommitParser {
|
|
451
|
+
#private;
|
|
452
|
+
constructor(userOptions?: Partial<ParserOptions>);
|
|
453
|
+
setLogger(logger: Logger): this;
|
|
454
|
+
createCommit(): Commit;
|
|
455
|
+
/**
|
|
456
|
+
* Parse the raw commit message into its expected parts
|
|
457
|
+
* - subject
|
|
458
|
+
* - body
|
|
459
|
+
* - hash
|
|
460
|
+
* - date
|
|
461
|
+
* - name
|
|
462
|
+
* - email
|
|
463
|
+
*
|
|
464
|
+
* @throws {ParserError}
|
|
465
|
+
*/
|
|
466
|
+
parseRawCommit(rawCommit: string): Commit;
|
|
467
|
+
/**
|
|
468
|
+
* Parse the commit subject into its expected parts
|
|
469
|
+
* - type
|
|
470
|
+
* - scope (optional)
|
|
471
|
+
* - breaking change (optional)
|
|
472
|
+
* - title
|
|
473
|
+
*
|
|
474
|
+
* @throws {ParserError}
|
|
475
|
+
*/
|
|
476
|
+
parseSubject(commit: Commit): boolean;
|
|
477
|
+
/**
|
|
478
|
+
* Parse merge information from the commit subject
|
|
479
|
+
* @example
|
|
480
|
+
* ```txt
|
|
481
|
+
* "Merge pull request #123 from fork-version/feature"
|
|
482
|
+
* ```
|
|
483
|
+
*/
|
|
484
|
+
parseMerge(commit: Commit): boolean;
|
|
485
|
+
/**
|
|
486
|
+
* Parse revert information from the commit body
|
|
487
|
+
* @example
|
|
488
|
+
* ```txt
|
|
489
|
+
* "Revert "feat: initial commit"
|
|
490
|
+
*
|
|
491
|
+
* This reverts commit 4a79e9e546b4020d2882b7810dc549fa71960f4f."
|
|
492
|
+
* ```
|
|
493
|
+
*/
|
|
494
|
+
parseRevert(commit: Commit): boolean;
|
|
495
|
+
/**
|
|
496
|
+
* Search for mentions from the commit line
|
|
497
|
+
* @example
|
|
498
|
+
* ```txt
|
|
499
|
+
* "@fork-version"
|
|
500
|
+
* ```
|
|
501
|
+
*/
|
|
502
|
+
parseMentions(line: string, outMentions: Set<string>): boolean;
|
|
503
|
+
/**
|
|
504
|
+
* Search for references from the commit line
|
|
505
|
+
* @example
|
|
506
|
+
* ```txt
|
|
507
|
+
* "#1234"
|
|
508
|
+
* "owner/repo#1234"
|
|
509
|
+
* ```
|
|
510
|
+
*/
|
|
511
|
+
parseReferenceParts(referenceText: string, action: string | null): CommitReference[] | undefined;
|
|
512
|
+
/**
|
|
513
|
+
* Search for actions and references from the commit line
|
|
514
|
+
* @example
|
|
515
|
+
* ```txt
|
|
516
|
+
* "Closes #1234"
|
|
517
|
+
* "fixes owner/repo#1234"
|
|
518
|
+
* ```
|
|
519
|
+
*/
|
|
520
|
+
parseReferences(line: string, outReferences: CommitReference[]): boolean;
|
|
521
|
+
/**
|
|
522
|
+
* Search for notes from the commit line
|
|
523
|
+
* @example
|
|
524
|
+
* ```txt
|
|
525
|
+
* "BREAKING CHANGE: this is a breaking change"
|
|
526
|
+
* ```
|
|
527
|
+
*/
|
|
528
|
+
parseNotes(line: string, outNotes: CommitNote[]): boolean;
|
|
529
|
+
/**
|
|
530
|
+
* Parse the raw commit for mentions, references and notes
|
|
531
|
+
*/
|
|
532
|
+
parseRawLines(commit: Commit): void;
|
|
533
|
+
/**
|
|
534
|
+
* Parse a commit log with the following format separated by new line characters:
|
|
535
|
+
* ```txt
|
|
536
|
+
* refactor: add test file
|
|
537
|
+
* Add a test file to the project
|
|
538
|
+
* 4ef2c86d393a9660aa9f753144256b1f200c16bd
|
|
539
|
+
* 2024-12-22T17:36:50Z
|
|
540
|
+
* Fork Version
|
|
541
|
+
* fork-version@example.com
|
|
542
|
+
* ```
|
|
543
|
+
*
|
|
544
|
+
* @example
|
|
545
|
+
* ```ts
|
|
546
|
+
* parse("refactor: add test file\nAdd a test file to the project\n4ef2c86d393a9660aa9f753144256b1f200c16bd\n2024-12-22T17:36:50Z\nFork Version\nfork-version@example.com");
|
|
547
|
+
* ```
|
|
548
|
+
*
|
|
549
|
+
* The expected input value can be generated by running the following command:
|
|
550
|
+
* ```sh
|
|
551
|
+
* git log --format="%s%n%b%n%H%n%cI%n%cN%n%cE%n"
|
|
552
|
+
* ```
|
|
553
|
+
* @see {@link https://git-scm.com/docs/pretty-formats|Git Pretty Format Documentation}
|
|
554
|
+
*/
|
|
555
|
+
parse(rawCommit: string): Commit | undefined;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* Filter out revert commits and their corresponding reverted commits,
|
|
560
|
+
* this function expects the input to be sorted by date in descending order
|
|
561
|
+
* from the most recent to the oldest commit.
|
|
562
|
+
*
|
|
563
|
+
* @example
|
|
564
|
+
* ```ts
|
|
565
|
+
* const commits: Commit[] = [...];
|
|
566
|
+
* const filteredCommits = filterRevertedCommits(commits);
|
|
567
|
+
* ```
|
|
568
|
+
*/
|
|
569
|
+
declare function filterRevertedCommits(parsedCommits: Commit[]): Commit[];
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* [Fork-Version - Config Properties](https://github.com/eglavin/fork-version/blob/main/README.md#config-properties)
|
|
573
|
+
*/
|
|
574
|
+
declare function defineConfig(config: Config): Config;
|
|
575
|
+
|
|
576
|
+
declare function getCliArguments(): {
|
|
577
|
+
inspectVersion: boolean | undefined;
|
|
578
|
+
files: string[] | undefined;
|
|
579
|
+
glob: string | undefined;
|
|
580
|
+
path: string | undefined;
|
|
581
|
+
changelog: string | undefined;
|
|
582
|
+
header: string | undefined;
|
|
583
|
+
tagPrefix: string | undefined;
|
|
584
|
+
preRelease: boolean | undefined;
|
|
585
|
+
preReleaseTag: string | undefined;
|
|
586
|
+
currentVersion: string | undefined;
|
|
587
|
+
nextVersion: string | undefined;
|
|
588
|
+
releaseAs: string | undefined;
|
|
589
|
+
allowMultipleVersions: boolean | undefined;
|
|
590
|
+
commitAll: boolean | undefined;
|
|
591
|
+
changelogAll: boolean | undefined;
|
|
592
|
+
debug: boolean | undefined;
|
|
593
|
+
dryRun: boolean | undefined;
|
|
594
|
+
silent: boolean | undefined;
|
|
595
|
+
gitTagFallback: boolean | undefined;
|
|
596
|
+
sign: boolean | undefined;
|
|
597
|
+
verify: boolean | undefined;
|
|
598
|
+
skipBump: boolean | undefined;
|
|
599
|
+
skipChangelog: boolean | undefined;
|
|
600
|
+
skipCommit: boolean | undefined;
|
|
601
|
+
skipTag: boolean | undefined;
|
|
602
|
+
commitUrlFormat: string | undefined;
|
|
603
|
+
compareUrlFormat: string | undefined;
|
|
604
|
+
issueUrlFormat: string | undefined;
|
|
605
|
+
userUrlFormat: string | undefined;
|
|
606
|
+
releaseCommitMessageFormat: string | undefined;
|
|
607
|
+
releaseMessageSuffix: string | undefined;
|
|
608
|
+
} & Record<string, unknown>;
|
|
609
|
+
|
|
610
|
+
declare function getUserConfig(cliArguments: Partial<ReturnType<typeof getCliArguments>>): Promise<ForkConfig>;
|
|
611
|
+
|
|
612
|
+
declare class Git {
|
|
613
|
+
#private;
|
|
614
|
+
private config;
|
|
615
|
+
constructor(config: Pick<ForkConfig, "path" | "dryRun">);
|
|
616
|
+
/**
|
|
617
|
+
* Add file contents to the index
|
|
618
|
+
*
|
|
619
|
+
* [git-add Documentation](https://git-scm.com/docs/git-add)
|
|
620
|
+
*
|
|
621
|
+
* @example
|
|
622
|
+
* ```ts
|
|
623
|
+
* await git.add("CHANGELOG.md");
|
|
624
|
+
* ```
|
|
625
|
+
*/
|
|
626
|
+
add(...args: (string | undefined)[]): Promise<string>;
|
|
627
|
+
/**
|
|
628
|
+
* Record changes to the repository
|
|
629
|
+
*
|
|
630
|
+
* [git-commit Documentation](https://git-scm.com/docs/git-commit)
|
|
631
|
+
*
|
|
632
|
+
* @example
|
|
633
|
+
* ```ts
|
|
634
|
+
* await git.commit("--message", "chore(release): 1.2.3");
|
|
635
|
+
* ```
|
|
636
|
+
*/
|
|
637
|
+
commit(...args: (string | undefined)[]): Promise<string>;
|
|
638
|
+
/**
|
|
639
|
+
* Create, list, delete or verify a tag object
|
|
640
|
+
*
|
|
641
|
+
* [git-tag Documentation](https://git-scm.com/docs/git-tag)
|
|
642
|
+
*
|
|
643
|
+
* @example
|
|
644
|
+
* ```ts
|
|
645
|
+
* await git.tag("--annotate", "v1.2.3", "--message", "chore(release): 1.2.3");
|
|
646
|
+
* ```
|
|
647
|
+
*/
|
|
648
|
+
tag(...args: (string | undefined)[]): Promise<string>;
|
|
649
|
+
/**
|
|
650
|
+
* Show commit logs
|
|
651
|
+
*
|
|
652
|
+
* - [git-log Documentation](https://git-scm.com/docs/git-log)
|
|
653
|
+
* - [pretty-formats Documentation](https://git-scm.com/docs/pretty-formats)
|
|
654
|
+
*
|
|
655
|
+
* @example
|
|
656
|
+
* ```ts
|
|
657
|
+
* await git.log("--oneline");
|
|
658
|
+
* ```
|
|
659
|
+
*/
|
|
660
|
+
log(...args: (string | undefined)[]): Promise<string>;
|
|
661
|
+
/**
|
|
662
|
+
* Check if a file is ignored by git
|
|
663
|
+
*
|
|
664
|
+
* [git-check-ignore Documentation](https://git-scm.com/docs/git-check-ignore)
|
|
665
|
+
*
|
|
666
|
+
* @example
|
|
667
|
+
* ```ts
|
|
668
|
+
* await git.isIgnored("src/my-file.txt");
|
|
669
|
+
* ```
|
|
670
|
+
*/
|
|
671
|
+
isIgnored(file: string): Promise<boolean>;
|
|
672
|
+
/**
|
|
673
|
+
* Get the name of the current branch
|
|
674
|
+
*
|
|
675
|
+
* [git-rev-parse Documentation](https://git-scm.com/docs/git-rev-parse)
|
|
676
|
+
*
|
|
677
|
+
* @example
|
|
678
|
+
* ```ts
|
|
679
|
+
* await git.getBranchName(); // "main"
|
|
680
|
+
* ```
|
|
681
|
+
*/
|
|
682
|
+
getBranchName(): Promise<string>;
|
|
683
|
+
/**
|
|
684
|
+
* Get the URL of the remote repository
|
|
685
|
+
*
|
|
686
|
+
* [git-config Documentation](https://git-scm.com/docs/git-config)
|
|
687
|
+
*
|
|
688
|
+
* @example
|
|
689
|
+
* ```ts
|
|
690
|
+
* await git.getRemoteUrl(); // "https://github.com/eglavin/fork-version"
|
|
691
|
+
* ```
|
|
692
|
+
*/
|
|
693
|
+
getRemoteUrl(): Promise<string>;
|
|
694
|
+
/**
|
|
695
|
+
* `getTags` returns valid semver version tags in order of the commit history
|
|
696
|
+
*
|
|
697
|
+
* Using `git log` to get the commit history, we then parse the tags from the
|
|
698
|
+
* commit details which is expected to be in the following format:
|
|
699
|
+
* ```txt
|
|
700
|
+
* commit 3841b1d05750d42197fe958e3d8e06df378a842d (HEAD -> main, tag: v1.0.2, tag: v1.0.1, tag: v1.0.0)
|
|
701
|
+
* Author: Username <username@example.com>
|
|
702
|
+
* Date: Sat Nov 9 15:00:00 2024 +0000
|
|
703
|
+
*
|
|
704
|
+
* chore(release): v1.0.0
|
|
705
|
+
* ```
|
|
706
|
+
*
|
|
707
|
+
* - [Functionality extracted from the conventional-changelog - git-semver-tags project](https://github.com/conventional-changelog/conventional-changelog/blob/fac8045242099c016f5f3905e54e02b7d466bd7b/packages/git-semver-tags/index.js)
|
|
708
|
+
* - [conventional-changelog git-semver-tags MIT Licence](https://github.com/conventional-changelog/conventional-changelog/blob/fac8045242099c016f5f3905e54e02b7d466bd7b/packages/git-semver-tags/LICENSE.md)
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* ```ts
|
|
712
|
+
* await git.getTags("v"); // ["v1.0.2", "v1.0.1", "v1.0.0"]
|
|
713
|
+
* ```
|
|
714
|
+
*/
|
|
715
|
+
getTags(tagPrefix: string | undefined): Promise<string[]>;
|
|
716
|
+
/**
|
|
717
|
+
* Returns the latest git tag based on commit date
|
|
718
|
+
*
|
|
719
|
+
* @example
|
|
720
|
+
* ```ts
|
|
721
|
+
* await git.getMostRecentTag("v"); // "1.2.3"
|
|
722
|
+
* ```
|
|
723
|
+
*/
|
|
724
|
+
getMostRecentTag(tagPrefix: string | undefined): Promise<string | undefined>;
|
|
725
|
+
/**
|
|
726
|
+
* Get cleaned semver tags, with any tag prefix's removed
|
|
727
|
+
*
|
|
728
|
+
* @example
|
|
729
|
+
* ```ts
|
|
730
|
+
* await git.getCleanedTags("v"); // ["1.2.3", "1.2.2", "1.2.1"]
|
|
731
|
+
* ```
|
|
732
|
+
*/
|
|
733
|
+
getCleanedTags(tagPrefix: string | undefined): Promise<string[]>;
|
|
734
|
+
/**
|
|
735
|
+
* Get the highest semver version from git tags. This will return the highest
|
|
736
|
+
* semver version found for the given tag prefix, regardless of the commit date.
|
|
737
|
+
*
|
|
738
|
+
* @example
|
|
739
|
+
* ```ts
|
|
740
|
+
* await git.getHighestSemverVersionFromTags("v"); // "1.2.3"
|
|
741
|
+
* ```
|
|
742
|
+
*/
|
|
743
|
+
getHighestSemverVersionFromTags(tagPrefix: string | undefined): Promise<string | undefined>;
|
|
744
|
+
/**
|
|
745
|
+
* Get commit history in a parsable format
|
|
746
|
+
*
|
|
747
|
+
* An array of strings with commit details is returned in the following format:
|
|
748
|
+
* ```txt
|
|
749
|
+
* subject
|
|
750
|
+
* body
|
|
751
|
+
* hash
|
|
752
|
+
* committer date
|
|
753
|
+
* committer name
|
|
754
|
+
* committer email
|
|
755
|
+
* ```
|
|
756
|
+
*
|
|
757
|
+
* @example
|
|
758
|
+
* ```ts
|
|
759
|
+
* await git.getCommits("v1.0.0", "HEAD", "src/utils");
|
|
760
|
+
* ```
|
|
761
|
+
*/
|
|
762
|
+
getCommits(from?: string, to?: string, ...paths: string[]): Promise<string[]>;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
interface CommitsSinceTag {
|
|
766
|
+
latestTag: string | undefined;
|
|
767
|
+
commits: Commit[];
|
|
768
|
+
}
|
|
769
|
+
declare function getCommitsSinceTag(config: ForkConfig, logger: Logger, git: Git): Promise<CommitsSinceTag>;
|
|
770
|
+
|
|
340
771
|
interface FileState {
|
|
341
772
|
name: string;
|
|
342
773
|
path: string;
|
|
@@ -355,6 +786,7 @@ declare class FileManager {
|
|
|
355
786
|
private YAMLPackage;
|
|
356
787
|
private PlainText;
|
|
357
788
|
private MSBuildProject;
|
|
789
|
+
private ARMBicep;
|
|
358
790
|
constructor(config: ForkConfig, logger: Logger);
|
|
359
791
|
/**
|
|
360
792
|
* Get the state from the given file name.
|
|
@@ -384,36 +816,6 @@ declare class FileManager {
|
|
|
384
816
|
write(fileState: FileState, newVersion: string): void;
|
|
385
817
|
}
|
|
386
818
|
|
|
387
|
-
declare class Git {
|
|
388
|
-
private config;
|
|
389
|
-
constructor(config: Pick<ForkConfig, "path" | "dryRun">);
|
|
390
|
-
private execGit;
|
|
391
|
-
add(...args: (string | undefined)[]): Promise<string>;
|
|
392
|
-
commit(...args: (string | undefined)[]): Promise<string>;
|
|
393
|
-
tag(...args: (string | undefined)[]): Promise<string>;
|
|
394
|
-
isIgnored(file: string): Promise<boolean>;
|
|
395
|
-
getCurrentBranchName(): Promise<string>;
|
|
396
|
-
/**
|
|
397
|
-
* `getTags` returns valid semver version tags in order of the commit history.
|
|
398
|
-
*
|
|
399
|
-
* Using `git log` to get the commit history, we then parse the tags from the
|
|
400
|
-
* commit details which is expected to be in the following format:
|
|
401
|
-
* @example
|
|
402
|
-
* ```txt
|
|
403
|
-
* commit 3841b1d05750d42197fe958e3d8e06df378a842d (HEAD -> main, tag: 1.0.2)
|
|
404
|
-
* Author: Username <username@example.com>
|
|
405
|
-
* Date: Sat Nov 9 15:00:00 2024 +0000
|
|
406
|
-
*
|
|
407
|
-
* chore(release): 1.2.3
|
|
408
|
-
* ```
|
|
409
|
-
*
|
|
410
|
-
* - [Functionality extracted from the conventional-changelog - git-semver-tags project](https://github.com/conventional-changelog/conventional-changelog/blob/fac8045242099c016f5f3905e54e02b7d466bd7b/packages/git-semver-tags/index.js)
|
|
411
|
-
* - [conventional-changelog git-semver-tags MIT Licence](https://github.com/conventional-changelog/conventional-changelog/blob/fac8045242099c016f5f3905e54e02b7d466bd7b/packages/git-semver-tags/LICENSE.md)
|
|
412
|
-
*/
|
|
413
|
-
getTags(tagPrefix: string | undefined): Promise<string[]>;
|
|
414
|
-
getLatestTag(tagPrefix: string | undefined): Promise<string>;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
819
|
interface CurrentVersion {
|
|
418
820
|
version: string;
|
|
419
821
|
files: FileState[];
|
|
@@ -421,12 +823,15 @@ interface CurrentVersion {
|
|
|
421
823
|
declare function getCurrentVersion(config: ForkConfig, logger: Logger, git: Git, fileManager: FileManager, filesToUpdate: string[]): Promise<CurrentVersion>;
|
|
422
824
|
interface NextVersion {
|
|
423
825
|
version: string;
|
|
424
|
-
level?: number;
|
|
425
|
-
preMajor?: boolean;
|
|
426
|
-
reason?: string;
|
|
427
826
|
releaseType?: ReleaseType;
|
|
827
|
+
preMajor?: boolean;
|
|
828
|
+
changes?: {
|
|
829
|
+
major: number;
|
|
830
|
+
minor: number;
|
|
831
|
+
patch: number;
|
|
832
|
+
};
|
|
428
833
|
}
|
|
429
|
-
declare function getNextVersion(config: ForkConfig, logger: Logger, currentVersion: string): Promise<NextVersion>;
|
|
834
|
+
declare function getNextVersion(config: ForkConfig, logger: Logger, commits: Commit[], currentVersion: string): Promise<NextVersion>;
|
|
430
835
|
|
|
431
836
|
declare function updateChangelog(config: ForkConfig, logger: Logger, nextVersion: string): Promise<void>;
|
|
432
837
|
|
|
@@ -434,4 +839,4 @@ declare function commitChanges(config: ForkConfig, logger: Logger, git: Git, fil
|
|
|
434
839
|
|
|
435
840
|
declare function tagChanges(config: ForkConfig, logger: Logger, git: Git, nextVersion: string): Promise<void>;
|
|
436
841
|
|
|
437
|
-
export { type Config, type CurrentVersion, FileManager, type FileState, type ForkConfig, ForkConfigSchema, type IFileManager, Logger, type NextVersion, commitChanges, defineConfig, getCurrentVersion, getNextVersion, getUserConfig, tagChanges, updateChangelog };
|
|
842
|
+
export { type Commit, type CommitMerge, type CommitNote, CommitParser, type CommitReference, type CommitRevert, type CommitsSinceTag, type Config, type CurrentVersion, FileManager, type FileState, type ForkConfig, ForkConfigSchema, Git, type IFileManager, Logger, type NextVersion, type ParserOptions, commitChanges, createParserOptions, defineConfig, filterRevertedCommits, getCommitsSinceTag, getCurrentVersion, getNextVersion, getUserConfig, tagChanges, updateChangelog };
|