import { Category, Commit, IgnoreCheck, Ignored, IgnoreLogic, Parser, SubCategory } from "../../types/changelogTypes"; import { modpackManifest } from "../../globals"; import { parseCommitBody } from "./parser"; import { parseFixUp } from "./specialParser"; /* Values */ export const defaultIndentation = ""; export const indentationLevel = " "; /* Link to the repo, with a slash at the end. All URLs will be appended to this. */ export const repoLink = "https://github.com/Nomi-CEu/Nomi-CEu/"; /* Keys */ /* Special Handling Keys */ export const skipKey = "[SKIP]"; export const expandKey = "[EXPAND]"; export const expandList = "messages"; export const detailsKey = "[DETAILS]"; export const detailsList = "details"; export const detailsRoot = "detail"; export const noCategoryKey = "[NO CATEGORY]"; export const combineKey = "[COMBINE]"; export const combineList = "commits"; export const combineRoot = "commit"; export const fixUpKey = "[FIXUP]"; export const fixUpList = "fixes"; export const ignoreKey = "[IGNORE]"; export const modInfoKey = "[MOD INFO]"; export const modInfoList = "infos"; /* Sub Category Keys */ // Mode Category Keys const normalMode: SubCategory = { commitKey: "[NM]", keyName: "Normal Mode" }; const hardMode: SubCategory = { commitKey: "[HM]", keyName: "Hard Mode" }; /* Misc Sub Category Keys */ const qolChanges: SubCategory = { commitKey: "[QOL]", keyName: "Quality of Life" }; /* Set Sub Categories (Sub Categories that do not let any commit in) */ const bothModes: SubCategory = { keyName: "Both Modes" }; const modUpdates: SubCategory = { keyName: "Mod Updates" }; const modAdditions: SubCategory = { keyName: "Mod Additions" }; const modRemovals: SubCategory = { keyName: "Mod Removals" }; /* Default Sub Categories (Sub Categories that allow any commit in) */ const emptySubCategory: SubCategory = { commitKey: "", keyName: "" }; const other: SubCategory = { commitKey: "", keyName: "Other" }; /* Category Keys: */ const breakingCategory: Category = { commitKey: "[BREAKING]", categoryName: "Breaking Changes", defaultSubCategory: emptySubCategory, subCategories: [emptySubCategory], }; const balancingCategory: Category = { commitKey: "[BALANCING]", categoryName: "Balancing Changes", defaultSubCategory: bothModes, subCategories: [bothModes, normalMode, hardMode], }; const performanceCategory: Category = { commitKey: "[PERFORMANCE]", categoryName: "Performance Improvements", defaultSubCategory: emptySubCategory, subCategories: [emptySubCategory], }; const featureCategory: Category = { commitKey: "[FEATURE]", categoryName: "Feature Additions", defaultSubCategory: bothModes, subCategories: [qolChanges, bothModes, normalMode, hardMode], }; const questBookCategory: Category = { commitKey: "[QB]", categoryName: "Quest Book Changes", defaultSubCategory: bothModes, subCategories: [bothModes, normalMode, hardMode], }; const bugCategory: Category = { commitKey: "[BUG]", categoryName: "Bug Fixes", defaultSubCategory: bothModes, subCategories: [bothModes, normalMode, hardMode], }; const generalCategory: Category = { commitKey: "[GENERAL]", categoryName: "General Changes", defaultSubCategory: other, subCategories: [modUpdates, modAdditions, modRemovals, other], }; const internalCategory: Category = { commitKey: "[INTERNAL]", categoryName: "Internal Changes", defaultSubCategory: emptySubCategory, subCategories: [emptySubCategory], }; /** * Category List *
* The order that the categories appear here will be the order that they appear in the changelog, and their priority.
*/
export const categories: Category[] = [
breakingCategory,
balancingCategory,
performanceCategory,
featureCategory,
questBookCategory,
bugCategory,
generalCategory,
internalCategory,
];
/* Parsing Util Methods */
const defaultSkipCallback = (_commit: Commit, _commitMessage: string, commitBody: string): boolean => {
if (!commitBody) return false;
return commitBody.includes(skipKey);
};
const defaultParsingCallback = async (
parser: Parser,
commit: Commit,
commitMessage: string,
commitBody: string,
): Promise
* The order that the categories appear here will be the order that they are parsed in.
* Note that unless `addSHA` of the category is set to false, a commit parsed in a previous category will not be allowed to be parsed in future categories,
* even if they fit in the dirs.
*/
export const parsers: Parser[] = [fixupParsing, overridesParsing, manifestParsing, finalParsing];
/* Parsing Information / Allocations for Mod Changes */
export type ModChangesType = "added" | "removed" | "updated";
/**
* An Allocation for mod changes categories to grab from.
*/
export interface ModChangesAllocation {
/**
* Category to put in.
*/
category: Category;
/**
* Sub category of the category to put in.
*/
subCategory: SubCategory;
/**
* The template to use.
* Keys:
* `{{{ modName }}}` replaced by mod name,
* `{{{ oldVersion }}}` replaced by the old version (if applicable)
* `{{{ newVersion }}}` replaced by the new version (if applicable)
*/
template: string;
}
// These templates must be triple bracketed, because we don't want these to be html safe
export const modChangesAllocations: Record