modded7/tools/types/changelogTypes.ts
Integer Limit e04d332961
Improve Changelog Tags (#678)
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]
2024-03-25 22:41:57 +11:00

306 lines
8.2 KiB
TypeScript

import ChangelogData from "../tasks/changelog/changelogData";
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.
* <p>
* 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.
* <p>
* Can be set to "" to have no title.
*/
categoryName: string;
/**
* Changelog Section: The changelog section map that the key should push to.
* <p>
* Will be initialized later, if put into categoryKeys.
*/
changelogSection?: Map<SubCategory, ChangelogMessage[]>;
/**
* Default Sub Category. Any commits not placed into other sub-categories will be placed in here.
* <p>
* Should be a Sub Category added to subCategoryKeys, as otherwise the category would not appear in the changelog.
* <p>
* 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.
* <p>
* This is also needed for certain parsing operations.
*/
defaultSubCategory: SubCategory;
/**
* Sub Category Keys: The list of sub-category keys.
* <p>
* 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.
* <p>
* 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.
* <p>
* This can be set to "" to allow any commit in.
* <p>
* 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.
* <p>
* Can be set to "" to have no title.
*/
keyName: string;
}
/**
* A Changelog Message Object.
*/
export interface ChangelogMessage {
/**
* Commit Message
*/
commitMessage: string;
/**
* Commit Object
* <p>
* Provides the Commit SHA, the Commit Author, and the Commit Date.
*/
commitObject?: Commit;
/**
* Sub Changelog Messages
*/
subChangelogMessages?: ChangelogMessage[];
/**
* Indentation
* <p>
* Optional. Defaults to "".
*/
indentation?: string;
/**
* If this changelog message is special. This is special formatting for it.
*/
specialFormatting?: SpecialChangelogFormatting<unknown>;
}
/**
* A special changelog message object, for special formatting.
*/
export interface SpecialChangelogFormatting<T> {
/**
* Formatting Function
* @param message The transformed message (trimmed, transformed issue/pr tags)
* @param subMessage Whether this message is a sub message (true if yes)
* @param indentation The indentation level to use
* @param storage May be null, is the defined storage in this interface
*/
formatting: (message: string, subMessage: boolean, indentation: string, storage?: T) => string;
/**
* Storage
*/
storage: T;
}
/**
* A parsing category, which defines parsing rules and callbacks for different dirs.
*/
export interface Parser {
/**
* Dirs to parse. If not set, will just parse commit list of all changes.
*/
dirs?: string[];
/**
* Callback to determine whether a commit should be skipped.
* <p>
* 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.
* <p>
* Expanded Commits from parseExpand go here too!<p><p>
* commit: The commit object.<p>
* commitMessage: The message of the commit.<p>
* commitBody: The body of the commit. Might be undefined.<p>
* return: True to skip, false to not.
*/
skipCallback: (commit: Commit, commitMessage: string, commitBody?: string) => boolean;
/**
* Callback per item.
* <p>
* Expanded Commits from parseExpand go here too!<p><p>
* parser: This parser object, for convenience of use when calling parseCommitBody.
* commit: The commit object.
* commitMessage: The message of the commit.<p>
* commitBody: The body of the commit. Might be undefined.<p>
* 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,
) => Promise<boolean | Ignored>;
/**
* The callback to perform on any commits, which did not pass parsing. If not set, no callback will be performed, and those commits will be discarded.
* <p>
* Expanded Commits from parseExpand and parseDetails go here too!<p><p>
* commit: The commit object.<p>
* commitMessage: The message of the commit.<p>
* commitBody: The body of the commit. Might be undefined.<p>
* 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.
* <p>
* If not set, will just add SHA of every commit included in `dirs`.<p><p>
* commit: The commit object.<p>
* parsed: If parsing was successful. This is also true if the commit was skipped.<p>
* return: True if to add sha, false if to not.<p>
*/
addSHACallback?: (commit: Commit, parsed: boolean) => boolean;
/**
* Callback to determine whether or not the commit should be added to the commit list.
* <p><p>
* commit: The commit to determine.<p>
* parsed: If parsing was successful.<p>
* return: True if to add, false if not.
*/
addCommitListCallback: (commit: Commit, parsed: boolean) => boolean;
}
export interface IgnoreInfo {
checks: Record<string, string>;
logic?: string;
addCommitList?: boolean;
}
/**
* Check to determine whether to ignore.
* @return ignore True to Ignore (if check is true), False to continue
*/
export type IgnoreCheck = (tag: string, data: ChangelogData) => boolean;
/**
* Ignore Logic
* @param checkResults The results of the checks.
* @return ignore True to ignore, false to continue
*/
export type IgnoreLogic = (checkResults: boolean[]) => boolean;
export class Ignored {
private readonly addCommitList: boolean | undefined;
constructor(addCommitList?: boolean) {
this.addCommitList = addCommitList;
}
getCommitList(): boolean {
if (this.addCommitList === undefined) return false;
return this.addCommitList;
}
}
export interface ModChangeInfo {
modName: string;
projectID?: number;
oldVersion?: string;
newVersion?: string;
}
export interface ExpandedMessage {
messageTitle: string;
messageBody?: string;
}
export interface FixUpInfo {
sha: string;
newTitle?: string;
newBody?: string;
mode: FixUpMode;
}
export interface ModInfo {
projectID: number;
info?: string;
detail?: string;
details?: string[];
}
export interface ParsedModInfo {
info?: string;
details?: ChangelogMessage[];
}
export interface PriorityInfo {
priority: number;
}
export type FixUpMode = "REPLACE" | "ADDITION";
export type InputReleaseType = "Release" | "Beta Release" | "Alpha Release" | "Cutting Edge Build";
export interface DeployReleaseType {
isPreRelease: boolean;
cfReleaseType: "release" | "beta" | "alpha";
}
// Cutting Edge Build is not needed here, as this type is only used for deploying, and not building.
export const inputToDeployReleaseTypes: Record<InputReleaseType, DeployReleaseType> = {
Release: {
isPreRelease: false,
cfReleaseType: "release",
},
"Beta Release": {
isPreRelease: true,
cfReleaseType: "beta",
},
"Alpha Release": {
isPreRelease: true,
cfReleaseType: "alpha",
},
"Cutting Edge Build": undefined,
};