chore: fix art template on vercel (#20647)

This commit is contained in:
Stephen Zhou
2025-12-08 00:21:14 +08:00
committed by GitHub
parent 531f8a1249
commit fd98be1027
4 changed files with 11 additions and 4 deletions

View File

@@ -83,7 +83,7 @@ async function handler(ctx) {
item.author = content('.bbs-user-wrapper-content-name-span').first().text();
item.pubDate = item.pubDate ?? timezone(parseRelativeDate(content('.second-line-user-info').first().text()), +8);
item.description = art(path.join(__dirname, 'templates/description.art'), {
item.description = art(path.resolve(__dirname, 'templates/description.art'), {
videos,
description: content('.bbs-content').first().html(),
});

View File

@@ -30,7 +30,7 @@
"build:docs": "npm run build:routes && tsx scripts/workflow/build-docs.ts",
"build:lib": "npm run build:routes && tsdown --config ./tsdown-lib.config.ts",
"build:routes": "cross-env NODE_ENV=dev tsx scripts/workflow/build-routes.ts",
"build:vercel": "npm run build:routes && tsdown --config ./tsdown-vercel.config.ts && mv dist/server.mjs dist/index.mjs",
"vercel-build": "npm run build:routes && tsdown --config ./tsdown-vercel.config.ts",
"dev": "cross-env NODE_ENV=dev NODE_OPTIONS='--max-http-header-size=32768' tsx watch --inspect --clear-screen=false lib/index.ts",
"dev:cache": "cross-env NODE_ENV=production NODE_OPTIONS='--max-http-header-size=32768' tsx watch --clear-screen=false lib/index.ts",
"format": "eslint --cache --fix \"**/*.{ts,tsx,js,yml}\" --concurrency auto && prettier . --write --experimental-cli",

View File

@@ -4,6 +4,9 @@ import artTemplatesPlugin from './plugins/rollup-plugin-art-templates.ts';
export default defineConfig({
entry: ['./lib/server.ts'],
// Wait for https://github.com/vercel/vercel/pull/14429
// Then we can set outDir to outputDirectory in vercel.json
outDir: 'src',
minify: true,
shims: true,
clean: true,

View File

@@ -1,8 +1,12 @@
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"framework": "hono",
"buildCommand": "pnpm run build:vercel",
"outputDirectory": "dist",
"outputDirectory": "src",
"functions": {
"src/server.mjs": {
"includeFiles": "./src/templates/**/*.art"
}
},
"rewrites": [
{
"source": "/favicon.ico",