Skip to content

Commit b342ba7

Browse files
committed
add changelog
1 parent 8153647 commit b342ba7

File tree

10 files changed

+383
-4
lines changed

10 files changed

+383
-4
lines changed

docs/.vitepress/config/en.ts

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { createRequire } from "module";
22
import { defineConfig } from "vitepress";
33
import request from "sync-request";
44
import { repositories } from "../../data/repositories";
5+
import { changelog } from "../../data/changelog";
56

67
const require = createRequire(import.meta.url);
78
const pkg = require("vitepress/package.json");
@@ -18,6 +19,7 @@ export default defineConfig({
1819
sidebar: {
1920
"/guide/": sidebarGuide(),
2021
"/repository/": sidebarRepositories(),
22+
"/changelog/": sidebarChangelog(),
2123
"/legal/": sidebarLegal(),
2224
},
2325

@@ -35,8 +37,7 @@ export default defineConfig({
3537
},
3638

3739
editLink: {
38-
pattern:
39-
"https://github.com/MMRLApp/MMRLApp.github.io/edit/master/docs/:path",
40+
pattern: "https://github.com/MMRLApp/MMRLApp.github.io/edit/master/docs/:path",
4041
text: "Edit this page on GitHub",
4142
},
4243
},
@@ -47,6 +48,7 @@ function nav() {
4748
{ text: "Guide", link: "/guide" },
4849
{ text: "Repositories", link: "/repository" },
4950
{ text: "Blacklist", link: "/blacklist" },
51+
{ text: "Changelog", link: `/changelog/${changelog[0].versionCode}` },
5052
{ text: "Legal", link: "/legal/privacy" },
5153
];
5254
}
@@ -139,3 +141,31 @@ function sidebarRepositories() {
139141
},
140142
];
141143
}
144+
145+
function sidebarChangelog() {
146+
return [
147+
{
148+
text: "Changelog",
149+
items: changelog.map((log) => {
150+
const spanCss = `
151+
border-color: var(--vp-badge-warning-border);
152+
color: var(--vp-badge-warning-text);
153+
background-color: var(--vp-badge-warning-bg);
154+
display: inline-block;
155+
border: 1px solid transparent;
156+
border-radius: 12px;
157+
padding: 0 10px;
158+
line-height: 22px;
159+
font-size: 12px;
160+
font-weight: 500;
161+
transform: translateY(-2px);
162+
`;
163+
164+
return {
165+
text: `${log.versionName} (${log.versionCode}) ${log.preRelease ? `<span style="${spanCss}">PR</span>` : ""}`,
166+
link: `/changelog/${log.versionCode}`,
167+
};
168+
}),
169+
},
170+
];
171+
}

docs/.vitepress/config/shared.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { writeFile } from "fs/promises";
77
import { resolve } from "path";
88
import { repositoriesJSONstringify } from "../../data/repositories";
99
import { blacklistJSONstringify } from "../../data/blacklist";
10+
import { changelogJSONstringify } from "../../data/changelog";
1011

1112
export const shared = defineConfig({
1213
vite: {
@@ -51,8 +52,10 @@ export const shared = defineConfig({
5152
const publicApi = resolve(config.outDir, "api");
5253
const publicRepoList = resolve(publicApi, "repositories.json");
5354
const publicBlackList = resolve(publicApi, "blacklist.json");
55+
const publicChangelogList = resolve(publicApi, "changelog.json");
5456

5557
await writeFile(publicRepoList, repositoriesJSONstringify);
5658
await writeFile(publicBlackList, blacklistJSONstringify);
59+
await writeFile(publicChangelogList, changelogJSONstringify);
5760
},
5861
});

docs/data/blacklist.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { readFileSync } from "fs";
22
import { join } from "path";
33
import { parse } from "yaml";
44

5-
export const fileName = join(__dirname, "blacklist.yaml");
5+
export const fileName = join(__dirname, "../../meta/blacklist.yaml");
66

77
export const blacklist: any = parse(readFileSync(fileName, "utf8"));
88
export const blacklistJSONstringify: string = JSON.stringify(

docs/data/changelog.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { readFileSync } from "fs";
2+
import { join } from "path";
3+
import { parse } from "yaml";
4+
5+
export const fileName = join(__dirname, "../../meta/changelog.yaml");
6+
7+
export const changelog: any = parse(readFileSync(fileName, "utf8"));
8+
export const changelogJSONstringify: string = JSON.stringify(
9+
changelog,
10+
null,
11+
4
12+
);

docs/data/repositories.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { readFileSync } from "fs";
22
import { join } from "path";
33
import { parse } from "yaml";
44

5-
export const fileName = join(__dirname, "repositories.yaml");
5+
export const fileName = join(__dirname, "../../meta/repositories.yaml");
66

77
export const repositories: any = parse(readFileSync(fileName, "utf8"));
88
export const repositoriesJSONstringify: string = JSON.stringify(

docs/en/changelog/[versionCode].md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
editLink: false
3+
prev: false
4+
next: false
5+
---
6+
7+
# {{ $params.title }} <Badge v-if="$params.preRelease" type="warning" text="PR" />
8+
9+
<!-- @content -->
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { changelog } from "../../data/changelog";
2+
3+
export default {
4+
paths() {
5+
return changelog.map((log) => {
6+
return {
7+
params: {
8+
title: log.versionName + " (" + log.versionCode + ")",
9+
versionName: log.versionName,
10+
versionCode: log.versionCode,
11+
preRelease: log.preRelease,
12+
},
13+
content: log.changes
14+
};
15+
});
16+
},
17+
};

0 commit comments

Comments
 (0)