mirror of
https://github.com/bitgapp/eqMac.git
synced 2024-11-23 23:03:02 +03:00
22 lines
563 B
TypeScript
22 lines
563 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}${minor}0.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)
|
|
})
|