Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added changelog page and version to footer
- Loading branch information
Showing
7 changed files
with
106 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
|
||
<html lang="en"> | ||
{head.html} | ||
|
||
<body> | ||
{nav.html} | ||
|
||
<main class="changelog article"> | ||
<p>What changes have happened to this site?</p> | ||
<section class="area"> | ||
{changelog} | ||
</section> | ||
</main> | ||
|
||
{footer.html} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as fs from "fs"; | ||
import showdown from "showdown"; | ||
|
||
import findInDir from "./findInDir"; | ||
|
||
console.log("/// Beginning changelog generation"); | ||
|
||
const CHANGELOG_HTML_LOCATION = "./public/changelog.html"; | ||
|
||
const changelogMdContent = fs.readFileSync("./CHANGELOG.md", "utf8"); | ||
let changelogHtmlContent = fs.readFileSync(CHANGELOG_HTML_LOCATION, "utf8"); | ||
|
||
const mdConverter = new showdown.Converter(); | ||
|
||
const changelogContent = mdConverter.makeHtml(changelogMdContent); | ||
changelogHtmlContent = changelogHtmlContent.replace( | ||
"{changelog}", | ||
changelogContent | ||
); | ||
|
||
fs.writeFileSync(CHANGELOG_HTML_LOCATION, changelogHtmlContent, "utf8"); | ||
|
||
const versionMatch = changelogMdContent.match( | ||
/## ((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?)/ | ||
); | ||
|
||
const version = | ||
versionMatch && versionMatch.length > 2 ? versionMatch[1] : "ER.RO.R"; | ||
|
||
const pages = findInDir("./public", ".html"); | ||
|
||
pages.forEach((page) => { | ||
const pageContent = fs.readFileSync(page, "utf8"); | ||
fs.writeFileSync(page, pageContent.replace("{version}", version), "utf8"); | ||
}); | ||
|
||
console.log("/// Finished changelog generation"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters