mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-30 03:51:25 -08:00
docs(site): [SITE-07] ship selected font notice references
This commit is contained in:
1 parent
01f3d00e4c
commit
4545c43679
29 files changed
+3508
-12
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import type { VendorManifest } from '../notices.ts'
|
||||
import assert from 'node:assert/strict'
|
||||
import { createHash } from 'node:crypto'
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
|
||||
interface FontRecord {
|
||||
group: VendorManifest['groups'][number]
|
||||
unresolved: string[]
|
||||
}
|
||||
|
||||
export function verifyFontNotices(root: string, manifest: VendorManifest) {
|
||||
const record = JSON.parse(fs.readFileSync(path.join(root, 'refactor/baselines/site-font-notices-provenance.json'), 'utf8')) as FontRecord
|
||||
assert.deepEqual(record.group.components?.map(component => component.name).sort(), ['Averia Sans Libre Light', 'CHAWP', 'Lato Regular', 'Liberation Sans'], 'Incomplete reviewed font roster')
|
||||
assert.equal(record.group.files.length, 5, 'Keep both default font copies and the three selected demo fonts')
|
||||
assert.equal(record.group.notices.length, 5, 'Keep four full font licenses and attribution')
|
||||
const group = manifest.groups.filter(group => group.name === 'jassub-fonts')
|
||||
assert.deepEqual(group, [record.group], 'Font notice/source binding changed')
|
||||
for (const file of record.group.files) {
|
||||
assert(!record.unresolved.includes(file.path), 'Unresolved font cannot be promoted by a notice binding')
|
||||
const bytes = fs.readFileSync(path.join(root, file.path))
|
||||
assert.equal(createHash('sha256').update(bytes).digest('hex'), file.sha256, `Font bytes changed: ${file.path}`)
|
||||
}
|
||||
for (const notice of record.group.notices) {
|
||||
const bytes = fs.readFileSync(path.join(root, notice.source))
|
||||
assert.equal(createHash('sha256').update(bytes).digest('hex'), notice.sha256, `Font notice changed: ${notice.source}`)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user