Chore: minor changes
Some checks failed
Build / Build (push) Has been cancelled
Build / Diff output (push) Has been cancelled
Build / Deploy to Cloudflare Pages (3.114.12) (push) Has been cancelled
Build / Deploy to GitHub and GitLab (push) Has been cancelled

This commit is contained in:
SukkaW
2025-09-30 08:02:57 +08:00
parent 527aa4c533
commit 69e9a73b4b
2 changed files with 20 additions and 17 deletions

View File

@@ -12,6 +12,7 @@ import type { VoidOrVoidArray } from './lib/misc';
import picocolors from 'picocolors';
import { tagged as html } from 'foxts/tagged';
import { compareAndWriteFile } from './lib/create-file';
import { appendArrayInPlace } from 'foxts/append-array-in-place';
const priorityOrder: Record<'default' | string & {}, number> = {
LICENSE: 0,
@@ -71,14 +72,15 @@ export const buildPublic = task(require.main === module, __filename)(async (span
await Promise.all([
compareAndWriteFile(
span,
[
'/*',
' cache-control: public, max-age=240, stale-while-revalidate=60, stale-if-error=15',
'https://:project.pages.dev/*',
' X-Robots-Tag: noindex',
...Object.keys(priorityOrder)
.map((name) => `/${name}/*\n content-type: text/plain; charset=utf-8\n X-Robots-Tag: noindex`)
],
appendArrayInPlace(
[
'/*',
' cache-control: public, max-age=300, stale-while-revalidate=30, stale-if-error=60',
'https://:project.pages.dev/*',
' X-Robots-Tag: noindex'
],
Object.keys(priorityOrder).map((name) => `/${name}/*\n content-type: text/plain; charset=utf-8\n X-Robots-Tag: noindex`)
),
path.join(PUBLIC_DIR, '_headers')
),
compareAndWriteFile(