build site with bun (#32)
This commit is contained in:
parent
3a886c4493
commit
bf087a566f
12 changed files with 100 additions and 9447 deletions
12
.github/workflows/test.yml
vendored
12
.github/workflows/test.yml
vendored
|
@ -13,11 +13,11 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node
|
- name: Setup Bun
|
||||||
uses: actions/setup-node@v4
|
uses: oven-sh/setup-bun@v2
|
||||||
with:
|
with:
|
||||||
node-version: "latest"
|
bun-version: "latest"
|
||||||
- name: Run Node install and build
|
- name: Run Bun install and build
|
||||||
run: |
|
run: |
|
||||||
npm ci
|
bun install --frozen-lockfile
|
||||||
npm run build
|
bun run build
|
||||||
|
|
10
Dockerfile
10
Dockerfile
|
@ -1,12 +1,12 @@
|
||||||
FROM node:alpine as node
|
FROM oven/bun:alpine as bun
|
||||||
USER node
|
USER bun
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN ["npm", "ci"]
|
RUN ["bun", "install", "--frozen-lockfile"]
|
||||||
RUN ["npm", "run", "build"]
|
RUN ["bun", "run", "build"]
|
||||||
|
|
||||||
FROM ghcr.io/static-web-server/static-web-server:latest
|
FROM ghcr.io/static-web-server/static-web-server:latest
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
COPY --from=node /usr/src/app/dist /public
|
COPY --from=bun /usr/src/app/dist /public
|
||||||
|
|
|
@ -4,11 +4,29 @@ import rehypeExternalLinks from "rehype-external-links";
|
||||||
import mdx from "@astrojs/mdx";
|
import mdx from "@astrojs/mdx";
|
||||||
import tailwind from "@astrojs/tailwind";
|
import tailwind from "@astrojs/tailwind";
|
||||||
import icon from "astro-icon";
|
import icon from "astro-icon";
|
||||||
|
import expressiveCode from "astro-expressive-code";
|
||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
site: "https://troylusty.com",
|
site: "https://troylusty.com",
|
||||||
integrations: [sitemap(), mdx(), tailwind(), icon()],
|
integrations: [
|
||||||
|
sitemap(),
|
||||||
|
expressiveCode({
|
||||||
|
themes: ["github-dark-default", "github-light-default"],
|
||||||
|
defaultProps: {
|
||||||
|
frame: "none",
|
||||||
|
wrap: true,
|
||||||
|
},
|
||||||
|
styleOverrides: {
|
||||||
|
frames: {
|
||||||
|
shadowColor: "none",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
mdx(),
|
||||||
|
tailwind(),
|
||||||
|
icon(),
|
||||||
|
],
|
||||||
output: "static",
|
output: "static",
|
||||||
markdown: {
|
markdown: {
|
||||||
rehypePlugins: [
|
rehypePlugins: [
|
||||||
|
@ -19,10 +37,6 @@ export default defineConfig({
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
shikiConfig: {
|
|
||||||
wrap: true,
|
|
||||||
},
|
|
||||||
syntaxHighlight: false,
|
|
||||||
},
|
},
|
||||||
image: {
|
image: {
|
||||||
service: passthroughImageService(),
|
service: passthroughImageService(),
|
||||||
|
|
BIN
bun.lockb
Executable file
BIN
bun.lockb
Executable file
Binary file not shown.
9381
package-lock.json
generated
9381
package-lock.json
generated
File diff suppressed because it is too large
Load diff
25
package.json
25
package.json
|
@ -12,26 +12,27 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/check": "0.9.4",
|
"@astrojs/check": "0.9.4",
|
||||||
"@astrojs/mdx": "^4.0.3",
|
"@astrojs/mdx": "^4.0.6",
|
||||||
"@astrojs/rss": "^4.0.11",
|
"@astrojs/rss": "^4.0.11",
|
||||||
"@astrojs/sitemap": "3.2.1",
|
"@astrojs/sitemap": "3.2.1",
|
||||||
"@astrojs/tailwind": "^5.1.4",
|
"@astrojs/tailwind": "^5.1.4",
|
||||||
"@fontsource-variable/outfit": "^5.1.1",
|
"@fontsource-variable/outfit": "^5.1.1",
|
||||||
"@fontsource-variable/red-hat-mono": "^5.1.0",
|
"@fontsource-variable/red-hat-mono": "^5.1.1",
|
||||||
"@fontsource/borel": "^5.1.1",
|
"@fontsource/borel": "^5.1.1",
|
||||||
"astro": "^5.1.6",
|
"astro": "^5.1.7",
|
||||||
"astro-icon": "^1.1.4",
|
"astro-expressive-code": "^0.40.1",
|
||||||
|
"astro-icon": "^1.1.5",
|
||||||
"rehype-external-links": "^3.0.0",
|
"rehype-external-links": "^3.0.0",
|
||||||
"tailwindcss": "^3.4.15",
|
"tailwindcss": "^3.4.17",
|
||||||
"typescript": "^5.7.2"
|
"typescript": "^5.7.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@iconify-json/mdi": "^1.2.1",
|
"@iconify-json/mdi": "^1.2.2",
|
||||||
"@iconify-json/simple-icons": "^1.2.18",
|
"@iconify-json/simple-icons": "^1.2.20",
|
||||||
"@tailwindcss/typography": "^0.5.15",
|
"@tailwindcss/typography": "^0.5.16",
|
||||||
"@types/node": "^22.10.6",
|
"@types/node": "^22.10.7",
|
||||||
"prettier": "^3.4.1",
|
"prettier": "^3.4.2",
|
||||||
"prettier-plugin-astro": "^0.14.1",
|
"prettier-plugin-astro": "^0.14.1",
|
||||||
"prettier-plugin-tailwindcss": "^0.6.9"
|
"prettier-plugin-tailwindcss": "^0.6.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{pkgs ? import <nixpkgs> {}}:
|
{pkgs ? import <nixpkgs> {}}:
|
||||||
pkgs.mkShell {
|
pkgs.mkShell {
|
||||||
nativeBuildInputs = with pkgs.buildPackages; [
|
nativeBuildInputs = with pkgs.buildPackages; [
|
||||||
nodejs
|
bun
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
import { SITE } from "@consts";
|
import { SITE } from "@consts";
|
||||||
import gradient from "../../public/assets/gradient.avif";
|
import gradient from "../../public/assets/gradient.avif";
|
||||||
import { ClientRouter } from 'astro:transitions';
|
import { ClientRouter } from "astro:transitions";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
|
|
|
@ -1,45 +1,49 @@
|
||||||
import { defineCollection, z } from "astro:content";
|
import { defineCollection, z } from "astro:content";
|
||||||
import { rssSchema } from '@astrojs/rss';
|
import { rssSchema } from "@astrojs/rss";
|
||||||
|
|
||||||
const posts = defineCollection({
|
const posts = defineCollection({
|
||||||
type: "content",
|
type: "content",
|
||||||
schema: ({ image }) =>
|
schema: ({ image }) =>
|
||||||
z.object({
|
z
|
||||||
title: z.string(),
|
.object({
|
||||||
description: z.string(),
|
title: z.string(),
|
||||||
date: z.coerce.date(),
|
description: z.string(),
|
||||||
updated: z.date().optional(),
|
date: z.coerce.date(),
|
||||||
draft: z.boolean().optional(),
|
updated: z.date().optional(),
|
||||||
image: z.object({
|
draft: z.boolean().optional(),
|
||||||
url: image(),
|
image: z.object({
|
||||||
alt: z.string(),
|
url: image(),
|
||||||
}),
|
alt: z.string(),
|
||||||
tags: z.array(z.string()),
|
}),
|
||||||
extraAuthors: z.array(z.string()).optional(),
|
tags: z.array(z.string()),
|
||||||
categories: z.array(z.string()),
|
extraAuthors: z.array(z.string()).optional(),
|
||||||
}).merge(rssSchema)
|
categories: z.array(z.string()),
|
||||||
|
})
|
||||||
|
.merge(rssSchema),
|
||||||
});
|
});
|
||||||
|
|
||||||
const projects = defineCollection({
|
const projects = defineCollection({
|
||||||
type: "content",
|
type: "content",
|
||||||
schema: ({ image }) =>
|
schema: ({ image }) =>
|
||||||
z.object({
|
z
|
||||||
title: z.string(),
|
.object({
|
||||||
description: z.string(),
|
title: z.string(),
|
||||||
date: z.coerce.date(),
|
description: z.string(),
|
||||||
updated: z.date().optional(),
|
date: z.coerce.date(),
|
||||||
draft: z.boolean().optional(),
|
updated: z.date().optional(),
|
||||||
image: z.object({
|
draft: z.boolean().optional(),
|
||||||
url: image(),
|
image: z.object({
|
||||||
alt: z.string(),
|
url: image(),
|
||||||
}),
|
alt: z.string(),
|
||||||
tags: z.array(z.string()),
|
}),
|
||||||
extraAuthors: z.array(z.string()).optional(),
|
tags: z.array(z.string()),
|
||||||
categories: z.array(z.string()),
|
extraAuthors: z.array(z.string()).optional(),
|
||||||
featured: z.boolean().optional(),
|
categories: z.array(z.string()),
|
||||||
collection: z.boolean().optional(),
|
featured: z.boolean().optional(),
|
||||||
includeHero: z.boolean().optional(),
|
collection: z.boolean().optional(),
|
||||||
}).merge(rssSchema)
|
includeHero: z.boolean().optional(),
|
||||||
|
})
|
||||||
|
.merge(rssSchema),
|
||||||
});
|
});
|
||||||
|
|
||||||
const work = defineCollection({
|
const work = defineCollection({
|
||||||
|
|
|
@ -24,9 +24,9 @@ On NixOS you can install Packard by including it as an input in flake.nix, then
|
||||||
inputs = {
|
inputs = {
|
||||||
packard.url = "github:troylusty/packard";
|
packard.url = "github:troylusty/packard";
|
||||||
};
|
};
|
||||||
```
|
|
||||||
|
|
||||||
```nix
|
...
|
||||||
|
|
||||||
environment.systemPackages = {
|
environment.systemPackages = {
|
||||||
inputs.packard.packages."${pkgs.system}".default
|
inputs.packard.packages."${pkgs.system}".default
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,7 +17,7 @@ const { title, description, image, date, updated, tags } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en" class="scroll-smooth antialiased">
|
<html lang="en" class="scroll-smooth antialiased" transition:animate="none">
|
||||||
<Head
|
<Head
|
||||||
title={title}
|
title={title}
|
||||||
description={description}
|
description={description}
|
||||||
|
@ -30,7 +30,10 @@ const { title, description, image, date, updated, tags } = Astro.props;
|
||||||
class="flex min-h-screen flex-col justify-start bg-primary p-8 pt-0 text-secondary md:pt-8"
|
class="flex min-h-screen flex-col justify-start bg-primary p-8 pt-0 text-secondary md:pt-8"
|
||||||
>
|
>
|
||||||
<Header />
|
<Header />
|
||||||
<main class="mx-auto w-full max-w-prose space-y-6">
|
<main
|
||||||
|
class="mx-auto w-full max-w-prose space-y-6"
|
||||||
|
transition:animate="fade"
|
||||||
|
>
|
||||||
<slot />
|
<slot />
|
||||||
</main>
|
</main>
|
||||||
<Footer />
|
<Footer />
|
||||||
|
|
|
@ -23,6 +23,18 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
.astro-code,
|
||||||
|
.astro-code span {
|
||||||
|
color: var(--shiki-dark) !important;
|
||||||
|
background-color: var(--shiki-dark-bg) !important;
|
||||||
|
/* Optional, if you also want font styles */
|
||||||
|
font-style: var(--shiki-dark-font-style) !important;
|
||||||
|
font-weight: var(--shiki-dark-font-weight) !important;
|
||||||
|
text-decoration: var(--shiki-dark-text-decoration) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@layer components {
|
@layer components {
|
||||||
.prose img {
|
.prose img {
|
||||||
@apply cursor-pointer transition-transform hover:scale-[98%] active:scale-[200%];
|
@apply cursor-pointer transition-transform hover:scale-[98%] active:scale-[200%];
|
||||||
|
|
Loading…
Add table
Reference in a new issue