Skip to content

Commit e8ec520

Browse files
committed
docs: update npm scripts for build process and remove cheerio dependency
1 parent ce56f0c commit e8ec520

File tree

3 files changed

+73
-3
lines changed

3 files changed

+73
-3
lines changed

.github/workflows/cloudflare.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build and Deploy to Cloudflare
2+
on:
3+
push:
4+
branches: [ main ]
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
name: Build Application
10+
permissions:
11+
contents: read
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v5
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Setup Node
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
23+
- name: Install dependencies
24+
run: npm install --force
25+
26+
- name: Build application
27+
run: npm run build
28+
29+
- name: Upload build artifacts
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: build-files
33+
path: site/dist/
34+
retention-days: 1
35+
36+
deploy:
37+
runs-on: ubuntu-latest
38+
name: Deploy to Cloudflare
39+
needs: build
40+
permissions:
41+
contents: read
42+
deployments: write
43+
steps:
44+
- name: Checkout (for config files)
45+
uses: actions/checkout@v5
46+
with:
47+
sparse-checkout: |
48+
wrangler.jsonc
49+
sparse-checkout-cone-mode: false
50+
51+
- name: Download build artifacts
52+
uses: actions/download-artifact@v4
53+
with:
54+
name: build-files
55+
path: site/dist/
56+
57+
- name: Deploy (Workers + Static Assets)
58+
uses: cloudflare/[email protected]
59+
with:
60+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
61+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
62+
command: deploy --config wrangler.jsonc
63+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"precompile": "npm run version & npm run collect-token-statistic & npm run token-meta",
3737
"pretest": "npm run version",
3838
"predist": "npm run version",
39-
"presite": "npm run version & npm run routes & npm run collect-token-statistic & npm run token-meta",
39+
"prebuild": "npm run version & npm run routes & npm run collect-token-statistic & npm run token-meta",
4040
"dev": "npm run routes && vite serve site",
4141
"fast-dev": "npm run routes && vite serve site",
4242
"test": "cross-env NODE_ENV=test jest --config .jest.js",
@@ -60,7 +60,7 @@
6060
"routes": "node site/scripts/genrateRoutes.js",
6161
"tsc": "tsc --noEmit",
6262
"vue-tsc": "vue-tsc --noEmit",
63-
"site": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build site --base=https://next.antdv.com/",
63+
"build": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build site --base=/",
6464
"pub:site": "npm run site && node site/scripts/pushToOSS.js",
6565
"prepare": "husky install",
6666
"version": "node ./scripts/generate-version",
@@ -148,7 +148,6 @@
148148
"babel-plugin-transform-require-context": "^0.1.1",
149149
"case-sensitive-paths-webpack-plugin": "^2.1.2",
150150
"chalk": "^4.1.1",
151-
"cheerio": "^1.0.0-rc.2",
152151
"codecov": "^3.0.0",
153152
"codesandbox": "^2.2.3",
154153
"colorful": "^2.1.0",

wrangler.jsonc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "antdv-v4",
3+
"compatibility_date": "2025-09-18",
4+
"assets": {
5+
"directory": "./site/dist",
6+
"not_found_handling": "single-page-application"
7+
}
8+
}

0 commit comments

Comments
 (0)