sitegen/src/site.ts

116 lines
3.1 KiB
TypeScript
Raw Normal View History

const join = (...paths: string[]) => path.join(import.meta.dirname, ...paths);
2025-08-14 20:35:33 -07:00
// Different sections of the website are split into their own folders. Acting as
// as separate codebases, they are hosted as one. This allows me to have
// sub-projects like the file viewer in 'file/', and the question answer system
// in 'q+a', but maintain clear boundaries. Each section can define
// configuration, pages, backend routes, and contain other files.
export const siteSections: sg.Section[] = [
{ root: join(".") },
{ root: join("q+a/") },
{ root: join("file-viewer/") },
{ root: join("friends/") },
// { root: join("blog/"), pageBase: "/blog" },
// { root: join("fiction/"), pageBase: "/fiction" },
];
2025-08-14 20:35:33 -07:00
// All backends are bundled. The backend named "backend" is run by "node run watch"
export const backends: string[] = [
join("backend.ts"),
join("source-of-truth.ts"),
];
export const meta: MetaTemplate = {
base: new URL("https://paperclover.net"),
generator: true,
};
2025-08-14 20:35:33 -07:00
// Font subsets reduce bandwidth and protect against proprietary font theft.
const fontRoot = path.join(nasRoot, "Documents/Font");
2025-08-14 20:35:33 -07:00
const ascii = { start: 0x20, end: 0x7E };
const nonAscii: sg.FontRange[] = [
{ start: 0xC0, end: 0xFF },
{ start: 0x2190, end: 0x2193 },
{ start: 0xA0, end: 0xA8 },
{ start: 0xAA, end: 0xBF },
{ start: 0x2194, end: 0x2199 },
{ start: 0x100, end: 0x17F },
0xA9,
0x2018,
0x2019,
0x201C,
0x201D,
0x2022,
];
const recursiveVars: sg.FontVars = {
WGHT: [400, 750],
SLNT: [-15, 0],
CASL: 0.25,
CRSV: 0.5,
MONO: 0,
};
const recursiveVarsMono = { ...recursiveVars, MONO: 1 };
const recursiveVarsQuestion: sg.FontVars = {
...recursiveVars,
MONO: [0, 1],
WGHT: [400, 1000],
};
const layoutFeatures = ["numr", "dnom", "frac"];
export const fonts: sg.Font[] = [
{
name: "Recursive",
sources: [
"Recursive_VF_1.085.ttf",
path.join(fontRoot, "/ArrowType/Recursive/Recursive_VF_1.085.ttf"),
"https://paperclover.net/file/_unlisted/Recursive_VF_1.085.ttf",
],
subsets: [
{
asset: "/recultramin.[ext]",
layoutFeatures,
vars: recursiveVars,
unicodes: ascii,
},
{
asset: "/recmono.[ext]",
vars: recursiveVarsMono,
unicodes: ascii,
},
{
asset: "/recqa.[ext]",
vars: recursiveVarsQuestion,
unicodes: ascii,
},
{
asset: "/recexotic.[ext]",
vars: recursiveVarsQuestion,
unicodes: nonAscii,
},
],
},
{
name: "AT Name Sans Display Hairline",
sources: [
"ATNameSansDisplay-Hairline.woff2",
2025-08-21 00:00:31 -07:00
path.join(fontRoot, "/ArrowType/AT Name Sans Display/ATNameSansDisplay-Hairline.woff2"),
2025-08-14 20:35:33 -07:00
],
subsets: [
{
asset: "/cydn_header.[ext]",
layoutFeatures,
unicodes: "cotlyedon",
},
],
},
];
export async function main() {
await font.buildFonts(fonts);
}
import * as path from "node:path";
2025-08-14 20:35:33 -07:00
import * as font from "../framework/font.ts";
import type { Template as MetaTemplate } from "#sitegen/meta";
2025-08-14 20:35:33 -07:00
import type * as sg from "#sitegen";
import { nasRoot } from "./file-viewer/paths.ts";