@terrafirmagreg-team/changelog 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +33 -3
- package/src/lib/route.ts +2 -0
- package/src/lib/tree.ts +41 -0
- package/src/locales/en_us.json +8 -0
- package/src/locales/ru_ru.json +8 -0
- package/src/locales.ts +5 -0
- package/README.md +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@terrafirmagreg-team/changelog",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
"./lib/*": [
|
|
7
|
+
"./src/lib/*.ts",
|
|
8
|
+
"./src/lib/*.tsx",
|
|
9
|
+
"./src/lib/*/index.ts",
|
|
10
|
+
"./src/lib/*/index.tsx"
|
|
11
|
+
],
|
|
12
|
+
"./locales": "./src/locales.ts"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"fumadocs-core": "16.17.8",
|
|
16
|
+
"@terrafirmagreg-team/kit": "0.1.0",
|
|
17
|
+
"@terrafirmagreg-team/translate": "0.1.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/node": "^26.6.5"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/TerraFirmaGreg-Team/Web-Foundation.git",
|
|
25
|
+
"directory": "packages/changelog"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"src",
|
|
32
|
+
"styles",
|
|
33
|
+
"styles.css",
|
|
34
|
+
"locales"
|
|
35
|
+
]
|
|
6
36
|
}
|
package/src/lib/route.ts
ADDED
package/src/lib/tree.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type * as PageTree from 'fumadocs-core/page-tree';
|
|
2
|
+
import type { SectionTrees } from '@terrafirmagreg-team/kit/types';
|
|
3
|
+
|
|
4
|
+
function groupVersionItems(root: PageTree.Root): PageTree.Root {
|
|
5
|
+
const children: PageTree.Node[] = [];
|
|
6
|
+
const groups = new Map<string, PageTree.Folder>();
|
|
7
|
+
for (const node of root.children) {
|
|
8
|
+
const title = node.type === 'page' ? String(node.name ?? '') : '';
|
|
9
|
+
const series = /^v?(\d+)\.(\d+)/.exec(title)?.slice(1, 3).join('.');
|
|
10
|
+
if (node.type !== 'page' || !series) {
|
|
11
|
+
children.push(node);
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
let folder = groups.get(series);
|
|
15
|
+
if (!folder) {
|
|
16
|
+
folder = {
|
|
17
|
+
$id: `${root.$id ?? 'root'}:${series}`,
|
|
18
|
+
type: 'folder',
|
|
19
|
+
name: `${series}.x`,
|
|
20
|
+
children: [],
|
|
21
|
+
};
|
|
22
|
+
groups.set(series, folder);
|
|
23
|
+
children.push(folder);
|
|
24
|
+
}
|
|
25
|
+
folder.children.push(node);
|
|
26
|
+
}
|
|
27
|
+
return { ...root, children };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const groupTrees = (trees: SectionTrees): SectionTrees =>
|
|
31
|
+
Object.fromEntries(
|
|
32
|
+
Object.entries(trees).map(([lang, byDataset]) => [
|
|
33
|
+
lang,
|
|
34
|
+
Object.fromEntries(
|
|
35
|
+
Object.entries(byDataset).map(([id, root]) => [
|
|
36
|
+
id,
|
|
37
|
+
groupVersionItems(root),
|
|
38
|
+
]),
|
|
39
|
+
),
|
|
40
|
+
]),
|
|
41
|
+
);
|
package/src/locales.ts
ADDED
package/README.md
DELETED