fix build
This commit is contained in:
parent
6969858727
commit
3b80a0602f
@ -1,12 +1,13 @@
|
|||||||
import { error } from "@sveltejs/kit";
|
import { error } from '@sveltejs/kit'
|
||||||
import fm from "front-matter";
|
import fm from 'front-matter'
|
||||||
import { readFile } from "fs";
|
import { readFile } from 'fs'
|
||||||
import { parseField } from "$lib/markdown/parse-markdown";
|
import { parseField } from '$lib/markdown/parse-markdown'
|
||||||
import { promisify } from "util";
|
import { promisify } from 'util'
|
||||||
|
|
||||||
export interface ArticleAttributes {
|
export interface ArticleAttributes {
|
||||||
slug: string
|
slug: string
|
||||||
layout: string
|
layout: string
|
||||||
|
segments: string[]
|
||||||
title: string
|
title: string
|
||||||
published: boolean
|
published: boolean
|
||||||
date: string
|
date: string
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { format } from 'date-fns'
|
import { format } from 'date-fns'
|
||||||
import type { ArticleContent } from '$lib/content/articleContentListing'
|
import type { ArticlePreviewAttributes } from '$lib/articleContent/articleContentListing'
|
||||||
import SvgIcon from './SvgIcon.svelte'
|
import SvgIcon from './SvgIcon.svelte'
|
||||||
import {
|
import {
|
||||||
boldClass,
|
boldClass,
|
||||||
@ -22,7 +22,7 @@
|
|||||||
licenceText,
|
licenceText,
|
||||||
} from './Footer.css'
|
} from './Footer.css'
|
||||||
|
|
||||||
export let latestPosts: ArticleContent[]
|
export let latestPosts: ArticlePreviewAttributes[]
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<footer class="site-footer navigation-theme {siteFooterClass}">
|
<footer class="site-footer navigation-theme {siteFooterClass}">
|
||||||
@ -61,7 +61,7 @@
|
|||||||
<ul class={listUlClass}>
|
<ul class={listUlClass}>
|
||||||
{#each latestPosts as post}
|
{#each latestPosts as post}
|
||||||
<li class={listLiClass}>
|
<li class={listLiClass}>
|
||||||
<a rel="prefetch" href="/blog/{post.slug}">
|
<a rel="prefetch" href="/{post.segments[0]}/{post.slug}">
|
||||||
<span>{post.title}</span>
|
<span>{post.title}</span>
|
||||||
<time class="date {dateClass}" datetime={post.date}>
|
<time class="date {dateClass}" datetime={post.date}>
|
||||||
- {format(new Date(post.date), 'do MMM, yyyy')}
|
- {format(new Date(post.date), 'do MMM, yyyy')}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { splitEvery } from 'ramda'
|
import { init, splitEvery } from 'ramda'
|
||||||
|
|
||||||
export function parseParams(params: string) {
|
export function parseParams(params: string) {
|
||||||
const splittedParams = params.split('/')
|
let splittedParams = params.split('/')
|
||||||
if (splittedParams.length % 2 !== 0) {
|
if (splittedParams.length % 2 !== 0) {
|
||||||
return []
|
splittedParams = init(splittedParams)
|
||||||
}
|
}
|
||||||
const splits = splitEvery(2, splittedParams)
|
const splits = splitEvery(2, splittedParams)
|
||||||
return Object.fromEntries(splits)
|
return Object.fromEntries(splits)
|
||||||
|
@ -18,7 +18,9 @@ export function dropAndTake<Item>({ offset = 0, limit = Infinity }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
export function filterByPropContains<Item extends Record<string, any>>(filters: Record<string, string>) {
|
export function filterByPropContains<Item extends Record<string, any>>(
|
||||||
|
filters: Record<string, string>
|
||||||
|
) {
|
||||||
return function (items: Item[]) {
|
return function (items: Item[]) {
|
||||||
return items.filter((item) => {
|
return items.filter((item) => {
|
||||||
return Object.entries(filters).every(([fieldName, value]) =>
|
return Object.entries(filters).every(([fieldName, value]) =>
|
||||||
@ -34,7 +36,6 @@ export function filterAndCount<Item extends Record<string, any>>({
|
|||||||
...dropTakeParams
|
...dropTakeParams
|
||||||
}: PaginationQuery) {
|
}: PaginationQuery) {
|
||||||
return function (items: Item[]) {
|
return function (items: Item[]) {
|
||||||
console.log(filters);
|
|
||||||
const filterFunction = filters
|
const filterFunction = filters
|
||||||
? filterByPropContains<Item>(filters)
|
? filterByPropContains<Item>(filters)
|
||||||
: identity
|
: identity
|
||||||
|
@ -8,7 +8,6 @@ import type { RequestHandler } from './$types'
|
|||||||
|
|
||||||
export const prerender = true
|
export const prerender = true
|
||||||
export const GET = (async ({ params }) => {
|
export const GET = (async ({ params }) => {
|
||||||
console.log(params);
|
|
||||||
const handledParams = params.params === 'index' ? '' : params.params
|
const handledParams = params.params === 'index' ? '' : params.params
|
||||||
const { page = 1, pageSize = 7, ...filters } = parseParams(handledParams)
|
const { page = 1, pageSize = 7, ...filters } = parseParams(handledParams)
|
||||||
const paginationParams = getDropTakeFromPageParams(
|
const paginationParams = getDropTakeFromPageParams(
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
import { getBlogListing } from '$lib/articleContent/articleContentListing'
|
||||||
import { Feed } from 'feed'
|
import { Feed } from 'feed'
|
||||||
import { getBlogListing } from './blog/content'
|
|
||||||
|
|
||||||
export async function getFeed() {
|
export async function getFeed() {
|
||||||
const feed = new Feed({
|
const feed = new Feed({
|
||||||
|
Loading…
Reference in New Issue
Block a user