build: remove file >=25MiB in cf pages
This commit is contained in:
parent
b36dea1bde
commit
cd34943180
16
src/build.js
16
src/build.js
|
@ -79,14 +79,16 @@ const f = async () => {
|
|||
await mkdir(publicPath, { recursive: true })
|
||||
await Promise.all(projects.map((project) => { return dl(project) }))
|
||||
|
||||
// Cloudflare Pages has maximum file size of 25MiB
|
||||
const files = await readdir(publicPath)
|
||||
await Promise.all(files.map(async (file) => {
|
||||
// cloudflare pages limits file size to 25MB
|
||||
// compressed (br/gz) files are excluded
|
||||
if (process.env.CF_PAGES && file.startsWith('phishing-filter') && file.endsWith('.rules')) {
|
||||
await rm(join(publicPath, file))
|
||||
}
|
||||
}))
|
||||
if (process.env.CF_PAGES) {
|
||||
await Promise.all(files.map(async (filename) => {
|
||||
const { size } = await stat(join(publicPath, filename))
|
||||
if (size >= (25 * 1024 * 1024)) {
|
||||
await rm(join(publicPath, filename), { force: true })
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
f()
|
||||
|
|
Loading…
Reference in New Issue