@bscotch/gamemaker-releases
Advanced tools
Comparing version 0.3.0 to 0.3.1
import { pathy } from '@bscotch/pathy'; | ||
import { expect } from 'chai'; | ||
import { cleanNote } from './notes.js'; | ||
import { listReleases, listReleasesWithNotes } from './feeds.js'; | ||
import { rawReleaseNotesCacheSchema } from './feeds.types.js'; | ||
const notesCache = pathy('release-notes-cache.json').withValidator(rawReleaseNotesCacheSchema); | ||
const tmpSummaryPath = pathy('releases-summary.json'); | ||
const sampleReleaseNotesPath = pathy('samples/release_notes.json'); | ||
describe('Release Feeds', function () { | ||
it('can parse runtime release_notes HTML', async function () { | ||
const notes = (await sampleReleaseNotesPath.read()); | ||
const cleaned = cleanNote({ | ||
type: 'runtime', | ||
version: '2022.1100.0.259', | ||
url: 'https://gms.yoyogames.com/release-notes-2022.1100.0.259.json', | ||
...notes, | ||
}); | ||
expect(cleaned.title).to.equal('Changes Since Beta Runtime 258'); | ||
expect(cleaned.changes.groups).to.exist; | ||
expect(cleaned.changes.groups.length).to.be.greaterThan(0); | ||
expect(cleaned.changes.since).to.equal('258'); | ||
expect(cleaned.changes.groups[0].title).to.equal('Other Bugs Fixed'); | ||
expect(cleaned.changes.groups[0].changes.length).to.equal(2); | ||
}); | ||
it('can create a centralized GameMaker Releases database', async function () { | ||
const releases = await listReleases(); | ||
const withNotes = await listReleasesWithNotes(releases, notesCache); | ||
await tmpSummaryPath.write(withNotes); | ||
expect(withNotes.length).to.be.greaterThan(0); | ||
@@ -18,4 +37,7 @@ expect(withNotes.every((r) => r.channel)).to.exist; | ||
} | ||
const sampleRelease = withNotes.find((r) => r.runtime.version === '2022.1100.0.259'); | ||
expect(sampleRelease.runtime.notes.groups).to.exist; | ||
expect(sampleRelease.runtime.notes.groups.length).to.be.greaterThan(0); | ||
}); | ||
}); | ||
//# sourceMappingURL=feeds.test.js.map |
import { Pathy } from '@bscotch/pathy'; | ||
import { GameMakerRelease } from './feeds.types.js'; | ||
import { ArtifactType, GameMakerRelease } from './feeds.types.js'; | ||
export declare function listReleaseNotes(releases: GameMakerRelease[], cache?: Pathy | string): Promise<Record<string, { | ||
@@ -16,2 +16,20 @@ version: string; | ||
}>>; | ||
export declare function cleanNote(note: { | ||
type?: ArtifactType; | ||
version: string; | ||
url: string; | ||
release_notes: string[]; | ||
}): { | ||
version: string; | ||
url: string; | ||
title: string | null; | ||
type: "ide" | "runtime"; | ||
changes: { | ||
since: string | null; | ||
groups: { | ||
title: string; | ||
changes: string[]; | ||
}[]; | ||
}; | ||
}; | ||
//# sourceMappingURL=notes.d.ts.map |
@@ -77,3 +77,3 @@ import { Pathy } from '@bscotch/pathy'; | ||
} | ||
function cleanNote(note) { | ||
export function cleanNote(note) { | ||
assert(note.type, 'Note type must be set'); | ||
@@ -104,3 +104,3 @@ const { body, title } = parseHeader(note.release_notes.join('')); | ||
// Split on h3 elements, and then pull out the lists within each | ||
const parts = html.split(/<h3>\s*(.+?)\s*<\/h3>\s*<ul>\s*(.+?)\s*<\/ul>/g); | ||
const parts = html.split(/<h3>\s*(.+?)\s*<\/h3>\s*<ul>\s*(.+?)\s*<\/ul>/gs); | ||
const changes = []; | ||
@@ -114,3 +114,3 @@ for (let groupIdx = 0; groupIdx < parts.length - 2; groupIdx += 3) { | ||
function parseList(htmlList) { | ||
const parts = htmlList.split(/<li>\s*(.+?)\s*<\/li>/g); | ||
const parts = htmlList.split(/<li>\s*(.+?)\s*<\/li>/gs); | ||
const changes = []; | ||
@@ -130,3 +130,3 @@ for (let groupIdx = 0; groupIdx < parts.length - 1; groupIdx += 2) { | ||
// below it. | ||
const h2s = html.match(/<h2>\s*(.+?)\s*<\/h2>/g); | ||
const h2s = html.match(/<h2>\s*(.+?)\s*<\/h2>/gs); | ||
if (!h2s?.length) { | ||
@@ -133,0 +133,0 @@ return { title: null, body: html }; |
{ | ||
"name": "@bscotch/gamemaker-releases", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Utility for combining GameMaker release data into a single feed.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72656
1122