Skip to content

Commit

Permalink
Tweak changelogs, change version targets
Browse files Browse the repository at this point in the history
  • Loading branch information
MMK21Hub committed Oct 30, 2022
1 parent fce074b commit d8d321c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 20 deletions.
15 changes: 9 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { emitResourcePacks, generateStats } from "./builder.js"
import fixes from "./fixes.js"
import { MinecraftVersionSpecifier, VersionInfo } from "./minecraftHelpers.js"
import {
MinecraftVersionFancyRange,
MinecraftVersionSpecifier,
VersionInfo,
} from "./minecraftHelpers.js"
import fetch from "node-fetch"

export async function printStats() {
Expand Down Expand Up @@ -37,11 +41,10 @@ export const cache = new Map<string, any>()

const commandLineArg = process.argv[2]

const targetVersions: MinecraftVersionSpecifier = {
type: "latest",
branch: "snapshot",
}
// const targetVersions = "22w24a"
// const targetVersions: MinecraftVersionFancyRange = {
// start: "1.19.2",
// }
const targetVersions = "1.19.2"
// const targetVersions: StartAndEnd<string> = ["1.19.1-pre1", null]
const targetLanguages = ["en_us", "en_gb"]

Expand Down
5 changes: 4 additions & 1 deletion src/minecraftHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,10 @@ export async function resolveMinecraftVersionFancyRange(
// Local function shorthands:
const resolveRange = resolveMinecraftVersionSimpleRange

const fullRange = await resolveRange([range.start, range.end], {
const start = range.start || null
const end = range.end || null

const fullRange = await resolveRange([start, end], {
removeStart: range.exclusiveStart,
removeEnd: range.exclusiveEnd,
})
Expand Down
27 changes: 16 additions & 11 deletions src/publisher/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,32 @@ function generateChangelog({
const githubRelease = `https://github.com/MMK21Hub/Capitalisation-Fixes/releases/tag/${versionBrand}`

const versionsBehind = totalFiles - 1 - index
const versionsBehindString =
versionsBehind === 1
? "1 version behind"
: `${versionsBehind} versions behind`
const olderVersionsNote =
versionsBehind !== 0
? `Note: ${minecraftVersion} is ${versionsBehind} versions behind the latest Minecraft version that this release supports. Not all mentioned changes may apply.`
? `\
<details>
<summary>Release notes may be inaccurate</summary>
${minecraftVersion} is ${versionsBehindString} versions behind the latest Minecraft version that this release supports, so some/all of the changes mentioned in the release notes may not apply.
</details>`
: ""

/* Markdown is supported. Use level-three headings (and below) to avoid clashing with Modrinth's UI. */
return `
**Capitalisation Fixes ${versionBrand} for Minecraft ${versionBrand}**
${olderVersionsNote}
### Release notes
This section would be hand-written
- Maybe take it from GH releases
- We added 10 new bugfixes
- Optimizations to the build tool
- Added support for Pirate English
What a buig update today!
- Fixed some bugs
- Other improvements
- Removed the rest of this changelog
----
[*View this release on Github*](${githubRelease})
**Capitalisation Fixes ${versionBrand} for Minecraft ${versionBrand}**
- [View this release on Github](${githubRelease})
`.trim()
}

Expand Down Expand Up @@ -142,7 +147,7 @@ const rl = createInterface({
output: process.stdout,
})

console.log(`Found ${index.size} file(s) for version ${packVersion}.`)
console.log(`Found ${index.size} file(s) for version ${packVersion}`)
console.log(`Using API: ${client.baseURL}`)

const carefulMode = client.baseURL.hostname === "api.modrinth.com"
Expand Down
4 changes: 2 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export type FunctionMaybeArgs<T, A extends Record<string, any>> = FunctionMaybe<
export type StartAndEnd<T> = [T | null, T | null]
/** Represents a {@link Range}, with options for excluding parts within that range */
export type FancyRange<T> = {
start: T
end: T
start?: T
end?: T
exclude?: Range<T>
include?: Range<T>
exclusiveStart?: boolean
Expand Down

0 comments on commit d8d321c

Please sign in to comment.