Add Cloudflare Pages deploy script

This commit is contained in:
Keisuke Hirata 2026-06-25 02:49:15 +09:00
parent a2a6dee025
commit d8af980f7d
No known key found for this signature in database
3 changed files with 1484 additions and 2 deletions

View File

@ -65,6 +65,26 @@ cd site/decodal-site
npm run dev
```
Deploy the static site to Cloudflare Pages with Wrangler direct upload:
```sh
cd site/decodal-site
npm run deploy
```
The deploy script runs `npm run build` and then uploads `dist/` to the Pages project named `decodal-site`.
Use `CLOUDFLARE_PROJECT_NAME` when deploying to a differently named Pages project.
```sh
CLOUDFLARE_PROJECT_NAME=my-pages-project npm run deploy
```
If the committed WASM package must be regenerated before deploy, use:
```sh
npm run deploy:wasm
```
## Tree-sitter grammar
The Tree-sitter grammar is kept in:

File diff suppressed because it is too large Load Diff

View File

@ -7,11 +7,16 @@
"dev": "astro dev --host 0.0.0.0",
"build": "astro build",
"preview": "astro preview --host 0.0.0.0",
"build:wasm": "wasm-pack build ../../crates/decodal-wasm --target web --out-dir ../../site/decodal-site/src/wasm --release"
"build:wasm": "wasm-pack build ../../crates/decodal-wasm --target web --out-dir ../../site/decodal-site/src/wasm --release",
"deploy": "npm run build && wrangler pages deploy dist --project-name ${CLOUDFLARE_PROJECT_NAME:-decodal-site}",
"deploy:wasm": "npm run build:wasm && npm run deploy"
},
"dependencies": {
"@astrojs/check": "^0.9.4",
"astro": "^4.16.18",
"marked": "^12.0.2"
},
"devDependencies": {
"wrangler": "^4.104.0"
}
}