-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.js
31 lines (26 loc) · 924 Bytes
/
run.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* globals process */
import { $, argv } from 'zx'
async function watch(){
// Dump the latest release metadata for rending
await $`stat .pr-release || node -r dotenv/config bin.js extract-changelog --out`
// Run vite and build-docs in parallel
// both will watch the file system and do their thing
// if anything changes
await Promise.all([
$`npx nodemon -e js,css,html,md -w "docs/*" -w "scripts/*" -- --unhandled-rejections=strict scripts/build-docs.js`,
$`npx vite`
])
}
async function deploy(){
await $`node -r dotenv/config bin.js extract-changelog --out`
await $`node scripts/build-docs.js`
await $`npm install @cloudflare/wrangler -g`
await $`npx @cloudflare/wrangler publish`
}
const commands = { watch, deploy }
{
argv._ = process.argv.slice(2)
const command = argv._.shift()
const f = commands[command]
if ( f ) f(argv, ...argv._)
}