packages/cli/src/lib/types.ts 1.9 K raw
1
export interface FrontmatterMapping {
2
	title?: string; // Field name for title (default: "title")
3
	description?: string; // Field name for description (default: "description")
4
	publishDate?: string; // Field name for publish date (default: "publishDate", also checks "pubDate", "date", "createdAt", "created_at")
5
	coverImage?: string; // Field name for cover image (default: "ogImage")
6
	tags?: string; // Field name for tags (default: "tags")
7
}
8
9
export interface PublisherConfig {
10
	siteUrl: string;
11
	contentDir: string;
12
	imagesDir?: string; // Directory containing cover images
13
	publicDir?: string; // Static/public folder for .well-known files (default: public)
14
	outputDir?: string; // Built output directory for inject command
15
	pathPrefix?: string; // URL path prefix for posts (default: /posts)
16
	publicationUri: string;
17
	pdsUrl?: string;
18
	identity?: string; // Which stored identity to use (matches identifier)
19
	frontmatter?: FrontmatterMapping; // Custom frontmatter field mappings
20
	ignore?: string[]; // Glob patterns for files to ignore (e.g., ["_index.md", "**/drafts/**"])
21
}
22
23
export interface Credentials {
24
	pdsUrl: string;
25
	identifier: string;
26
	password: string;
27
}
28
29
export interface PostFrontmatter {
30
	title: string;
31
	description?: string;
32
	publishDate: string;
33
	tags?: string[];
34
	ogImage?: string;
35
	atUri?: string;
36
}
37
38
export interface BlogPost {
39
	filePath: string;
40
	slug: string;
41
	frontmatter: PostFrontmatter;
42
	content: string;
43
	rawContent: string;
44
}
45
46
export interface BlobRef {
47
	$link: string;
48
}
49
50
export interface BlobObject {
51
	$type: "blob";
52
	ref: BlobRef;
53
	mimeType: string;
54
	size: number;
55
}
56
57
export interface PublisherState {
58
	posts: Record<string, PostState>;
59
}
60
61
export interface PostState {
62
	contentHash: string;
63
	atUri?: string;
64
	lastPublished?: string;
65
}
66
67
export interface PublicationRecord {
68
	$type: "site.standard.publication";
69
	url: string;
70
	name: string;
71
	description?: string;
72
	icon?: BlobObject;
73
	createdAt: string;
74
	preferences?: {
75
		showInDiscover?: boolean;
76
	};
77
}