mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-04-08 02:10:30 -07:00
docs: add mpv.launchMode to config docs, add changelog:docs generator, format
- Document the new mpv.launchMode option in the configuration docs page - Add changelog:docs command to auto-generate docs-site/changelog.md from root CHANGELOG.md - Add breaking changes support to the changelog fragment generator - Fix docs-sync test to only compare current minor release headings - Apply prettier formatting to source files
This commit is contained in:
@@ -8,7 +8,10 @@ const installationContents = readFileSync(new URL('./installation.md', import.me
|
||||
const mpvPluginContents = readFileSync(new URL('./mpv-plugin.md', import.meta.url), 'utf8');
|
||||
const developmentContents = readFileSync(new URL('./development.md', import.meta.url), 'utf8');
|
||||
const changelogContents = readFileSync(new URL('./changelog.md', import.meta.url), 'utf8');
|
||||
const ankiIntegrationContents = readFileSync(new URL('./anki-integration.md', import.meta.url), 'utf8');
|
||||
const ankiIntegrationContents = readFileSync(
|
||||
new URL('./anki-integration.md', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
const configurationContents = readFileSync(new URL('./configuration.md', import.meta.url), 'utf8');
|
||||
|
||||
function extractReleaseHeadings(content: string, count: number): string[] {
|
||||
@@ -17,6 +20,13 @@ function extractReleaseHeadings(content: string, count: number): string[] {
|
||||
.slice(0, count);
|
||||
}
|
||||
|
||||
function extractCurrentMinorHeadings(content: string): string[] {
|
||||
const allHeadings = Array.from(content.matchAll(/^## v(\d+\.\d+)\.\d+[^\n]*$/gm));
|
||||
if (allHeadings.length === 0) return [];
|
||||
const currentMinor = allHeadings[0]![1];
|
||||
return allHeadings.filter(([, minor]) => minor === currentMinor).map(([heading]) => heading);
|
||||
}
|
||||
|
||||
test('docs reflect current launcher and release surfaces', () => {
|
||||
expect(usageContents).not.toContain('--mode preprocess');
|
||||
expect(usageContents).not.toContain('"automatic" (default)');
|
||||
@@ -44,9 +54,11 @@ test('docs reflect current launcher and release surfaces', () => {
|
||||
expect(configurationContents).toContain('youtube.primarySubLanguages');
|
||||
expect(configurationContents).toContain('### Shared AI Provider');
|
||||
|
||||
expect(changelogContents).toContain('## v0.5.1 (2026-03-09)');
|
||||
expect(changelogContents).toContain('v0.5.1 (2026-03-09)');
|
||||
});
|
||||
|
||||
test('docs changelog keeps the newest release headings aligned with the root changelog', () => {
|
||||
expect(extractReleaseHeadings(changelogContents, 3)).toEqual(extractReleaseHeadings(rootChangelogContents, 3));
|
||||
test('docs changelog keeps the current minor release headings aligned with the root changelog', () => {
|
||||
const docsHeadings = extractCurrentMinorHeadings(changelogContents);
|
||||
expect(docsHeadings.length).toBeGreaterThan(0);
|
||||
expect(docsHeadings).toEqual(extractReleaseHeadings(rootChangelogContents, docsHeadings.length));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user