fork-version 4.1.10 → 5.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 +20 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +54 -193
- package/dist/commands/inspect.d.ts +9 -0
- package/dist/commands/inspect.js +41 -0
- package/dist/commands/main.d.ts +16 -0
- package/dist/commands/main.js +30 -0
- package/dist/commands/validate-config.d.ts +6 -0
- package/dist/commands/validate-config.js +11 -0
- package/dist/commit-parser/commit-parser.d.ts +114 -0
- package/dist/commit-parser/commit-parser.js +327 -0
- package/dist/commit-parser/filter-reverted-commits.d.ts +17 -0
- package/dist/commit-parser/filter-reverted-commits.js +34 -0
- package/dist/commit-parser/options.d.ts +74 -0
- package/dist/commit-parser/options.js +70 -0
- package/dist/commit-parser/parser-error.js +14 -0
- package/dist/commit-parser/types.d.ts +53 -0
- package/dist/config/changelog-preset-config.js +41 -0
- package/dist/config/cli-arguments.d.ts +109 -0
- package/dist/config/cli-arguments.js +141 -0
- package/dist/config/defaults.js +38 -0
- package/dist/config/define-config.d.ts +9 -0
- package/dist/config/define-config.js +9 -0
- package/dist/config/load-config.js +45 -0
- package/dist/config/merge-files.js +12 -0
- package/dist/config/schema.d.ts +50 -0
- package/dist/config/schema.js +61 -0
- package/dist/config/types.d.ts +279 -0
- package/dist/config/user-config.d.ts +6 -0
- package/dist/config/user-config.js +50 -0
- package/dist/detect-git-host/detect-git-host.js +35 -0
- package/dist/detect-git-host/host-azure-devops.js +28 -0
- package/dist/detect-git-host/host-bitbucket.js +28 -0
- package/dist/detect-git-host/host-github.js +32 -0
- package/dist/detect-git-host/host-gitlab.js +48 -0
- package/dist/files/arm-bicep.js +38 -0
- package/dist/files/file-manager.d.ts +56 -0
- package/dist/files/file-manager.js +87 -0
- package/dist/files/install-shield-ism.js +55 -0
- package/dist/files/json-package.js +64 -0
- package/dist/files/ms-build-project.js +55 -0
- package/dist/files/plain-text.js +31 -0
- package/dist/files/yaml-package.js +57 -0
- package/dist/index.d.ts +21 -655
- package/dist/index.js +19 -10
- package/dist/process/changelog.d.ts +7 -0
- package/dist/process/changelog.js +69 -0
- package/dist/process/commit.d.ts +9 -0
- package/dist/process/commit.js +22 -0
- package/dist/process/get-commits.d.ts +14 -0
- package/dist/process/get-commits.js +25 -0
- package/dist/process/get-current-version.d.ts +13 -0
- package/dist/process/get-current-version.js +35 -0
- package/dist/process/get-next-version.d.ts +21 -0
- package/dist/process/get-next-version.js +72 -0
- package/dist/process/tag.d.ts +8 -0
- package/dist/process/tag.js +15 -0
- package/dist/services/git.d.ts +141 -0
- package/dist/services/git.js +236 -0
- package/dist/services/logger.d.ts +18 -0
- package/dist/services/logger.js +35 -0
- package/dist/utils/clean-tag.js +21 -0
- package/dist/utils/escape-regex.js +17 -0
- package/dist/utils/file-state.js +19 -0
- package/dist/utils/format-commit-message.js +13 -0
- package/dist/utils/parse-regexp-string.js +31 -0
- package/dist/utils/release-type.js +47 -0
- package/dist/utils/trim-string-array.js +20 -0
- package/package.json +11 -29
- package/dist/chunk-33WIJWQZ.cjs +0 -2306
- package/dist/chunk-33WIJWQZ.cjs.map +0 -1
- package/dist/chunk-L5UDUEHE.js +0 -2262
- package/dist/chunk-L5UDUEHE.js.map +0 -1
- package/dist/cli.cjs +0 -205
- package/dist/cli.cjs.map +0 -1
- package/dist/cli.d.cts +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/index.cjs +0 -80
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -655
- package/dist/index.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,655 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
dryRun: z.ZodBoolean;
|
|
23
|
-
silent: z.ZodBoolean;
|
|
24
|
-
gitTagFallback: z.ZodBoolean;
|
|
25
|
-
sign: z.ZodBoolean;
|
|
26
|
-
verify: z.ZodBoolean;
|
|
27
|
-
asJson: z.ZodBoolean;
|
|
28
|
-
skipBump: z.ZodBoolean;
|
|
29
|
-
skipChangelog: z.ZodBoolean;
|
|
30
|
-
skipCommit: z.ZodBoolean;
|
|
31
|
-
skipTag: z.ZodBoolean;
|
|
32
|
-
detectedGitHost: z.ZodOptional<z.ZodString>;
|
|
33
|
-
changelogPresetConfig: z.ZodOptional<z.ZodObject<{
|
|
34
|
-
types: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
35
|
-
type: z.ZodString;
|
|
36
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
37
|
-
section: z.ZodOptional<z.ZodString>;
|
|
38
|
-
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
-
}, z.core.$strip>>>;
|
|
40
|
-
commitUrlFormat: z.ZodOptional<z.ZodString>;
|
|
41
|
-
compareUrlFormat: z.ZodOptional<z.ZodString>;
|
|
42
|
-
issueUrlFormat: z.ZodOptional<z.ZodString>;
|
|
43
|
-
userUrlFormat: z.ZodOptional<z.ZodString>;
|
|
44
|
-
releaseCommitMessageFormat: z.ZodOptional<z.ZodString>;
|
|
45
|
-
issuePrefixes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
46
|
-
}, z.core.$strip>>;
|
|
47
|
-
releaseMessageSuffix: z.ZodOptional<z.ZodString>;
|
|
48
|
-
commitParserOptions: z.ZodOptional<z.ZodObject<z.core.$ZodLooseShape, z.core.$loose>>;
|
|
49
|
-
}, z.core.$strip>;
|
|
50
|
-
|
|
51
|
-
declare function getCliArguments(): meow.Result<{
|
|
52
|
-
/** @deprecated Set the `inspect-version` command instead. */
|
|
53
|
-
inspectVersion: {
|
|
54
|
-
type: "boolean";
|
|
55
|
-
};
|
|
56
|
-
files: {
|
|
57
|
-
type: "string";
|
|
58
|
-
isMultiple: true;
|
|
59
|
-
aliases: string[];
|
|
60
|
-
shortFlag: string;
|
|
61
|
-
};
|
|
62
|
-
glob: {
|
|
63
|
-
type: "string";
|
|
64
|
-
shortFlag: string;
|
|
65
|
-
};
|
|
66
|
-
path: {
|
|
67
|
-
type: "string";
|
|
68
|
-
shortFlag: string;
|
|
69
|
-
};
|
|
70
|
-
changelog: {
|
|
71
|
-
type: "string";
|
|
72
|
-
};
|
|
73
|
-
header: {
|
|
74
|
-
type: "string";
|
|
75
|
-
};
|
|
76
|
-
tagPrefix: {
|
|
77
|
-
type: "string";
|
|
78
|
-
};
|
|
79
|
-
preRelease: {
|
|
80
|
-
type: "boolean";
|
|
81
|
-
};
|
|
82
|
-
preReleaseTag: {
|
|
83
|
-
type: "string";
|
|
84
|
-
};
|
|
85
|
-
currentVersion: {
|
|
86
|
-
type: "string";
|
|
87
|
-
};
|
|
88
|
-
nextVersion: {
|
|
89
|
-
type: "string";
|
|
90
|
-
};
|
|
91
|
-
releaseAs: {
|
|
92
|
-
type: "string";
|
|
93
|
-
choices: string[];
|
|
94
|
-
};
|
|
95
|
-
allowMultipleVersions: {
|
|
96
|
-
type: "boolean";
|
|
97
|
-
};
|
|
98
|
-
commitAll: {
|
|
99
|
-
type: "boolean";
|
|
100
|
-
};
|
|
101
|
-
changelogAll: {
|
|
102
|
-
type: "boolean";
|
|
103
|
-
};
|
|
104
|
-
debug: {
|
|
105
|
-
type: "boolean";
|
|
106
|
-
};
|
|
107
|
-
dryRun: {
|
|
108
|
-
type: "boolean";
|
|
109
|
-
};
|
|
110
|
-
silent: {
|
|
111
|
-
type: "boolean";
|
|
112
|
-
};
|
|
113
|
-
gitTagFallback: {
|
|
114
|
-
type: "boolean";
|
|
115
|
-
};
|
|
116
|
-
sign: {
|
|
117
|
-
type: "boolean";
|
|
118
|
-
};
|
|
119
|
-
verify: {
|
|
120
|
-
type: "boolean";
|
|
121
|
-
};
|
|
122
|
-
asJson: {
|
|
123
|
-
type: "boolean";
|
|
124
|
-
};
|
|
125
|
-
skipBump: {
|
|
126
|
-
type: "boolean";
|
|
127
|
-
};
|
|
128
|
-
skipChangelog: {
|
|
129
|
-
type: "boolean";
|
|
130
|
-
};
|
|
131
|
-
skipCommit: {
|
|
132
|
-
type: "boolean";
|
|
133
|
-
};
|
|
134
|
-
skipTag: {
|
|
135
|
-
type: "boolean";
|
|
136
|
-
};
|
|
137
|
-
commitUrlFormat: {
|
|
138
|
-
type: "string";
|
|
139
|
-
};
|
|
140
|
-
compareUrlFormat: {
|
|
141
|
-
type: "string";
|
|
142
|
-
};
|
|
143
|
-
issueUrlFormat: {
|
|
144
|
-
type: "string";
|
|
145
|
-
};
|
|
146
|
-
userUrlFormat: {
|
|
147
|
-
type: "string";
|
|
148
|
-
};
|
|
149
|
-
releaseCommitMessageFormat: {
|
|
150
|
-
type: "string";
|
|
151
|
-
};
|
|
152
|
-
releaseMessageSuffix: {
|
|
153
|
-
type: "string";
|
|
154
|
-
};
|
|
155
|
-
}>;
|
|
156
|
-
|
|
157
|
-
interface ParserOptions {
|
|
158
|
-
/**
|
|
159
|
-
* Pattern to match commit subjects
|
|
160
|
-
* - Expected capture groups: `type` `title`
|
|
161
|
-
* - Optional capture groups: `scope`, `breakingChange`
|
|
162
|
-
*/
|
|
163
|
-
subjectPattern: RegExp | undefined;
|
|
164
|
-
/**
|
|
165
|
-
* Pattern to match merge commits
|
|
166
|
-
* - Expected capture groups: `id`, `source`
|
|
167
|
-
*/
|
|
168
|
-
mergePattern: RegExp | undefined;
|
|
169
|
-
/**
|
|
170
|
-
* Pattern to match revert commits
|
|
171
|
-
* - Expected capture groups: `subject`, `hash`
|
|
172
|
-
*/
|
|
173
|
-
revertPattern: RegExp | undefined;
|
|
174
|
-
/**
|
|
175
|
-
* Pattern to match commented out lines which will be trimmed
|
|
176
|
-
*/
|
|
177
|
-
commentPattern: RegExp | undefined;
|
|
178
|
-
/**
|
|
179
|
-
* Pattern to match mentions
|
|
180
|
-
* - Expected capture groups: `username`
|
|
181
|
-
*/
|
|
182
|
-
mentionPattern: RegExp | undefined;
|
|
183
|
-
/**
|
|
184
|
-
* List of action labels to match reference sections
|
|
185
|
-
* @default
|
|
186
|
-
* ["close", "closes", "closed", "fix", "fixes", "fixed", "resolve", "resolves", "resolved"]
|
|
187
|
-
*/
|
|
188
|
-
referenceActions?: string[];
|
|
189
|
-
/**
|
|
190
|
-
* Pattern to match reference sections
|
|
191
|
-
* - Expected capture groups: `action`, `reference`
|
|
192
|
-
*/
|
|
193
|
-
referenceActionPattern: RegExp | undefined;
|
|
194
|
-
/**
|
|
195
|
-
* List of issue prefixes to match issue ids
|
|
196
|
-
* @default
|
|
197
|
-
* ["#"]
|
|
198
|
-
*/
|
|
199
|
-
issuePrefixes?: string[];
|
|
200
|
-
/**
|
|
201
|
-
* Pattern to match issue references
|
|
202
|
-
* - Expected capture groups: `repository`, `prefix`, `issue`
|
|
203
|
-
*/
|
|
204
|
-
issuePattern: RegExp | undefined;
|
|
205
|
-
/**
|
|
206
|
-
* List of keywords to match note titles
|
|
207
|
-
* @default
|
|
208
|
-
* ["BREAKING CHANGE", "BREAKING-CHANGE"]
|
|
209
|
-
*/
|
|
210
|
-
noteKeywords?: string[];
|
|
211
|
-
/**
|
|
212
|
-
* Pattern to match note sections
|
|
213
|
-
* - Expected capture groups: `title`
|
|
214
|
-
* - Optional capture groups: `text`
|
|
215
|
-
*/
|
|
216
|
-
notePattern: RegExp | undefined;
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Creates parser options by merging user-provided options with default values.
|
|
220
|
-
*
|
|
221
|
-
* Additionally, if a user provides a string for a property that expects a RegExp value,
|
|
222
|
-
* the function will attempt to parse it into a RegExp object.
|
|
223
|
-
*
|
|
224
|
-
* @param userOptions Optional user-provided options to override the defaults.
|
|
225
|
-
* @return A complete set of parser options with defaults applied and user overrides where specified.
|
|
226
|
-
*/
|
|
227
|
-
declare function createParserOptions(userOptions?: Partial<ParserOptions>): ParserOptions;
|
|
228
|
-
|
|
229
|
-
type ForkConfig = z.infer<typeof ForkConfigSchema> & {
|
|
230
|
-
commitParserOptions?: Partial<ParserOptions>;
|
|
231
|
-
};
|
|
232
|
-
type Config = Partial<ForkConfig>;
|
|
233
|
-
type CLIArguments = ReturnType<typeof getCliArguments>;
|
|
234
|
-
interface ForkVersionCLIArgs {
|
|
235
|
-
input: CLIArguments["input"];
|
|
236
|
-
flags: Partial<CLIArguments["flags"]>;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
interface LoggerConfig {
|
|
240
|
-
silent?: ForkConfig["silent"];
|
|
241
|
-
debug?: ForkConfig["debug"];
|
|
242
|
-
}
|
|
243
|
-
declare class Logger {
|
|
244
|
-
#private;
|
|
245
|
-
constructor(config: LoggerConfig);
|
|
246
|
-
log(message: string): void;
|
|
247
|
-
warn(message: string): void;
|
|
248
|
-
error(message: string): void;
|
|
249
|
-
debug(message: string, ...optionalParams: any[]): void;
|
|
250
|
-
skipping(message: string): void;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
interface FileState {
|
|
254
|
-
name: string;
|
|
255
|
-
path: string;
|
|
256
|
-
version: string;
|
|
257
|
-
[other: string]: unknown;
|
|
258
|
-
}
|
|
259
|
-
interface IFileManager {
|
|
260
|
-
read(fileName: string): FileState | undefined;
|
|
261
|
-
write(fileState: FileState, newVersion: string): void;
|
|
262
|
-
isSupportedFile(fileName: string): boolean;
|
|
263
|
-
}
|
|
264
|
-
declare class FileManager {
|
|
265
|
-
#private;
|
|
266
|
-
constructor(config: ForkConfig, logger: Logger);
|
|
267
|
-
/**
|
|
268
|
-
* Get the state from the given file name.
|
|
269
|
-
*
|
|
270
|
-
* @example
|
|
271
|
-
* ```ts
|
|
272
|
-
* fileManager.read("package.json");
|
|
273
|
-
* ```
|
|
274
|
-
*
|
|
275
|
-
* @returns
|
|
276
|
-
* ```json
|
|
277
|
-
* { "name": "package.json", "path": "/path/to/package.json", "version": "1.2.3", "isPrivate": true }
|
|
278
|
-
* ```
|
|
279
|
-
*/
|
|
280
|
-
read(pathOrName: string): FileState | undefined;
|
|
281
|
-
/**
|
|
282
|
-
* Write the new version to the given file.
|
|
283
|
-
*
|
|
284
|
-
* @example
|
|
285
|
-
* ```ts
|
|
286
|
-
* fileManager.write(
|
|
287
|
-
* { name: "package.json", path: "/path/to/package.json", version: "1.2.2" },
|
|
288
|
-
* "1.2.3"
|
|
289
|
-
* );
|
|
290
|
-
* ```
|
|
291
|
-
*/
|
|
292
|
-
write(fileState: FileState, newVersion: string): void;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
interface GitConfig {
|
|
296
|
-
path: ForkConfig["path"];
|
|
297
|
-
dryRun?: ForkConfig["dryRun"];
|
|
298
|
-
}
|
|
299
|
-
declare class Git {
|
|
300
|
-
#private;
|
|
301
|
-
constructor(config: GitConfig);
|
|
302
|
-
/**
|
|
303
|
-
* Add file contents to the index
|
|
304
|
-
*
|
|
305
|
-
* [git-add Documentation](https://git-scm.com/docs/git-add)
|
|
306
|
-
*
|
|
307
|
-
* @example
|
|
308
|
-
* ```ts
|
|
309
|
-
* await git.add("CHANGELOG.md");
|
|
310
|
-
* ```
|
|
311
|
-
*/
|
|
312
|
-
add(...args: (string | undefined)[]): Promise<string>;
|
|
313
|
-
/**
|
|
314
|
-
* Record changes to the repository
|
|
315
|
-
*
|
|
316
|
-
* [git-commit Documentation](https://git-scm.com/docs/git-commit)
|
|
317
|
-
*
|
|
318
|
-
* @example
|
|
319
|
-
* ```ts
|
|
320
|
-
* await git.commit("--message", "chore(release): 1.2.3");
|
|
321
|
-
* ```
|
|
322
|
-
*/
|
|
323
|
-
commit(...args: (string | undefined)[]): Promise<string>;
|
|
324
|
-
/**
|
|
325
|
-
* Create, list, delete or verify a tag object
|
|
326
|
-
*
|
|
327
|
-
* [git-tag Documentation](https://git-scm.com/docs/git-tag)
|
|
328
|
-
*
|
|
329
|
-
* @example
|
|
330
|
-
* ```ts
|
|
331
|
-
* await git.tag("--annotate", "v1.2.3", "--message", "chore(release): 1.2.3");
|
|
332
|
-
* ```
|
|
333
|
-
*/
|
|
334
|
-
tag(...args: (string | undefined)[]): Promise<string>;
|
|
335
|
-
/**
|
|
336
|
-
* Show commit logs
|
|
337
|
-
*
|
|
338
|
-
* - [git-log Documentation](https://git-scm.com/docs/git-log)
|
|
339
|
-
* - [pretty-formats Documentation](https://git-scm.com/docs/pretty-formats)
|
|
340
|
-
*
|
|
341
|
-
* @example
|
|
342
|
-
* ```ts
|
|
343
|
-
* await git.log("--oneline");
|
|
344
|
-
* ```
|
|
345
|
-
*/
|
|
346
|
-
log(...args: (string | undefined)[]): Promise<string>;
|
|
347
|
-
/**
|
|
348
|
-
* Check if a file is ignored by git
|
|
349
|
-
*
|
|
350
|
-
* [git-check-ignore Documentation](https://git-scm.com/docs/git-check-ignore)
|
|
351
|
-
*
|
|
352
|
-
* @example
|
|
353
|
-
* ```ts
|
|
354
|
-
* await git.isIgnored("src/my-file.txt");
|
|
355
|
-
* ```
|
|
356
|
-
*/
|
|
357
|
-
isIgnored(file: string): Promise<boolean>;
|
|
358
|
-
/**
|
|
359
|
-
* Get the name of the current branch
|
|
360
|
-
*
|
|
361
|
-
* [git-rev-parse Documentation](https://git-scm.com/docs/git-rev-parse)
|
|
362
|
-
*
|
|
363
|
-
* @example
|
|
364
|
-
* ```ts
|
|
365
|
-
* await git.getBranchName(); // "main"
|
|
366
|
-
* ```
|
|
367
|
-
*/
|
|
368
|
-
getBranchName(): Promise<string>;
|
|
369
|
-
/**
|
|
370
|
-
* Get the URL of the remote repository
|
|
371
|
-
*
|
|
372
|
-
* [git-config Documentation](https://git-scm.com/docs/git-config)
|
|
373
|
-
*
|
|
374
|
-
* @example
|
|
375
|
-
* ```ts
|
|
376
|
-
* await git.getRemoteUrl(); // "https://github.com/eglavin/fork-version"
|
|
377
|
-
* ```
|
|
378
|
-
*/
|
|
379
|
-
getRemoteUrl(): Promise<string>;
|
|
380
|
-
/**
|
|
381
|
-
* `getTags` returns valid semver version tags in order of the commit history
|
|
382
|
-
*
|
|
383
|
-
* Using `git log` to get the commit history, we then parse the tags from the
|
|
384
|
-
* commit details which is expected to be in the following format:
|
|
385
|
-
* ```txt
|
|
386
|
-
* commit 3841b1d05750d42197fe958e3d8e06df378a842d (HEAD -> main, tag: v1.0.2, tag: v1.0.1, tag: v1.0.0)
|
|
387
|
-
* Author: Username <username@example.com>
|
|
388
|
-
* Date: Sat Nov 9 15:00:00 2024 +0000
|
|
389
|
-
*
|
|
390
|
-
* chore(release): v1.0.0
|
|
391
|
-
* ```
|
|
392
|
-
*
|
|
393
|
-
* - [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)
|
|
394
|
-
* - [conventional-changelog git-semver-tags MIT Licence](https://github.com/conventional-changelog/conventional-changelog/blob/fac8045242099c016f5f3905e54e02b7d466bd7b/packages/git-semver-tags/LICENSE.md)
|
|
395
|
-
*
|
|
396
|
-
* @example
|
|
397
|
-
* ```ts
|
|
398
|
-
* await git.getTags("v"); // ["v1.0.2", "v1.0.1", "v1.0.0"]
|
|
399
|
-
* ```
|
|
400
|
-
*/
|
|
401
|
-
getTags(tagPrefix: string | undefined): Promise<string[]>;
|
|
402
|
-
/**
|
|
403
|
-
* Returns the most recent tag from the commit history, or `undefined` if no valid semver tags are found
|
|
404
|
-
*
|
|
405
|
-
* @example
|
|
406
|
-
* ```ts
|
|
407
|
-
* await git.getMostRecentTag("v"); // "1.2.3"
|
|
408
|
-
* ```
|
|
409
|
-
*/
|
|
410
|
-
getMostRecentTag(tagPrefix: string | undefined): Promise<string | undefined>;
|
|
411
|
-
/**
|
|
412
|
-
* Get commit history in a parsable format
|
|
413
|
-
*
|
|
414
|
-
* An array of strings with commit details is returned in the following format:
|
|
415
|
-
* ```txt
|
|
416
|
-
* subject
|
|
417
|
-
* body
|
|
418
|
-
* hash
|
|
419
|
-
* committer date
|
|
420
|
-
* committer name
|
|
421
|
-
* committer email
|
|
422
|
-
* ```
|
|
423
|
-
*
|
|
424
|
-
* @example
|
|
425
|
-
* ```ts
|
|
426
|
-
* await git.getCommits("v1.0.0", "HEAD", "src/utils");
|
|
427
|
-
* ```
|
|
428
|
-
*/
|
|
429
|
-
getCommits(from?: string, to?: string, ...paths: string[]): Promise<string[]>;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
declare function inspect(config: ForkConfig, logger: Logger, fileManager: FileManager, git: Git): Promise<void>;
|
|
433
|
-
|
|
434
|
-
interface CommitMerge {
|
|
435
|
-
id: string;
|
|
436
|
-
source: string;
|
|
437
|
-
}
|
|
438
|
-
interface CommitRevert {
|
|
439
|
-
hash: string;
|
|
440
|
-
subject: string;
|
|
441
|
-
}
|
|
442
|
-
interface CommitReference {
|
|
443
|
-
prefix: string;
|
|
444
|
-
issue: string;
|
|
445
|
-
action: string | null;
|
|
446
|
-
owner: string | null;
|
|
447
|
-
repository: string | null;
|
|
448
|
-
}
|
|
449
|
-
interface CommitNote {
|
|
450
|
-
title: string;
|
|
451
|
-
text: string;
|
|
452
|
-
}
|
|
453
|
-
interface Commit {
|
|
454
|
-
raw: string;
|
|
455
|
-
subject: string;
|
|
456
|
-
body: string;
|
|
457
|
-
hash: string;
|
|
458
|
-
refNames: string;
|
|
459
|
-
/**
|
|
460
|
-
* Committer date in ISO 8601 format
|
|
461
|
-
* @example
|
|
462
|
-
* "2024-12-22T17:36:50Z"
|
|
463
|
-
*/
|
|
464
|
-
date: string;
|
|
465
|
-
/**
|
|
466
|
-
* Committer name (respects .mailmap)
|
|
467
|
-
*/
|
|
468
|
-
name: string;
|
|
469
|
-
/**
|
|
470
|
-
* Committer email (respects .mailmap)
|
|
471
|
-
*/
|
|
472
|
-
email: string;
|
|
473
|
-
type: string;
|
|
474
|
-
scope: string;
|
|
475
|
-
breakingChange: string;
|
|
476
|
-
title: string;
|
|
477
|
-
merge: CommitMerge | null;
|
|
478
|
-
revert: CommitRevert | null;
|
|
479
|
-
mentions: string[];
|
|
480
|
-
references: CommitReference[];
|
|
481
|
-
notes: CommitNote[];
|
|
482
|
-
tags: string[];
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
interface NextVersion {
|
|
486
|
-
version: string;
|
|
487
|
-
releaseType?: ReleaseType;
|
|
488
|
-
preMajor?: boolean;
|
|
489
|
-
changes?: {
|
|
490
|
-
major: number;
|
|
491
|
-
minor: number;
|
|
492
|
-
patch: number;
|
|
493
|
-
merges: number;
|
|
494
|
-
reverts: number;
|
|
495
|
-
};
|
|
496
|
-
}
|
|
497
|
-
declare function getNextVersion(config: ForkConfig, logger: Logger, commits: Commit[], currentVersion: string): Promise<NextVersion>;
|
|
498
|
-
|
|
499
|
-
interface CurrentVersion {
|
|
500
|
-
version: string;
|
|
501
|
-
files: FileState[];
|
|
502
|
-
}
|
|
503
|
-
declare function getCurrentVersion(config: ForkConfig, logger: Logger, git: Git, fileManager: FileManager, filesToUpdate: string[], latestTagVersion: string | undefined): Promise<CurrentVersion>;
|
|
504
|
-
|
|
505
|
-
interface CommitsSinceTag {
|
|
506
|
-
latestTag: string | undefined;
|
|
507
|
-
latestTagVersion: string | undefined;
|
|
508
|
-
commits: Commit[];
|
|
509
|
-
}
|
|
510
|
-
declare function getCommitsSinceTag(config: ForkConfig, logger: Logger, git: Git): Promise<CommitsSinceTag>;
|
|
511
|
-
|
|
512
|
-
declare function main(config: ForkConfig, logger: Logger, fileManager: FileManager, git: Git): Promise<{
|
|
513
|
-
config: ForkConfig;
|
|
514
|
-
commits: CommitsSinceTag;
|
|
515
|
-
current: CurrentVersion;
|
|
516
|
-
next: NextVersion;
|
|
517
|
-
}>;
|
|
518
|
-
|
|
519
|
-
declare function validateConfig(config: ForkConfig): void;
|
|
520
|
-
|
|
521
|
-
declare class CommitParser {
|
|
522
|
-
#private;
|
|
523
|
-
constructor(userOptions?: Partial<ParserOptions>);
|
|
524
|
-
setLogger(logger: Logger): this;
|
|
525
|
-
createCommit(): Commit;
|
|
526
|
-
/**
|
|
527
|
-
* Parse the raw commit message into its expected parts
|
|
528
|
-
* - subject
|
|
529
|
-
* - body
|
|
530
|
-
* - hash
|
|
531
|
-
* - date
|
|
532
|
-
* - name
|
|
533
|
-
* - email
|
|
534
|
-
*
|
|
535
|
-
* @throws {ParserError}
|
|
536
|
-
*/
|
|
537
|
-
parseRawCommit(rawCommit: string): Commit;
|
|
538
|
-
/**
|
|
539
|
-
* Parse the commit subject into its expected parts
|
|
540
|
-
* - type
|
|
541
|
-
* - scope (optional)
|
|
542
|
-
* - breaking change (optional)
|
|
543
|
-
* - title
|
|
544
|
-
*
|
|
545
|
-
* @throws {ParserError}
|
|
546
|
-
*/
|
|
547
|
-
parseSubject(commit: Commit): boolean;
|
|
548
|
-
/**
|
|
549
|
-
* Parse merge information from the commit subject
|
|
550
|
-
* @example
|
|
551
|
-
* ```txt
|
|
552
|
-
* "Merge pull request #123 from fork-version/feature"
|
|
553
|
-
* ```
|
|
554
|
-
*/
|
|
555
|
-
parseMerge(commit: Commit): boolean;
|
|
556
|
-
/**
|
|
557
|
-
* Parse revert information from the commit body
|
|
558
|
-
* @example
|
|
559
|
-
* ```txt
|
|
560
|
-
* "Revert "feat: initial commit"
|
|
561
|
-
*
|
|
562
|
-
* This reverts commit 4a79e9e546b4020d2882b7810dc549fa71960f4f."
|
|
563
|
-
* ```
|
|
564
|
-
*/
|
|
565
|
-
parseRevert(commit: Commit): boolean;
|
|
566
|
-
/**
|
|
567
|
-
* Search for mentions from the commit line
|
|
568
|
-
* @example
|
|
569
|
-
* ```txt
|
|
570
|
-
* "@fork-version"
|
|
571
|
-
* ```
|
|
572
|
-
*/
|
|
573
|
-
parseMentions(line: string, outMentions: Set<string>): boolean;
|
|
574
|
-
/**
|
|
575
|
-
* Search for references from the commit line
|
|
576
|
-
* @example
|
|
577
|
-
* ```txt
|
|
578
|
-
* "#1234"
|
|
579
|
-
* "owner/repo#1234"
|
|
580
|
-
* ```
|
|
581
|
-
*/
|
|
582
|
-
parseReferenceParts(referenceText: string, action: string | null): CommitReference[] | undefined;
|
|
583
|
-
/**
|
|
584
|
-
* Search for actions and references from the commit line
|
|
585
|
-
* @example
|
|
586
|
-
* ```txt
|
|
587
|
-
* "Closes #1234"
|
|
588
|
-
* "fixes owner/repo#1234"
|
|
589
|
-
* ```
|
|
590
|
-
*/
|
|
591
|
-
parseReferences(line: string, outReferences: CommitReference[]): boolean;
|
|
592
|
-
/**
|
|
593
|
-
* Search for notes from the commit line
|
|
594
|
-
* @example
|
|
595
|
-
* ```txt
|
|
596
|
-
* "BREAKING CHANGE: this is a breaking change"
|
|
597
|
-
* ```
|
|
598
|
-
*/
|
|
599
|
-
parseNotes(line: string, outNotes: CommitNote[]): boolean;
|
|
600
|
-
/**
|
|
601
|
-
* Parse the raw commit for mentions, references and notes
|
|
602
|
-
*/
|
|
603
|
-
parseRawLines(commit: Commit): void;
|
|
604
|
-
/**
|
|
605
|
-
* Parse a commit log with the following format separated by new line characters:
|
|
606
|
-
* ```txt
|
|
607
|
-
* refactor: add test file
|
|
608
|
-
* Add a test file to the project
|
|
609
|
-
* 4ef2c86d393a9660aa9f753144256b1f200c16bd
|
|
610
|
-
* 2024-12-22T17:36:50Z
|
|
611
|
-
* Fork Version
|
|
612
|
-
* fork-version@example.com
|
|
613
|
-
* ```
|
|
614
|
-
*
|
|
615
|
-
* @example
|
|
616
|
-
* ```ts
|
|
617
|
-
* parse("refactor: add test file\nAdd a test file to the project\n4ef2c86d393a9660aa9f753144256b1f200c16bd\n2024-12-22T17:36:50Z\nFork Version\nfork-version@example.com");
|
|
618
|
-
* ```
|
|
619
|
-
*
|
|
620
|
-
* The expected input value can be generated by running the following command:
|
|
621
|
-
* ```sh
|
|
622
|
-
* git log --format="%s%n%b%n%H%n%cI%n%cN%n%cE%n"
|
|
623
|
-
* ```
|
|
624
|
-
* @see {@link https://git-scm.com/docs/pretty-formats|Git Pretty Format Documentation}
|
|
625
|
-
*/
|
|
626
|
-
parse(rawCommit: string): Commit | undefined;
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
/**
|
|
630
|
-
* Filter out revert commits and their corresponding reverted commits,
|
|
631
|
-
* this function expects the input to be sorted by date in descending order
|
|
632
|
-
* from the most recent to the oldest commit.
|
|
633
|
-
*
|
|
634
|
-
* @example
|
|
635
|
-
* ```ts
|
|
636
|
-
* const commits: Commit[] = [...];
|
|
637
|
-
* const filteredCommits = filterRevertedCommits(commits);
|
|
638
|
-
* ```
|
|
639
|
-
*/
|
|
640
|
-
declare function filterRevertedCommits(parsedCommits: Commit[]): Commit[];
|
|
641
|
-
|
|
642
|
-
/**
|
|
643
|
-
* [Fork-Version - Config Properties](https://github.com/eglavin/fork-version/blob/main/README.md#config-properties)
|
|
644
|
-
*/
|
|
645
|
-
declare function defineConfig(config: Config): Config;
|
|
646
|
-
|
|
647
|
-
declare function getUserConfig(cliArguments: ForkVersionCLIArgs): Promise<ForkConfig>;
|
|
648
|
-
|
|
649
|
-
declare function updateChangelog(config: ForkConfig, logger: Logger, nextVersion: string): Promise<void>;
|
|
650
|
-
|
|
651
|
-
declare function commitChanges(config: ForkConfig, logger: Logger, git: Git, files: FileState[], nextVersion: string): Promise<void>;
|
|
652
|
-
|
|
653
|
-
declare function tagChanges(config: ForkConfig, logger: Logger, git: Git, nextVersion: string): Promise<void>;
|
|
654
|
-
|
|
655
|
-
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, inspect, main, tagChanges, updateChangelog, validateConfig };
|
|
1
|
+
import { ParserOptions, createParserOptions } from "./commit-parser/options.js";
|
|
2
|
+
import { ChangelogPresetConfig, ChangelogPresetConfigType, Config, ForkConfig } from "./config/types.js";
|
|
3
|
+
import { Logger } from "./services/logger.js";
|
|
4
|
+
import { FileManager, FileState, IFileManager, MissingPropertyException } from "./files/file-manager.js";
|
|
5
|
+
import { Git } from "./services/git.js";
|
|
6
|
+
import { inspect } from "./commands/inspect.js";
|
|
7
|
+
import { main } from "./commands/main.js";
|
|
8
|
+
import { validateConfig } from "./commands/validate-config.js";
|
|
9
|
+
import { Commit, CommitMerge, CommitNote, CommitReference, CommitRevert } from "./commit-parser/types.js";
|
|
10
|
+
import { CommitParser } from "./commit-parser/commit-parser.js";
|
|
11
|
+
import { filterRevertedCommits } from "./commit-parser/filter-reverted-commits.js";
|
|
12
|
+
import { ForkConfigSchema } from "./config/schema.js";
|
|
13
|
+
import { defineConfig } from "./config/define-config.js";
|
|
14
|
+
import { getUserConfig } from "./config/user-config.js";
|
|
15
|
+
import { CommitsSinceTag, getCommitsSinceTag } from "./process/get-commits.js";
|
|
16
|
+
import { CurrentVersion, getCurrentVersion } from "./process/get-current-version.js";
|
|
17
|
+
import { NextVersion, getNextVersion } from "./process/get-next-version.js";
|
|
18
|
+
import { updateChangelog } from "./process/changelog.js";
|
|
19
|
+
import { commitChanges } from "./process/commit.js";
|
|
20
|
+
import { tagChanges } from "./process/tag.js";
|
|
21
|
+
export { type ChangelogPresetConfig, type ChangelogPresetConfigType, 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, MissingPropertyException, type NextVersion, type ParserOptions, commitChanges, createParserOptions, defineConfig, filterRevertedCommits, getCommitsSinceTag, getCurrentVersion, getNextVersion, getUserConfig, inspect, main, tagChanges, updateChangelog, validateConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { createParserOptions } from "./commit-parser/options.js";
|
|
2
|
+
import { CommitParser } from "./commit-parser/commit-parser.js";
|
|
3
|
+
import { filterRevertedCommits } from "./commit-parser/filter-reverted-commits.js";
|
|
4
|
+
import { getCommitsSinceTag } from "./process/get-commits.js";
|
|
5
|
+
import { getCurrentVersion } from "./process/get-current-version.js";
|
|
6
|
+
import { inspect } from "./commands/inspect.js";
|
|
7
|
+
import { getNextVersion } from "./process/get-next-version.js";
|
|
8
|
+
import { updateChangelog } from "./process/changelog.js";
|
|
9
|
+
import { commitChanges } from "./process/commit.js";
|
|
10
|
+
import { tagChanges } from "./process/tag.js";
|
|
11
|
+
import { main } from "./commands/main.js";
|
|
12
|
+
import { validateConfig } from "./commands/validate-config.js";
|
|
13
|
+
import { ForkConfigSchema } from "./config/schema.js";
|
|
14
|
+
import { defineConfig } from "./config/define-config.js";
|
|
15
|
+
import { Git } from "./services/git.js";
|
|
16
|
+
import { getUserConfig } from "./config/user-config.js";
|
|
17
|
+
import { FileManager, MissingPropertyException } from "./files/file-manager.js";
|
|
18
|
+
import { Logger } from "./services/logger.js";
|
|
19
|
+
export { CommitParser, FileManager, ForkConfigSchema, Git, Logger, MissingPropertyException, commitChanges, createParserOptions, defineConfig, filterRevertedCommits, getCommitsSinceTag, getCurrentVersion, getNextVersion, getUserConfig, inspect, main, tagChanges, updateChangelog, validateConfig };
|