Skip to content

Commit

Permalink
feat: update changelog configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
0xHieu01 committed Mar 10, 2024
1 parent 40128ea commit 7026d2d
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions docs/plugins/changelog-plugin/fetchData.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down Expand Up @@ -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`);
Expand All @@ -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;

0 comments on commit 7026d2d

Please sign in to comment.