inductiveML/monarch-webgpu
1
1import {readFile} from 'node:fs/promises';2import {createHash} from 'node:crypto';3import {fileURLToPath} from 'node:url';4import {resolve} from 'node:path';5export const root=fileURLToPath(new URL('../',import.meta.url));6export async function verifySource(){7 const manifest=JSON.parse(await readFile(resolve(root,'src/monarch/source-manifest.json'),'utf8'));8 for(const item of manifest.files){const bytes=await readFile(resolve(root,'src/monarch/vendor/monarch',item.path));if(createHash('sha256').update(bytes).digest('hex')!==item.sha256)throw Error('Research source digest mismatch: '+item.path);}9 console.log(`Verified ${manifest.files.length} unchanged research source files.`);10}11if(process.argv[1]&&resolve(process.argv[1])===fileURLToPath(import.meta.url))await verifySource();12 