build(cf): exclude files larger than 26.2MB

This commit is contained in:
MDLeom 2023-08-22 12:47:06 +00:00
parent 7e745ba6d1
commit 47705495f4
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
1 changed files with 10 additions and 1 deletions

View File

@ -11,7 +11,7 @@ const { stream: gotStream } = require('got')
const got = require('got')
const unzip = require('extract-zip')
const { basename, join } = require('path')
const { mkdir } = require('fs/promises')
const { mkdir, readdir, rm } = require('fs/promises')
const { createWriteStream } = require('fs')
const { pipeline } = require('stream/promises')
const envVar = process.env
@ -119,6 +119,15 @@ const f = async () => {
await mkdir(tmpPath, { recursive: true })
await mkdir(publicPath, { recursive: true })
await Promise.all(projects.map((project) => { return dl(project) }))
const files = await readdir(publicPath)
await Promise.all(files.map(async (file) => {
// cf pages limits file size to 26.2MB
// compressed (br/gz) files are excluded
if (file.startsWith('phishing-filter') && file.endsWith('.rules')) {
await rm(join(publicPath, file))
}
}))
}
const oisd = async () => {