feat: update changelog configuration

This commit is contained in:
hieu-jan 2024-03-10 18:19:19 +09:00
parent 40128ea2cc
commit 7026d2d594

View File

@ -6,14 +6,13 @@ async function fetchData(siteConfig) {
const repo = siteConfig.projectName;
const apiUrl = `https://api.github.com/repos/${owner}/${repo}/releases`;
const outputDirectory = path.join(__dirname, '../../docs/guides/changelogs');
const outputDirectory = path.join(__dirname, '../../docs/releases/changelog');
if (!fs.existsSync(outputDirectory)) {
fs.mkdirSync(outputDirectory);
}
let counter = 1;
const categoryFilePath = path.join(outputDirectory, '_category_.json');
const cacheFilePath = path.join(outputDirectory, 'cache.json');
let cachedData = {};
@ -83,7 +82,7 @@ async function fetchData(siteConfig) {
const changes = release.body;
let markdownContent = `---\nsidebar_position: ${counter}\n---\n# ${version}\n\nFor more details, [GitHub Issues](${releaseUrl})\n\nHighlighted Issue: ${issueLink}\n\n${changes}\n`;
let markdownContent = `---\nsidebar_position: ${counter}\nslug: /changelog/changelog-${version}\n---\n# ${version}\n\nFor more details, [GitHub Issues](${releaseUrl})\n\nHighlighted Issue: ${issueLink}\n\n${changes}\n`;
// Write to a separate markdown file for each version
const outputFilePath = path.join(outputDirectory, `changelog-${version}.mdx`);
@ -93,20 +92,6 @@ async function fetchData(siteConfig) {
counter++;
}
// Create _category_.json file
const categoryContent = {
label: 'Changelogs',
position: 5,
link: {
type: 'generated-index',
description: 'Changelog for Jan',
},
};
fs.writeFileSync(categoryFilePath, JSON.stringify(categoryContent, null, 2), 'utf-8');
console.log(`_category_.json has been created at: ${categoryFilePath}`);
}
module.exports = fetchData;
module.exports = fetchData;