This commit is contained in:
parent
9d0a823351
commit
d74495ddef
936 changed files with 80 additions and 69 deletions
|
|
@ -2,7 +2,7 @@ import fs from "node:fs";
|
|||
import path from "node:path";
|
||||
|
||||
export const repoRoot = process.cwd();
|
||||
export const websiteRoot = path.join(repoRoot, "website");
|
||||
export const legacyHtmlRoot = path.join(repoRoot, "archive-source");
|
||||
export const migratedHtmlPages = new Set([
|
||||
"about.html",
|
||||
"contact.html",
|
||||
|
|
@ -13,7 +13,7 @@ export const migratedHtmlPages = new Set([
|
|||
"videos.html",
|
||||
]);
|
||||
|
||||
export function walkHtmlFiles(dir = websiteRoot): string[] {
|
||||
export function walkHtmlFiles(dir = legacyHtmlRoot): string[] {
|
||||
return fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
|
||||
const fullPath = path.join(dir, entry.name);
|
||||
if (entry.isDirectory()) {
|
||||
|
|
@ -24,7 +24,7 @@ export function walkHtmlFiles(dir = websiteRoot): string[] {
|
|||
}
|
||||
|
||||
export function relativeWebsitePath(filePath: string): string {
|
||||
return path.relative(websiteRoot, filePath).split(path.sep).join("/");
|
||||
return path.relative(legacyHtmlRoot, filePath).split(path.sep).join("/");
|
||||
}
|
||||
|
||||
export function routeFromRelativePath(relativePath: string): string {
|
||||
|
|
@ -41,5 +41,5 @@ export function isMigratedHtmlPage(relativePath: string): boolean {
|
|||
|
||||
export function sourcePathFromRoute(route = ""): string {
|
||||
const relativePath = route === "" ? "index.html" : route.endsWith(".html") ? route : `${route}/index.html`;
|
||||
return path.join(websiteRoot, relativePath);
|
||||
return path.join(legacyHtmlRoot, relativePath);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue