run linter and adjust config
This commit is contained in:
parent
9f62303e6f
commit
85c9b072ce
15 changed files with 72 additions and 99 deletions
|
|
@ -1,11 +0,0 @@
|
||||||
steps:
|
|
||||||
- name: Build and Push Image
|
|
||||||
when:
|
|
||||||
- event: push
|
|
||||||
branch: main
|
|
||||||
image: woodpeckerci/plugin-docker-buildx
|
|
||||||
settings:
|
|
||||||
repo: registry.lio.systems/wrath
|
|
||||||
registry: registry.lio.systems
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
tag: dev
|
|
||||||
|
|
@ -21,4 +21,5 @@ FROM base AS release
|
||||||
COPY --from=install /temp/prod/node_modules node_modules
|
COPY --from=install /temp/prod/node_modules node_modules
|
||||||
COPY --from=build /usr/src/app/dist .
|
COPY --from=build /usr/src/app/dist .
|
||||||
|
|
||||||
|
EXPOSE 4321
|
||||||
ENTRYPOINT [ "bun", "run", "./server/entry.mjs" ]
|
ENTRYPOINT [ "bun", "run", "./server/entry.mjs" ]
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import node from "@astrojs/node";
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
output: "static",
|
output: "static",
|
||||||
prefetch: true,
|
prefetch: true,
|
||||||
site: import.meta.env.PROD ? "https://lio.cat" : 'http://localhost:4321',
|
site: import.meta.env.PROD === 'true' ? "https://lio.cat" : 'http://localhost:4321',
|
||||||
|
|
||||||
markdown: {
|
markdown: {
|
||||||
remarkRehype: {},
|
remarkRehype: {},
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ const config = lang === "de" ? de : en
|
||||||
---
|
---
|
||||||
|
|
||||||
<header class="flex h-24 w-auto flex-row items-center justify-end pr-5">
|
<header class="flex h-24 w-auto flex-row items-center justify-end pr-5">
|
||||||
<div class="flex items-center gap-6 dark:text-amber-400 text-blue-700">
|
<div class="flex items-center gap-6 text-blue-700 dark:text-amber-400">
|
||||||
{
|
{
|
||||||
config.rss && (
|
config.rss && (
|
||||||
<a
|
<a
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ const { home, archive, custom, links, about } =
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-row flex-wrap gap-4 text-lg pt-1">
|
<div class="flex flex-row flex-wrap gap-4 pt-1 text-lg">
|
||||||
{
|
{
|
||||||
custom?.map((tab) => (
|
custom?.map((tab) => (
|
||||||
<a
|
<a
|
||||||
|
|
|
||||||
|
|
@ -8,17 +8,17 @@ const lang = getLangFromUrl(Astro.url)
|
||||||
const t = useTranslations(lang)
|
const t = useTranslations(lang)
|
||||||
|
|
||||||
const allPosts = await getPostsByLocale(lang)
|
const allPosts = await getPostsByLocale(lang)
|
||||||
const posts = allPosts.slice(0, common.latestPosts).filter(p => p.data.published)
|
const posts = allPosts
|
||||||
|
.slice(0, common.latestPosts)
|
||||||
|
.filter((p) => p.data.published)
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="my-8 text-xl font-medium md:my-8">{(posts.length > 0) && t("blog.latest")}</div>
|
<div class="my-8 text-xl font-medium md:my-8">
|
||||||
{ (posts.length > 0) &&
|
{posts.length > 0 && t("blog.latest")}
|
||||||
|
</div>
|
||||||
|
{
|
||||||
|
posts.length > 0 &&
|
||||||
posts.map((post: any) => (
|
posts.map((post: any) => (
|
||||||
<PostList
|
<PostList post={post} lang={lang} dateFormat="locale" dateWidth="w-32" />
|
||||||
post={post}
|
|
||||||
lang={lang}
|
|
||||||
dateFormat="locale"
|
|
||||||
dateWidth="w-32"
|
|
||||||
/>
|
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,7 @@ export const common = {
|
||||||
url: "https://lio.cat",
|
url: "https://lio.cat",
|
||||||
},
|
},
|
||||||
googleAnalyticsId: "",
|
googleAnalyticsId: "",
|
||||||
social: [
|
social: [],
|
||||||
],
|
|
||||||
rss: true,
|
rss: true,
|
||||||
navigation: {
|
navigation: {
|
||||||
home: true,
|
home: true,
|
||||||
|
|
@ -95,7 +94,6 @@ export const en = {
|
||||||
},
|
},
|
||||||
navigation: {
|
navigation: {
|
||||||
...common.navigation,
|
...common.navigation,
|
||||||
|
|
||||||
},
|
},
|
||||||
pageMeta: {
|
pageMeta: {
|
||||||
archive: {
|
archive: {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ const postSchema = z.object({
|
||||||
slug: z.string().optional(),
|
slug: z.string().optional(),
|
||||||
tags: z.array(z.string()).optional(),
|
tags: z.array(z.string()).optional(),
|
||||||
published: z.boolean().optional().default(false),
|
published: z.boolean().optional().default(false),
|
||||||
lang: z.string().optional()
|
lang: z.string().optional(),
|
||||||
})
|
})
|
||||||
|
|
||||||
const enPostsCollection = defineCollection({
|
const enPostsCollection = defineCollection({
|
||||||
|
|
@ -19,7 +19,7 @@ const enPostsCollection = defineCollection({
|
||||||
|
|
||||||
const dePostsCollection = defineCollection({
|
const dePostsCollection = defineCollection({
|
||||||
loader: glob({ pattern: "**/*.{md,mdx}", base: "src/content/posts/de" }),
|
loader: glob({ pattern: "**/*.{md,mdx}", base: "src/content/posts/de" }),
|
||||||
schema: postSchema
|
schema: postSchema,
|
||||||
})
|
})
|
||||||
|
|
||||||
export const collections = {
|
export const collections = {
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,14 @@ const urls = {
|
||||||
|
|
||||||
const isPost = Astro.url.pathname.includes("posts")
|
const isPost = Astro.url.pathname.includes("posts")
|
||||||
|
|
||||||
const ogImageURL = new URL(isPost ? urls.postURL : urls.general, Astro.site).href
|
const ogImageURL = new URL(isPost ? urls.postURL : urls.general, Astro.site)
|
||||||
|
.href
|
||||||
const permalink = new URL(Astro.url.pathname, Astro.site).href
|
const permalink = new URL(Astro.url.pathname, Astro.site).href
|
||||||
const config = lang === "de" ? de : en
|
const config = lang === "de" ? de : en
|
||||||
const title = isPost
|
const title = isPost
|
||||||
? `${post.title} - ${config.meta.title}`
|
? `${post.title} - ${config.meta.title}`
|
||||||
: `${config.meta.description} - ${config.meta.title}`
|
: `${config.meta.description} - ${config.meta.title}`
|
||||||
const description = isPost ? post.description : config.meta.description
|
const description = isPost ? post.description : config.meta.description
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
|
|
@ -39,35 +39,20 @@ const description = isPost ? post.description : config.meta.description
|
||||||
{title}
|
{title}
|
||||||
</title>
|
</title>
|
||||||
<meta name="generator" content={Astro.generator} />
|
<meta name="generator" content={Astro.generator} />
|
||||||
<meta
|
<meta name="description" content={description} />
|
||||||
name="description"
|
|
||||||
content={description}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- Open Graph / Facebook -->
|
<!-- Open Graph / Facebook -->
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta property="og:url" content={permalink} />
|
<meta property="og:url" content={permalink} />
|
||||||
<meta
|
<meta property="og:title" content={title} />
|
||||||
property="og:title"
|
<meta property="og:description" content={description} />
|
||||||
content={title}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
property="og:description"
|
|
||||||
content={description}
|
|
||||||
/>
|
|
||||||
<meta property="og:image" content={ogImageURL} />
|
<meta property="og:image" content={ogImageURL} />
|
||||||
|
|
||||||
<!-- Twitter -->
|
<!-- Twitter -->
|
||||||
<meta property="twitter:card" content="summary_large_image" />
|
<meta property="twitter:card" content="summary_large_image" />
|
||||||
<meta property="twitter:url" content={permalink} />
|
<meta property="twitter:url" content={permalink} />
|
||||||
<meta
|
<meta property="twitter:title" content={title} />
|
||||||
property="twitter:title"
|
<meta property="twitter:description" content={description} />
|
||||||
content={title}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
property="twitter:description"
|
|
||||||
content={description}
|
|
||||||
/>
|
|
||||||
<meta property="twitter:image" content={ogImageURL} />
|
<meta property="twitter:image" content={ogImageURL} />
|
||||||
|
|
||||||
<script is:inline>
|
<script is:inline>
|
||||||
|
|
|
||||||
|
|
@ -5,24 +5,24 @@ import Navigation from "~/components/astro/nav.astro"
|
||||||
import { de, en } from "~/config"
|
import { de, en } from "~/config"
|
||||||
import { getLangFromUrl } from "~/i18n/utils"
|
import { getLangFromUrl } from "~/i18n/utils"
|
||||||
import BaseLayout from "~/layouts/base.astro"
|
import BaseLayout from "~/layouts/base.astro"
|
||||||
import '@fontsource-variable/jetbrains-mono';
|
import "@fontsource-variable/jetbrains-mono"
|
||||||
|
|
||||||
const { title, description, post } = Astro.props
|
const { title, description, post } = Astro.props
|
||||||
const lang = getLangFromUrl(Astro.url)
|
const lang = getLangFromUrl(Astro.url)
|
||||||
const config = lang === "de" ? de : en
|
const config = lang === "de" ? de : en
|
||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout
|
<BaseLayout title={title} description={description} post={post}>
|
||||||
title={title}
|
<div class="flex w-full max-w-4xl flex-col p-2 pt-5">
|
||||||
description={description}
|
|
||||||
post={post}
|
|
||||||
>
|
|
||||||
<div class="flex w-full max-w-4xl flex-col pt-5 p-2">
|
|
||||||
<div class="flex w-full items-center justify-end pb-4">
|
<div class="flex w-full items-center justify-end pb-4">
|
||||||
<a href="/" aria-label={`${config.siteName}`} class="mr-auto">
|
<a href="/" aria-label={`${config.siteName}`} class="mr-auto">
|
||||||
<!-- <div class="text-4xl font-semibold">{config.siteName}</div> -->
|
<!-- <div class="text-4xl font-semibold">{config.siteName}</div> -->
|
||||||
<img src="/images/general/logo-dark.png" alt="" class="dark:hidden">
|
<img src="/images/general/logo-dark.png" alt="" class="dark:hidden" />
|
||||||
<img src="/images/general/logo-light.png" alt="" class="hidden dark:block">
|
<img
|
||||||
|
src="/images/general/logo-light.png"
|
||||||
|
alt=""
|
||||||
|
class="hidden dark:block"
|
||||||
|
/>
|
||||||
</a>
|
</a>
|
||||||
<Header />
|
<Header />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ const lang = getLangFromUrl(Astro.url)
|
||||||
const { post } = Astro.props
|
const { post } = Astro.props
|
||||||
|
|
||||||
const { Content } = await render(post)
|
const { Content } = await render(post)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<MainLayout post={{ ...post.data }}>
|
<MainLayout post={{ ...post.data }}>
|
||||||
|
|
@ -35,7 +34,7 @@ const { Content } = await render(post)
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
<h2 class="!my-0 text-3xl font-semibold">{post.data.title}</h2>
|
<h2 class="!my-0 text-3xl font-semibold">{post.data.title}</h2>
|
||||||
<div class="my-3 text-gray-500 dark:text-white/80">
|
<div class="my-3 text-gray-500 dark:text-white/80">
|
||||||
{formatDate(post.data.pubDate, 'locale', lang)}
|
{formatDate(post.data.pubDate, "locale", lang)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ export async function GET({ props }: Props) {
|
||||||
width: 1200,
|
width: 1200,
|
||||||
height: 600,
|
height: 600,
|
||||||
padding: 10,
|
padding: 10,
|
||||||
color: '#FFB900'
|
color: "#FFB900",
|
||||||
}
|
}
|
||||||
const { post } = props
|
const { post } = props
|
||||||
const path = join(process.cwd(), "public", "fonts", "JetBrainsMono-Bold.ttf")
|
const path = join(process.cwd(), "public", "fonts", "JetBrainsMono-Bold.ttf")
|
||||||
|
|
@ -35,7 +35,7 @@ export async function GET({ props }: Props) {
|
||||||
// Astro doesn't support tsx endpoints so usign React-element objects
|
// Astro doesn't support tsx endpoints so usign React-element objects
|
||||||
const html = {
|
const html = {
|
||||||
type: "div",
|
type: "div",
|
||||||
key: 'extra-margin',
|
key: "extra-margin",
|
||||||
props: {
|
props: {
|
||||||
style: {
|
style: {
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
|
@ -97,7 +97,7 @@ export async function GET({ props }: Props) {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
} as unknown as ReactElement;
|
} as unknown as ReactElement
|
||||||
|
|
||||||
return new ImageResponse(html, {
|
return new ImageResponse(html, {
|
||||||
width: options.width,
|
width: options.width,
|
||||||
|
|
@ -112,4 +112,3 @@ export async function GET({ props }: Props) {
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,16 +6,18 @@
|
||||||
@custom-variant light (&:where(.light, .light *));
|
@custom-variant light (&:where(.light, .light *));
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: 'JetBrains Mono Variable', monospace;
|
font-family: "JetBrains Mono Variable", monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-links, .markdown-link {
|
.nav-links,
|
||||||
|
.markdown-link {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-right: 1em;
|
padding-right: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.markdown-link::after, .nav-links::after {
|
.markdown-link::after,
|
||||||
|
.nav-links::after {
|
||||||
content: "↗";
|
content: "↗";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0.1em;
|
right: 0.1em;
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,12 @@ import { twMerge } from "tailwind-merge"
|
||||||
export const formatDate = (
|
export const formatDate = (
|
||||||
date: Date | string | undefined,
|
date: Date | string | undefined,
|
||||||
format: string = "YYYY-MM-DD",
|
format: string = "YYYY-MM-DD",
|
||||||
locale?:string
|
locale?: string,
|
||||||
): string => {
|
): string => {
|
||||||
const validDate = date ? new Date(date) : new Date()
|
const validDate = date ? new Date(date) : new Date()
|
||||||
|
|
||||||
if(format === "locale") return validDate.toLocaleString(locale, {
|
if (format === "locale")
|
||||||
|
return validDate.toLocaleString(locale, {
|
||||||
day: "numeric",
|
day: "numeric",
|
||||||
month: "long",
|
month: "long",
|
||||||
year: "numeric",
|
year: "numeric",
|
||||||
|
|
@ -34,8 +35,8 @@ export const getPostsByLocale = async (locale: string) => {
|
||||||
: await getCollection("dePosts")
|
: await getCollection("dePosts")
|
||||||
// Add the locale to the data of each post
|
// Add the locale to the data of each post
|
||||||
posts.forEach((post: any) => {
|
posts.forEach((post: any) => {
|
||||||
post.data.lang = locale;
|
post.data.lang = locale
|
||||||
});
|
})
|
||||||
return posts.sort(
|
return posts.sort(
|
||||||
(a: any, b: any) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
|
(a: any, b: any) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -69,4 +69,3 @@ export function remarkCustomLinks(options: CustomLinkOptions = {}): Plugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue