1
1
mirror of https://github.com/bitgapp/eqMac.git synced 2024-11-23 23:03:02 +03:00
eqMac/ui/scripts/purge-cache.ts

22 lines
554 B
TypeScript

import * as Cloudflare from 'cloudflare'
import { config as InjectEnvs } from 'dotenv'
import { version } from '../package.json'
InjectEnvs()
const cf = Cloudflare({
token: process.env.CLOUDFLARE_TOKEN
})
;(async () => {
const [ major, minor ] = version.split('.')
const domain = `https://ui-v${major}.eqmac.app`
await cf.zones.purgeCache(process.env.CLOUDFLARE_ZONE_ID, {
files: [ domain ]
})
console.log(`🧹 Cloudflare cache successfully cleared for domain ${domain}`)
})().catch(err => {
console.error(err)
process.exit(1)
})