Make Pages deploy script portable
This commit is contained in:
parent
ada3578a1d
commit
0b76a600b1
|
|
@ -8,7 +8,7 @@
|
|||
"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",
|
||||
"deploy": "npm run build && wrangler pages deploy dist --project-name ${CLOUDFLARE_PROJECT_NAME:-decodal-site} --branch ${CLOUDFLARE_BRANCH:-master}",
|
||||
"deploy": "npm run build && node scripts/deploy-pages.mjs",
|
||||
"deploy:wasm": "npm run build:wasm && npm run deploy"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
|||
12
site/decodal-site/scripts/deploy-pages.mjs
Normal file
12
site/decodal-site/scripts/deploy-pages.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { spawnSync } from 'node:child_process';
|
||||
|
||||
const projectName = process.env.CLOUDFLARE_PROJECT_NAME ?? 'decodal-site';
|
||||
const branch = process.env.CLOUDFLARE_BRANCH ?? 'master';
|
||||
|
||||
const result = spawnSync(
|
||||
'wrangler',
|
||||
['pages', 'deploy', 'dist', '--project-name', projectName, '--branch', branch],
|
||||
{ stdio: 'inherit', shell: process.platform === 'win32' },
|
||||
);
|
||||
|
||||
process.exit(result.status ?? 1);
|
||||
Loading…
Reference in New Issue
Block a user