Skip to content

Commit

Permalink
add changelog generation
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed May 8, 2024
1 parent 2e9877f commit 5c6a3f8
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
7 changes: 7 additions & 0 deletions content/changelog/oath/en-US.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# YYYY-MM-DD

- date: 2024-06-06
text: >
Added FAQ entries to $link:Toll Roads$, $link:Wrestlers$, and $link:Vow of Poverty$.
Changed the answer to "How does this work if I have Witch's Bargain?" for $link:Toll Roads$ from "Blah blah blah" to "Blah blah blah." We did this because of reasons.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"build:meta-data": "ts-node scripts/build-meta-data",
"build:i18n": "ts-node scripts/build-i18n",
"build:faq": "ts-node scripts/build-faq",
"build:changelog": "ts-node scripts/build-changelog",
"compress:card-images": "ts-node scripts/compress-card-images",
"compress:card-symbols": "ts-node scripts/compress-card-symbols",
"validate": "concurrently \"npm run validate:*\"",
Expand Down
26 changes: 26 additions & 0 deletions scripts/build-changelog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const path = require('path');
const fs = require('fs-extra');
const yaml = require('js-yaml');
const readdir = require('recursive-readdir');

fs.ensureDirSync('./dist');

const readAllChangelogs = async () => {
const allChangelogFiles = await readdir('./content/changelog');

const allChangelogData = {};

allChangelogFiles.forEach((f) => {
const [, , game] = f.split(path.sep);
const locale = path.basename(f, '.yml');
const changelogs = yaml.load(fs.readFileSync(f));

allChangelogData[game] ??= {};
allChangelogData[game][locale] = changelogs;
});

fs.writeJsonSync(`dist/changelog.json`, allChangelogData);
console.log(`Got ${allChangelogFiles.length} changelog files!`);
};

readAllChangelogs();
5 changes: 2 additions & 3 deletions scripts/build-faq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const yaml = require('js-yaml');
const readdir = require('recursive-readdir');

fs.ensureDirSync('./dist');
fs.ensureDirSync('./dist/faq');

const readAllFAQ = async () => {
const allFAQFiles = await readdir('./content/faq');
Expand All @@ -20,8 +19,8 @@ const readAllFAQ = async () => {
allFAQData[game][locale] = faqs;
});

fs.writeJsonSync(`dist/faq.json`, allFAQData),
console.log(`Got ${allFAQFiles.length} FAQ files!`);
fs.writeJsonSync(`dist/faq.json`, allFAQData);
console.log(`Got ${allFAQFiles.length} FAQ files!`);
};

readAllFAQ();

0 comments on commit 5c6a3f8

Please sign in to comment.