Improves Fixup, Expand, Detail and Ignore Tags. Adds Priority Tag. A lot of git stuff below. [FIXUP] [[fixes]] sha = "2cfdcb10e2b2746ce7dc27b7864bd40c3005a638" newBody = ''' [EXPAND] [[messages]] messageBody = """ [IGNORE] checks = { compareBefore = "1.7-alpha-2" } # Only apply this if the commit being compared against is 1.7-alpha-2 or newer [IGNORE] [BREAKING] [DETAILS] details = [ \"Lots of QoL, Balance Changes and Bug Fixes from both GT 2.8 Update and Nomi Labs... Check your Recipes!\", \"**Please DO NOT revert any saves that have been loaded in this release to 1.7-alpha-2a or prior!**\", ] [DETAILS] [PRIORITY] priority = 20 [PRIORITY] """ [[messages]] messageBody = """ [COMBINE] commit = \"bd58b9072f45d647734ae66168cbd27bf9b2f220\" [COMBINE] [NO CATEGORY] """ [[messages]] messageBody = """ [FEATURE] [QOL] [DETAILS] details = [ \"Removes Anvil XP Scaling\", \"Custom Items, Blocks, and Multiblocks Improvements\", \"EIO Capacitor and Custom Capacitor Improvements\", \"Draconic Energy Core Improvements\", \"New ArchitectureCraft GUI for Sawbench & New Slopes (Comes from [GTNH's Fork](https://github.com/GTNewHorizons/ArchitectureCraft))\", \"Removes Bogo Feature in Bogo Sort\", \"Red Coal NBT Removal\", [\"Automatically Removed for all Red Coals Items, in AE2 Patterns and Elsewhere!\"], ] [DETAILS] """ [[messages]] messageBody = """ [QB] [DETAILS] detail = \"Genesis is Now Slowly Revealed\" [DETAILS] """ [[messages]] messageBody = """ [BUG] [DETAILS] details = [ \"Fixes NBT Recipe Problems\", \"Fixes Recycling Recipes\", \"Fixes HM Assembly Line Duplicate Recipe for UV Field Generator (#517)\", \"Fixes Some HM Assembly Line Recipes not having Research\", \"Fixes IV Quad/Nonuple Hatches & Buses being Uncraftable (#550)\", \"Fixes Missing ABS Recipes\", \"Fixes Language Override for Rhodium-Lumium Palladium\", \"Fixes Oxygen, Hydrogen and Nitrogen showing up as a Null Texture in JEI/HEI\", \"Fixes Multiblock Searching in JEI (#519)\", \"Removes Vanilla Ores from JEI\", \"Fixes Buckets showing up in JEI\", ] [DETAILS] [IGNORE] checks = { compareBefore = "1.7-alpha-2" } # Only apply this if the commit being compared against is 1.7-alpha-2 or newer [IGNORE] """ [[messages]] messageBody = """ [BUG] [DETAILS] details = [ \"Fixes NBT Recipe Problems\", \"Fixes Recycling Recipes\", \"Fixes Oxygen, Hydrogen and Nitrogen showing up as a Null Texture in JEI/HEI\", \"Fixes Multiblock Searching in JEI (#519)\", \"Removes Vanilla Ores from JEI\", \"Addresses Buckets showing up in JEI\", ] [DETAILS] [IGNORE] checks = { compareAfter = "1.7-alpha-2" } # Only apply this if the commit being compared against is 1.7-alpha-2 or older [IGNORE] """ [[messages]] messageBody = """ [BALANCING] [DETAILS] details = [ \"Added Cobaltite to the T3 Micro Miner\", \"Adds Recipe for Dragon Breath with High-Octane Gasoline (#629)\", \"Rebalance Processing Array Recipe (#501)\", \"Reduces Cost of Thermal Fluxbore (#392)\", [ \"Drill Head is now Cheaper, only requiring 5x Nomiquarters (25) instead of 5x Nomidollars (100) (Normal Mode)\", \"Fluxbore Head is now Cheaper, being Vanadium Steel Drill Head instead of Stainless Steel (Hard Mode)\", ], ] [DETAILS] """ [[messages]] messageBody = "[INTERNAL]" [EXPAND] ''' [[fixes]] sha = "bd58b9072f45d647734ae66168cbd27bf9b2f220" newTitle = "Update GT and Related Mods for 1.7" newBody = ''' [EXPAND] [[messages]] messageTitle = "Update GT to 2.8+, add Nomi Labs" messageBody = """ [BREAKING] [DETAILS] details = [ \"**Please DO NOT revert any saves that have been loaded in this release to 1.6.1a or prior!**\", \"**Lots of Recipes have been moved to the Assembly Line, and now require Assembly Line Research.**\", \"Adds Assembly Line Research\", \"Adds ME Hatches and Buses, for combining Multiblocks with AE Networks\", \"Adds Filtered Output Hatches\", \"Adds EU Multiblock Power Storage\", \"Adds Multiblock Transformer and Laser Power Transfer\", \"Adds Long Distance Pipes\", \"Creating Waypoints in the Prospector\", \"Fixing many Bugs\", \"And many more!\" ] [DETAILS] [PRIORITY] priority = 10 [PRIORITY] """ [[messages]] messageTitle = "Multiblock Changes" messageBody = """ [BREAKING] [DETAILS] details = [ \"Multiblocks accept a new **maximum** of 2 Energy Hatches.\", \"All Custom Multiblocks, such as Naquadah Reactors and Multiverse Projectors, now have **minimum casing requirements** and a **maintenance hatch**.\", \"Some Custom Multiblocks now have Distinct Mode\", \"All Custom Multiblocks now have custom Front Overlays\", \"Reworked & Improved Multiblock UIs\" ] [DETAILS] [PRIORITY] priority = 5 [PRIORITY] """ [EXPAND] ''' [FIXUP] [SKIP]
268 lines
8.4 KiB
TypeScript
268 lines
8.4 KiB
TypeScript
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";
|
|
export const priorityKey = "[PRIORITY]";
|
|
|
|
/* 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
|
|
* <p>
|
|
* 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<boolean | Ignored> => {
|
|
if (!commitBody) return false;
|
|
return parseCommitBody(commitMessage, commitBody, commit, parser);
|
|
};
|
|
|
|
/* Parsing Categories */
|
|
|
|
const fixupParsing: Parser = {
|
|
skipCallback: () => false,
|
|
// No need to care about message/body, never parse expand/details commits
|
|
itemCallback: (_parser, commit) => parseFixUp(commit),
|
|
addCommitListCallback: () => false,
|
|
addSHACallback: () => false,
|
|
};
|
|
|
|
const overridesParsing: Parser = {
|
|
dirs: [modpackManifest.overrides],
|
|
skipCallback: defaultSkipCallback,
|
|
itemCallback: defaultParsingCallback,
|
|
leftOverCallback: (commit, commitMessage, _commitBody, subMessages) => {
|
|
generalCategory.changelogSection.get(generalCategory.defaultSubCategory).push({
|
|
commitMessage: commitMessage,
|
|
commitObject: commit,
|
|
subChangelogMessages: subMessages,
|
|
});
|
|
},
|
|
addCommitListCallback: () => true,
|
|
};
|
|
|
|
const manifestParsing: Parser = {
|
|
dirs: ["manifest.json"],
|
|
skipCallback: defaultSkipCallback,
|
|
itemCallback: defaultParsingCallback,
|
|
addCommitListCallback: () => true,
|
|
};
|
|
|
|
const finalParsing: Parser = {
|
|
skipCallback: defaultSkipCallback,
|
|
itemCallback: defaultParsingCallback,
|
|
addCommitListCallback: (_commit, parsed) => parsed,
|
|
};
|
|
|
|
/**
|
|
* Parsers
|
|
* <p>
|
|
* The order that the categories appear here will be the order that they are parsed in.<p>
|
|
* 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.<p><p>
|
|
* Keys:<p>
|
|
* `{{{ modName }}}` replaced by mod name,<p>
|
|
* `{{{ oldVersion }}}` replaced by the old version (if applicable)<p>
|
|
* `{{{ 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<ModChangesType, ModChangesAllocation> = {
|
|
added: {
|
|
category: generalCategory,
|
|
subCategory: modAdditions,
|
|
template: "{{{ modName }}}: *v{{{ newVersion }}}*",
|
|
},
|
|
updated: {
|
|
category: generalCategory,
|
|
subCategory: modUpdates,
|
|
template: "{{{ modName }}}: *v{{{ oldVersion }}} ⇥ v{{{ newVersion }}}*",
|
|
},
|
|
removed: {
|
|
category: generalCategory,
|
|
subCategory: modRemovals,
|
|
template: "{{{ modName }}}: *v{{{ oldVersion }}}*",
|
|
},
|
|
};
|
|
|
|
// Ignore Allocations
|
|
|
|
/* Ignore Checks */
|
|
const targetBeforeCheck: IgnoreCheck = (tag, data) => !data.tags.has(tag);
|
|
const targetAfterCheck: IgnoreCheck = (tag, data) => data.tags.has(tag);
|
|
const compareBeforeCheck: IgnoreCheck = (tag, data) => !data.compareTags.has(tag);
|
|
const compareAfterCheck: IgnoreCheck = (tag, data) => data.compareTags.has(tag);
|
|
const compareIsCheck: IgnoreCheck = (tag, data) => data.since === tag;
|
|
const compareNotCheck: IgnoreCheck = (tag, data) => data.since !== tag;
|
|
const targetIsCheck: IgnoreCheck = (tag, data) => data.to === tag;
|
|
const targetNotCheck: IgnoreCheck = (tag, data) => data.to !== tag;
|
|
|
|
/* Ignore Checks Map */
|
|
export const ignoreChecks: Record<string, IgnoreCheck> = {
|
|
targetBefore: targetBeforeCheck,
|
|
targetAfter: targetAfterCheck,
|
|
compareBefore: compareBeforeCheck,
|
|
compareAfter: compareAfterCheck,
|
|
compareIs: compareIsCheck,
|
|
compareNot: compareNotCheck,
|
|
targetIs: targetIsCheck,
|
|
targetNot: targetNotCheck,
|
|
};
|
|
|
|
/* Ignore Logic */
|
|
const andLogic: IgnoreLogic = (checkResults) => checkResults.filter((result) => result === false).length === 0;
|
|
const orLogic: IgnoreLogic = (checkResults) => checkResults.filter((result) => result === true).length > 0;
|
|
const nandLogic: IgnoreLogic = (checkResults) => !andLogic(checkResults);
|
|
const norLogic: IgnoreLogic = (checkResults) => !orLogic(checkResults);
|
|
|
|
/* Ignore Logic Map */
|
|
export const ignoreLogics: Record<string, IgnoreLogic> = {
|
|
and: andLogic,
|
|
or: orLogic,
|
|
nand: nandLogic,
|
|
nor: norLogic,
|
|
};
|
|
|
|
/* Default Ignore Logic */
|
|
export const defaultIgnoreLogic: IgnoreLogic = andLogic;
|