Skip to content

Commit

Permalink
📦️ deps(image-service): remove squoosh in favor of sharp
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronlifton committed Jun 9, 2024
1 parent 0627644 commit cdfee5a
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 32 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
FROM node:21.6.1-alpine AS runtime
WORKDIR /app

ARG TURSO_DB_URL
ARG TURSO_DB_AUTH_TOKEN

COPY . .

SHELL ["/bin/ash", "-o", "pipefail", "-c"]
RUN --mount=type=secret,id=env,dst=/etc/secrets/.env \
RENDER_TOKEN=$(grep RENDER_TOKEN /etc/secrets/.env | cut -d '=' -f 2) \
ASTRO_STUDIO_APP_TOKEN=$(grep ASTRO_STUDIO_APP_TOKEN /etc/secrets/.env | cut -d '=' -f 2) \
export RENDER_TOKEN && export ASTRO_STUDIO_APP_TOKEN \
export RENDER_TOKEN\
&& cp /etc/secrets/.env .env \
&& npm install \
&& npm run build
Expand Down
3 changes: 1 addition & 2 deletions astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { transformerTwoslash } from "@shikijs/twoslash";
import icon from "astro-icon";
import robotsTxt from "astro-robots-txt";
import { defineConfig, squooshImageService } from "astro/config";
import { defineConfig } from "astro/config";
import path, { dirname } from "node:path";
import { fileURLToPath } from "node:url";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
Expand Down Expand Up @@ -102,7 +102,6 @@ export default defineConfig({
})],
},
image: {
service: squooshImageService(),
domains: ["cloudinary.com"],
},
redirects: {
Expand Down
15 changes: 2 additions & 13 deletions db/seed.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
import { db, Metric } from "astro:db";
import { db } from 'astro:db';

// https://astro.build/db/seed
export default async function seed() {
await db.insert(Metric).values([
{
metricType: "pageview",
value: 3,
postSlug: "neovim-git-commit-review-gemini-gpt4o",
},
{
metricType: "pageview",
value: 1,
postSlug: "neovim-git-commit-review-gemini-gpt4o",
},
]);
// TODO
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"vitest": "vitest run test",
"test": "npx playwright test --ui",
"docker-build": "DOCKER_BUILDKIT=1 docker build --secret id=env,src=.env -t blog .",
"docker-run": "docker run -p 4321:4321 -it --rm blog",
"docker-run": "docker run --env-file .env -p 4321:4321 -it --rm blog",
"dev:rpc-server": "tsx watch ./rpc-server/router.ts"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions src/content/blog/eslint-allow-underscore-prefix.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ tags: ["eslint", "react", "typescript", "javascript"]

import { Code } from "astro:components";
import { Image } from "astro:assets";
import ZoomImage from "~components/ZoomImage.svelte";
import image1 from "./assets/screenshots/nvim-no-unused-vars2.png";

Ever encounter this error?
Expand Down
6 changes: 3 additions & 3 deletions src/content/blog/neovim-git-commit-review-gemini-gpt4o.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title:
"Neovim: generating a Convential Commit message with Gemini and a a diff
review with GPT-4o"
"Neovim: generating a Convential Commit message with Gemini and a diff review
with GPT-4o"
description:
"Learn how to generate a Convential Commit message with Gemini and a a diff
"Learn how to generate a Convential Commit message with Gemini and a diff
review with GPT-4o in Neovim to help you write detailed commits or to review
pull requests."
pubDate: "May 28 2024"
Expand Down
10 changes: 5 additions & 5 deletions src/content/blog/neovim-spellcheck.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ tags: ["neovim", "quick tips"]
---

import { Image } from "astro:assets";
import ZoomImage from "~components/react/ZoomImage";
import ZoomImage from "~components/ZoomImage.svelte";
import image1 from "./assets/screenshots/neovim-spellfile.png";
import valeDiagnosticsImg from "./assets/vale-diagnostics-sample_qgdcfz_c_pad,h_300,e_sharpen.png";
import Admonition from "~components/Admonition.astro";

<Admonition type="tip" isQuote={false} title="Note" date={"Apr 11, 2024"}>
After using the built-in spellchecker for a while, I decided to try one that
would throw fewer false positives and also help improve grammar and writing
would throw less false positives and also help improve grammar and writing
style. I've added a new section at the bottom to set up Vale, which checks my
writing for style and grammar. When I write these articles now, a combination
of WriteGood and Vale rules help me create better content!
Expand Down Expand Up @@ -63,9 +63,9 @@ Here's how you do it:
The file should now look like this:

<ZoomImage
dialogId="screenshot1"
src={image1.src}
alt="Neovim screenshot showing a custom spelling suggestion file"
link={image1.src}
alt={"Full-size neovim screenshot"}
caption="Neovim screenshot showing a custom spelling suggestion file"
client:load
>
<Image
Expand Down
6 changes: 3 additions & 3 deletions src/pages/api/blog/views/[slug].json.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { APIRoute } from "astro";
import { and, db, eq, isDbError, Metric, sum } from "astro:db";
import { and, count, db, eq, isDbError, Metric } from "astro:db";

export const prerender = false;

Expand All @@ -13,13 +13,13 @@ export const GET: APIRoute = async ({ params, request }) => {
postSlug: params.slug,
value: 1,
}).returning();
const metrics = await db.select({ value: sum(Metric.value) }).from(Metric).where(
const metrics = await db.select({ count: count() }).from(Metric).where(
and(
eq(Metric.postSlug, params.slug),
eq(Metric.metricType, "pageview"),
),
);
const numViews = metrics[0]?.value || 0;
const numViews = metrics[0]?.count || 0;

return new Response(JSON.stringify({ numViews }), { status: 200 });
} catch (e) {
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"~utils/*": ["./src/utils/*"],
"~db/*": ["./db/*"]
},
"types": ["@astrojs/db", "@astrojs/db/dist/core/integration", "vite-plugin-svgr/client"],
"allowJs": true
"types": ["@astrojs/db", "@astrojs/db/dist/core/integration", "vite-plugin-svgr/client"]
},
"include": ["src/**/*", ".astro", "db", "rpc-server", "test", "tests"]
}
1 change: 0 additions & 1 deletion vite.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ if (!process.env.NODE_ENV) {
throw new Error("Missing NODE_ENV");
}
loadEnv(process.env.NODE_ENV, process.cwd(), "");
const __dirname = path.resolve();

/** @type {import('vite').UserConfig} */
export default {
Expand Down

0 comments on commit cdfee5a

Please sign in to comment.