mirror of
https://github.com/callumalpass/tasknotes.git
synced 2026-07-22 12:50:26 +00:00
* feat: bundle release notes with collapsible sections and dates - Update release notes generator to bundle current minor version + last patch from previous minor - Extract dates from git tags for each version - Add collapsible sections for each version with visual indicators - Display 'Current' badge for current version - Show formatted dates (e.g., 'October 7, 2025') next to version numbers - Current version and first version expanded by default, others collapsed - Hover effects and smooth transitions for better UX - No changes to markdown files - dates come from git metadata * feat: include all versions from previous minor series Now bundles: - All versions from current minor series (3.25.x) - All versions from previous minor series (3.24.x) This provides complete context for users upgrading from any 3.24.x version. * docs: add release notes bundling to unreleased.md * feat: add option to disable release notes auto-open - Add 'Show release notes after update' toggle in General settings - Default to enabled (current behavior) - Still updates lastSeenVersion when disabled to prevent repeated prompts - Respects user preference on plugin updates * feat: add i18n support for release notes settings - Add translation keys for release notes section - Update generalTab to use i18n translations - Sync i18n manifest and state files - Update unreleased.md with setting addition * i18n: add translations for release notes settings - German: Versionshinweise section - Spanish: Notas de la versión section - French: Notes de version section - Japanese: リリースノート section - Russian: Примечания к выпуску section - Chinese: 版本说明 section - Sync i18n state file
103 lines
2.9 KiB
JavaScript
103 lines
2.9 KiB
JavaScript
import { readFileSync, writeFileSync, readdirSync } from "fs";
|
|
import { execSync } from "child_process";
|
|
|
|
// Read current version from manifest.json
|
|
const manifest = JSON.parse(readFileSync("manifest.json", "utf8"));
|
|
const currentVersion = manifest.version;
|
|
|
|
// Parse semantic version
|
|
function parseVersion(version) {
|
|
const match = version.match(/^(\d+)\.(\d+)\.(\d+)$/);
|
|
if (!match) return null;
|
|
return {
|
|
major: parseInt(match[1]),
|
|
minor: parseInt(match[2]),
|
|
patch: parseInt(match[3]),
|
|
full: version
|
|
};
|
|
}
|
|
|
|
// Get git tag date for a version
|
|
function getVersionDate(version) {
|
|
try {
|
|
const output = execSync(`git log -1 --format=%aI ${version}`, { encoding: 'utf8' }).trim();
|
|
return output;
|
|
} catch (error) {
|
|
// If tag doesn't exist, return null
|
|
return null;
|
|
}
|
|
}
|
|
|
|
// Get all release note files and bundle versions since last minor
|
|
const releaseFiles = readdirSync("docs/releases")
|
|
.filter(f => f.match(/^\d+\.\d+\.\d+\.md$/))
|
|
.map(f => f.replace('.md', ''))
|
|
.map(v => parseVersion(v))
|
|
.filter(v => v !== null)
|
|
.sort((a, b) => {
|
|
if (a.major !== b.major) return b.major - a.major;
|
|
if (a.minor !== b.minor) return b.minor - a.minor;
|
|
return b.patch - a.patch;
|
|
});
|
|
|
|
const current = parseVersion(currentVersion);
|
|
if (!current) {
|
|
console.error(`Invalid version format: ${currentVersion}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
// Find all versions in current minor series (e.g., 3.25.x)
|
|
const currentMinorVersions = releaseFiles.filter(v =>
|
|
v.major === current.major && v.minor === current.minor
|
|
);
|
|
|
|
// Find all versions from previous minor series (e.g., 3.24.x)
|
|
const previousMinorVersions = releaseFiles.filter(v =>
|
|
v.major === current.major && v.minor === current.minor - 1
|
|
);
|
|
|
|
// Bundle current minor + all patches from previous minor
|
|
const versionsToBundle = [
|
|
...currentMinorVersions.map(v => v.full),
|
|
...previousMinorVersions.map(v => v.full)
|
|
];
|
|
|
|
// Generate imports and metadata
|
|
const imports = versionsToBundle.map((version, index) =>
|
|
`import releaseNotes${index} from "../docs/releases/${version}.md";`
|
|
).join('\n');
|
|
|
|
const releaseNotesArray = versionsToBundle.map((version, index) => {
|
|
const date = getVersionDate(version);
|
|
return ` {
|
|
version: "${version}",
|
|
content: releaseNotes${index},
|
|
date: ${date ? `"${date}"` : 'null'},
|
|
isCurrent: ${version === currentVersion}
|
|
}`;
|
|
}).join(',\n');
|
|
|
|
// Generate the TypeScript file
|
|
const content = `// Auto-generated file - do not edit manually
|
|
// This file is regenerated during the build process to bundle release notes
|
|
|
|
${imports}
|
|
|
|
export interface ReleaseNoteVersion {
|
|
version: string;
|
|
content: string;
|
|
date: string | null;
|
|
isCurrent: boolean;
|
|
}
|
|
|
|
export const CURRENT_VERSION = "${currentVersion}";
|
|
export const RELEASE_NOTES_BUNDLE: ReleaseNoteVersion[] = [
|
|
${releaseNotesArray}
|
|
];
|
|
`;
|
|
|
|
// Write to src/releaseNotes.ts
|
|
writeFileSync("src/releaseNotes.ts", content);
|
|
|
|
console.log(`✓ Generated release notes bundle for version ${currentVersion}`);
|
|
console.log(` Bundled versions: ${versionsToBundle.join(', ')}`);
|