import ChangelogData from "#tasks/changelog/changelogData.ts"; export interface Commit { hash: string; date: string; message: string; refs: string; body: string; author_name: string; author_email: string; priority?: number; } /** * A Changelog Category. */ export interface Category { /** * Commit Key: The key used in the commit's body. *
* Optional. If not set, then commits cannot be added to this category during the parse commit task. * Can still be added manually. */ commitKey?: string; /** * Key Name: The title of this Category in the changelog. *
* Can be set to "" to have no title. */ categoryName: string; /** * Changelog Section: The changelog section map that the key should push to. *
* Will be initialized later, if put into categoryKeys.
*/
changelogSection?: Map
* Should be a Sub Category added to subCategoryKeys, as otherwise the category would not appear in the changelog.
*
* This can also be done with a SubCategoryKey placed at the end, with the commitKey set to `""`.
* However, this is useful for places where the Default Sub Category should not be at the end.
*
* This is also needed for certain parsing operations.
*/
defaultSubCategory: SubCategory;
/**
* Sub Category Keys: The list of sub-category keys.
*
* Commits being added can only be in one sub-category, and the priority will be in the order provided.
* Furthermore, the order provided will also be the order the commits appear in.
*
* The last item on this list should have the `commitKey` set to "", to allow any commits not put into previous sub categories in, otherwise they would be ignored.
* However, this can also be done by setting the defaultSubCategory.
*/
subCategories: SubCategory[];
}
/**
* A Sub Category.
*/
export interface SubCategory {
/**
* Commit Key: The key used in the commit's body.
*
* This can be set to "" to allow any commit in.
*
* Optional. If not set, then no commit will be allowed in during the parse commit task.
* Can still be added to by DefaultSubCategory, or manually.
*/
commitKey?: string;
/**
* Key Name: The key to be used in the changelogSection. Also will be the title of this subCategory in the changelog.
*
* Can be set to "" to have no title.
*/
keyName: string;
}
/**
* A Changelog Message Object.
*/
export interface ChangelogMessage {
/**
* Commit Message
*/
commitMessage: string;
/**
* Commit Object
*
* Provides the Commit SHA, the Commit Author, and the Commit Date.
*/
commitObject?: Commit;
/**
* Sub Changelog Messages
*/
subChangelogMessages?: ChangelogMessage[];
/**
* Indentation
*
* Optional. Defaults to "".
*/
indentation?: string;
/**
* If this changelog message is special. This is special formatting for it.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
specialFormatting?: SpecialChangelogFormatting
* If skipped, then all further parsing for the commit will stop. This condition does not include commits which are in the sha list, they are automatically skipped.
*
* Expanded Commits from parseExpand go here too!
* commit: The commit object.
* commitMessage: The message of the commit.
* commitBody: The body of the commit. Might be undefined.
* return: True to skip, false to not.
*/
skipCallback: (
commit: Commit,
commitMessage: string,
commitBody?: string,
) => boolean;
/**
* Callback per item.
*
* Expanded Commits from parseExpand go here too!
* parser: This parser object, for convenience of use when calling parseCommitBody.
* commit: The commit object.
* commitMessage: The message of the commit.
* commitBody: The body of the commit. Might be undefined.
* fix: The fix, if it is not already applied. Usually undefined. Always undefined if applyFixCallback is unset.
* return: True if parsing was successful, false if not. Can return Ignored if commit was ignored (not skipped).
*/
itemCallback: (
parser: Parser,
commit: Commit,
commitMessage: string,
commitBody?: string,
fix?: FixUpInfo,
) => Promise
* Expanded Commits from parseExpand and parseDetails go here too!
* commit: The commit object.
* commitMessage: The message of the commit.
* commitBody: The body of the commit. Might be undefined.
* subMessages: Any sub-messages, coming from parseDetails. Might be undefined.
*/
leftOverCallback?: (
commit: Commit,
commitMessage: string,
commitBody?: string,
subMessages?: ChangelogMessage[],
) => void;
/**
* Callback to determine whether to add the sha of that commit into the sha list, forbidding further parsing of it.
*
* If not set, will just add SHA of every commit included in `dirs`.
* commit: The commit object.
* parsed: If parsing was successful. This is also true if the commit was skipped.
* return: True if to add sha, false if to not.
*/
addSHACallback?: (commit: Commit, parsed: boolean) => boolean;
/**
* Callback to determine whether or not the commit should be added to the commit list.
*
* commit: The commit to determine.
* parsed: If parsing was successful.
* return: True if to add, false if not.
*/
addCommitListCallback: (commit: Commit, parsed: boolean) => boolean;
/**
* Callback to determine whether fixes should be applied to this commit.
* Optional. If not provided, assumes yes.
*
* fix: The FixUpInfo Object.
* return: True if to fix, false if not.
*/
applyFixCalback?: (fix: FixUpInfo) => boolean;
}
export interface IgnoreInfo {
checks: Record