Update dependencies and improve build performance

This commit is contained in:
Bad Manners 2024-07-24 14:22:00 -03:00
parent 688f9b982d
commit f8ac450ab5
6 changed files with 1600 additions and 1715 deletions

View file

@ -15,15 +15,15 @@ Static website built in Astro + Typescript + TailwindCSS.
```bash
git clone https://git.badmanners.xyz/badmanners/gallery.badmanners.xyz
cd gallery.badmanners.xyz
npm install && npm run astro -- sync
npm install && npm run sync
```
### Local development
```bash
npm run dev # Start development server (quit with Ctrl-C)
npm run astro -- sync # Rebuild types from src/content/ files
npm run prettier # Prettier formatting
npm run dev # Start development server (quit with Ctrl-C)
npm run sync # Rebuild types from src/content/ files
npm run prettier # Prettier formatting
```
### Export story for upload

View file

@ -15,6 +15,8 @@ export default defineConfig({
],
markdown: {
smartypants: false,
// Remove this line once @astropub/md@0.5.0 lands
syntaxHighlight: false,
},
build: {
assets: "assets",

3264
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,41 +1,42 @@
{
"name": "gallery-badmanners-xyz",
"type": "module",
"version": "1.5.2",
"version": "1.5.3",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check --minimumSeverity warning && astro build",
"preview": "astro preview",
"sync": "astro sync",
"astro": "astro",
"prettier": "prettier . --write",
"prettier": "prettier --write .",
"deploy-lftp": "dotenv tsx scripts/deploy-lftp.ts --",
"export-story": "tsx scripts/export-story.ts"
},
"dependencies": {
"@astrojs/check": "^0.5.10",
"@astrojs/rss": "^4.0.5",
"@astrojs/check": "^0.8.2",
"@astrojs/rss": "^4.0.7",
"@astrojs/tailwind": "^5.1.0",
"@astropub/md": "^0.4.0",
"@tailwindcss/typography": "^0.5.12",
"@tailwindcss/typography": "^0.5.13",
"@types/sanitize-html": "^2.11.0",
"astro": "^4.5.16",
"astro": "^4.12.2",
"astro-pagefind": "^1.6.0",
"github-slugger": "^2.0.0",
"marked": "^12.0.1",
"pagefind": "^1.1.0",
"sanitize-html": "^2.13.0",
"tailwindcss": "^3.4.3",
"tailwindcss": "^3.4.6",
"tiny-decode": "^0.1.3",
"typescript": "^5.4.4"
"typescript": "^5.5.4"
},
"devDependencies": {
"commander": "^12.0.0",
"commander": "^12.1.0",
"dotenv-cli": "^7.4.2",
"fetch-retry": "^6.0.0",
"prettier": "^3.2.5",
"prettier-plugin-astro": "^0.13.0",
"prettier-plugin-tailwindcss": "^0.5.13",
"tsx": "^4.7.2"
"prettier": "^3.3.3",
"prettier-plugin-astro": "^0.14.1",
"prettier-plugin-tailwindcss": "^0.6.5",
"tsx": "^4.16.2"
}
}

View file

@ -1,10 +1,10 @@
import rss, { type RSSFeedItem } from "@astrojs/rss";
import type { APIRoute } from "astro";
import { getCollection, type CollectionEntry } from "astro:content";
import { markdown } from "@astropub/md";
import sanitizeHtml from "sanitize-html";
import { t } from "../i18n";
import type { Lang } from "../content/config";
import { markdownToHtml } from "../utils/markdown_to_html";
import { markdownToPlaintext } from "../utils/markdown_to_plaintext";
type FeedItem = RSSFeedItem & {
@ -73,8 +73,8 @@ export const GET: APIRoute = async ({ site }) => {
? `<p>${t(data.lang, "export_story/commissioned_by", getLinkForUser(users.find((user) => user.id === data.commissioner!.id)!, data.lang))}</p>`
: "") +
`<hr><p><em>${t(data.lang, "story/warnings", data.wordCount, data.contentWarning.trim())}</em></p>` +
`<hr>${markdownToHtml(body)}` +
`<hr>${markdownToHtml(data.description)}`,
`<hr>${await markdown(body)}` +
`<hr>${await markdown(data.description)}`,
),
})),
),
@ -104,8 +104,8 @@ export const GET: APIRoute = async ({ site }) => {
)}</p>` +
`<hr><p>${t(data.lang, "game/platforms", data.platforms)}</p>` +
`<hr><p><em>${data.contentWarning.trim()}</em></p>` +
`<hr>${markdownToHtml(body)}` +
`<hr>${markdownToHtml(data.description)}`,
`<hr>${await markdown(body)}` +
`<hr>${await markdown(data.description)}`,
),
})),
),

View file

@ -1,4 +0,0 @@
import { marked } from "marked";
import { decode } from "tiny-decode";
export const markdownToHtml = (text: string) => decode((marked.parse(text) as string).trim());