docs: update npm scripts for build process and remove cheerio dependency

main
tangjinzhou 2025-09-18 22:53:48 +08:00
parent ce56f0c8f6
commit e8ec520d9a
3 changed files with 73 additions and 3 deletions

63
.github/workflows/cloudflare.yml vendored Normal file
View File

@ -0,0 +1,63 @@
name: Build and Deploy to Cloudflare
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
name: Build Application
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install --force
- name: Build application
run: npm run build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-files
path: site/dist/
retention-days: 1
deploy:
runs-on: ubuntu-latest
name: Deploy to Cloudflare
needs: build
permissions:
contents: read
deployments: write
steps:
- name: Checkout (for config files)
uses: actions/checkout@v5
with:
sparse-checkout: |
wrangler.jsonc
sparse-checkout-cone-mode: false
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-files
path: site/dist/
- name: Deploy (Workers + Static Assets)
uses: cloudflare/wrangler-action@v3.14.1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: deploy --config wrangler.jsonc
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

View File

@ -36,7 +36,7 @@
"precompile": "npm run version & npm run collect-token-statistic & npm run token-meta",
"pretest": "npm run version",
"predist": "npm run version",
"presite": "npm run version & npm run routes & npm run collect-token-statistic & npm run token-meta",
"prebuild": "npm run version & npm run routes & npm run collect-token-statistic & npm run token-meta",
"dev": "npm run routes && vite serve site",
"fast-dev": "npm run routes && vite serve site",
"test": "cross-env NODE_ENV=test jest --config .jest.js",
@ -60,7 +60,7 @@
"routes": "node site/scripts/genrateRoutes.js",
"tsc": "tsc --noEmit",
"vue-tsc": "vue-tsc --noEmit",
"site": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build site --base=https://next.antdv.com/",
"build": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build site --base=/",
"pub:site": "npm run site && node site/scripts/pushToOSS.js",
"prepare": "husky install",
"version": "node ./scripts/generate-version",
@ -148,7 +148,6 @@
"babel-plugin-transform-require-context": "^0.1.1",
"case-sensitive-paths-webpack-plugin": "^2.1.2",
"chalk": "^4.1.1",
"cheerio": "^1.0.0-rc.2",
"codecov": "^3.0.0",
"codesandbox": "^2.2.3",
"colorful": "^2.1.0",

8
wrangler.jsonc Normal file
View File

@ -0,0 +1,8 @@
{
"name": "antdv-v4",
"compatibility_date": "2025-09-18",
"assets": {
"directory": "./site/dist",
"not_found_handling": "single-page-application"
}
}