changelog.ts — ui Source File
Architecture documentation for changelog.ts, a typescript file in the ui codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 799e6b2d_bd25_4cd9_2509_71888f55cc48["changelog.ts"] eac8f98f_e40a_7fe8_f505_372c83d20c7a["fs"] 799e6b2d_bd25_4cd9_2509_71888f55cc48 --> eac8f98f_e40a_7fe8_f505_372c83d20c7a d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5["path"] 799e6b2d_bd25_4cd9_2509_71888f55cc48 --> d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5 06cde2bf_39a5_35d7_1ddc_dcf820bafd52["front-matter"] 799e6b2d_bd25_4cd9_2509_71888f55cc48 --> 06cde2bf_39a5_35d7_1ddc_dcf820bafd52 b5f7acc2_8550_f8f0_0425_a71c6d434acd["source"] 799e6b2d_bd25_4cd9_2509_71888f55cc48 --> b5f7acc2_8550_f8f0_0425_a71c6d434acd style 799e6b2d_bd25_4cd9_2509_71888f55cc48 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import fs from "fs"
import path from "path"
import fm from "front-matter"
import { source } from "@/lib/source"
export type ChangelogPageData = {
title: string
description?: string
}
export type ChangelogPage = ReturnType<typeof source.getPages>[number] & {
date: Date | null
}
// Reads the date from the frontmatter of a changelog file.
export function getDateFromFile(slugs: string[]) {
const filePath = path.join(
process.cwd(),
"content/docs",
...slugs.slice(0, -1),
`${slugs[slugs.length - 1]}.mdx`
)
try {
const content = fs.readFileSync(filePath, "utf-8")
const { attributes } = fm<{ date?: string | Date }>(content)
if (attributes.date) {
return new Date(attributes.date)
}
} catch {
// File not found or parse error.
}
return null
}
// Gets all changelog pages sorted by date descending.
export function getChangelogPages() {
return source
.getPages()
.filter((page) => page.slugs[0] === "changelog" && page.slugs.length > 1)
.map((page) => ({
...page,
date: getDateFromFile(page.slugs),
}))
.sort((a, b) => {
const dateA = a.date?.getTime() ?? 0
const dateB = b.date?.getTime() ?? 0
return dateB - dateA
})
}
Domain
Subdomains
Functions
Dependencies
- front-matter
- fs
- path
- source
Source
Frequently Asked Questions
What does changelog.ts do?
changelog.ts is a source file in the ui codebase, written in typescript. It belongs to the DocumentationAtlas domain, Changelog subdomain.
What functions are defined in changelog.ts?
changelog.ts defines 2 function(s): getChangelogPages, getDateFromFile.
What does changelog.ts depend on?
changelog.ts imports 4 module(s): front-matter, fs, path, source.
Where is changelog.ts in the architecture?
changelog.ts is located at apps/v4/lib/changelog.ts (domain: DocumentationAtlas, subdomain: Changelog, directory: apps/v4/lib).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free