okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
2b36e8a02
main
1import { test } from 'node:test' ; 2import assert from 'node:assert/strict' ; 3import { readFileSync , existsSync } from 'node:fs' ; 4import { resolve } from 'node:path' ; 5const root = resolve ( import . meta. dirname , '..' ); 6const repo = resolve ( root , '..' , '..' ); 7/* The app and the standalone server page (serve/web) each serve their own components.css. They are the same file: change both together. */ 8test ( 'serve/web/components.css is byte-identical to the app kit components.css' ,() => { 9const app = readFileSync ( resolve ( root , 'src/styles/kit/components.css' )); 10const web = readFileSync ( resolve ( repo , 'serve/web/components.css' )); 11assert . ok ( app . equals ( web ), 'src/styles/kit/components.css and serve/web/components.css differ; edit both with the same change' ); 12}); 13/* A package.json script that runs a file under scripts/ must point at a file that exists (the removed sync:kit pointed at a design folder that is not in the repository). */ 14test ( 'every npm script that runs a scripts/ file points at a file that exists' ,() => { 15const scripts = JSON . parse ( readFileSync ( resolve ( root , 'package.json' ), 'utf8' )). scripts ; 16for ( const [ name , command ] of Object . entries ( scripts )){ 17for ( const m of command . matchAll ( / \bnode\s + ( scripts\/ [ \w ./- ] + ) / g )) assert . ok ( existsSync ( resolve ( root , m [ 1 ])), `npm run ${ name } runs ${ m [ 1 ]} , which does not exist` ); 18} 19});