cosmolo 0.5.1 → 0.5.2
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.
|
@@ -39,7 +39,7 @@ function generateDrizzleSchema() {
|
|
|
39
39
|
function generateArticlesCrud() {
|
|
40
40
|
return `import { drizzle } from 'drizzle-orm/d1';
|
|
41
41
|
import { and, desc, eq, sql } from 'drizzle-orm';
|
|
42
|
-
import { articles } from '
|
|
42
|
+
import { articles } from '../../../drizzle/schema';
|
|
43
43
|
|
|
44
44
|
export function createDb(d1: D1Database) {
|
|
45
45
|
return drizzle(d1);
|
|
@@ -111,7 +111,7 @@ export async function deleteArticle(d1: D1Database, slug: string) {
|
|
|
111
111
|
function generateCategoriesCrud() {
|
|
112
112
|
return `import { drizzle } from 'drizzle-orm/d1';
|
|
113
113
|
import { eq } from 'drizzle-orm';
|
|
114
|
-
import { categories } from '
|
|
114
|
+
import { categories } from '../../../drizzle/schema';
|
|
115
115
|
|
|
116
116
|
export function createDb(d1: D1Database) {
|
|
117
117
|
return drizzle(d1);
|
|
@@ -174,9 +174,18 @@ export const load: PageServerLoad = async ({ params, platform }) => {
|
|
|
174
174
|
if (!raw) error(404, 'Article not found');
|
|
175
175
|
const article = {
|
|
176
176
|
...parseArticle(raw),
|
|
177
|
-
|
|
177
|
+
html: await marked(raw.body ?? ''),
|
|
178
|
+
toc: [],
|
|
179
|
+
};
|
|
180
|
+
return {
|
|
181
|
+
article,
|
|
182
|
+
categories,
|
|
183
|
+
updatedAt: raw.updated_at ?? '',
|
|
184
|
+
related: [],
|
|
185
|
+
seriesTotal: 0,
|
|
186
|
+
seriesPrev: null,
|
|
187
|
+
seriesNext: null,
|
|
178
188
|
};
|
|
179
|
-
return { article, categories };
|
|
180
189
|
};
|
|
181
190
|
`;
|
|
182
191
|
}
|
|
@@ -196,7 +205,9 @@ export const load: PageServerLoad = async ({ params, platform }) => {
|
|
|
196
205
|
if (!category) error(404, 'Category not found');
|
|
197
206
|
return {
|
|
198
207
|
articles: rawArticles.map(parseArticle),
|
|
199
|
-
category,
|
|
208
|
+
label: category.label,
|
|
209
|
+
description: category.description ?? '',
|
|
210
|
+
slug: params.slug,
|
|
200
211
|
articlesPerPage: siteConfig.articlesPerPage ?? 10,
|
|
201
212
|
};
|
|
202
213
|
};
|