chore: fix vercel build (#20645)

This commit is contained in:
Stephen Zhou 2025-12-06 14:28:38 +08:00 committed by GitHub
parent dd142bff03
commit 2e9976b24e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 55 deletions

View File

@ -71,41 +71,3 @@ jobs:
git config --local user.name "github-actions[bot]"
git status
git diff-index --quiet HEAD || (git commit -m "chore: auto build https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA" -a --no-verify && git push "https://${GITHUB_ACTOR}:${{ secrets.DOCS_API_TOKEN }}@github.com/RSSNext/rsshub-docs.git" HEAD:main)
# vercel
- id: check-vercel-env
env:
VERCEL_API_TOKEN: ${{ secrets.VERCEL_API_TOKEN }}
if: ${{ env.VERCEL_API_TOKEN != '' }}
run: echo "defined=true" >> $GITHUB_OUTPUT
- name: Checkout vercel
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
if: steps.check-vercel-env.outputs.defined == 'true'
with:
repository: 'RSSNext/rsshub-vercel'
token: ${{ secrets.VERCEL_API_TOKEN }}
path: rsshub-vercel
- name: Build vercel
if: steps.check-vercel-env.outputs.defined == 'true'
run: pnpm build:vercel
- name: Update vercel
if: steps.check-vercel-env.outputs.defined == 'true'
run: |
rm -rf ./rsshub-vercel/src
rm -rf ./rsshub-vercel/patches
rm -rf ./rsshub-vercel/pnpm-lock.yaml
mkdir -p ./rsshub-vercel/src
mkdir -p ./rsshub-vercel/patches
cp -r ./dist/* ./rsshub-vercel/src
cp -r ./patches/* ./rsshub-vercel/patches
cd rsshub-vercel
pnpm i
- name: Commit vercel
if: steps.check-vercel-env.outputs.defined == 'true'
run: |
cd rsshub-vercel
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add -A
git status
git diff-index --quiet HEAD || (git commit -m "chore: auto build https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA" -a --no-verify && git push "https://${GITHUB_ACTOR}:${{ secrets.VERCEL_API_TOKEN }}@github.com/RSSNext/rsshub-vercel.git" HEAD:main)

View File

@ -29,8 +29,8 @@
"build": "npm run build:routes && tsdown",
"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": "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 && tsx scripts/workflow/build-vercel-packagejson.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",
"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

@ -1,15 +0,0 @@
import fs from 'node:fs';
import packageJson from '../../package.json';
packageJson.name = 'rsshub-vercel';
// @ts-ignore
delete packageJson.scripts;
// @ts-ignore
delete packageJson.main;
// @ts-ignore
delete packageJson.files;
// @ts-ignore
delete packageJson['lint-staged'];
fs.writeFileSync('rsshub-vercel/package.json', JSON.stringify(packageJson, null, 4));

6
vercel.json Normal file
View File

@ -0,0 +1,6 @@
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"framework": "hono",
"buildCommand": "pnpm run build:vercel",
"outputDirectory": "dist"
}