diff --git a/.github/workflows/build-assets.yml b/.github/workflows/build-assets.yml index 1e3c8514dd..86189ecf5a 100644 --- a/.github/workflows/build-assets.yml +++ b/.github/workflows/build-assets.yml @@ -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) diff --git a/package.json b/package.json index 8bb6328027..2bc1700f37 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/scripts/workflow/build-vercel-packagejson.ts b/scripts/workflow/build-vercel-packagejson.ts deleted file mode 100644 index 730262cb52..0000000000 --- a/scripts/workflow/build-vercel-packagejson.ts +++ /dev/null @@ -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)); diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000000..257cf83e43 --- /dev/null +++ b/vercel.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://openapi.vercel.sh/vercel.json", + "framework": "hono", + "buildCommand": "pnpm run build:vercel", + "outputDirectory": "dist" +}