publint-all.ts 940 B

12345678910111213141516171819202122
  1. import { execFileSync } from 'node:child_process'
  2. import { readdirSync } from 'node:fs'
  3. import { resolve } from 'node:path'
  4. // publint every harness package. Packages live at packages/<group>/<pkg>
  5. // (the group dirs — core/llm/bash/… — are pure containers); vendor/ is private
  6. // upstream code and examples/ are not packages, both out of scope. Derived
  7. // from the hierarchy so a new package needs no edit here.
  8. const root = resolve(import.meta.dirname, '..')
  9. const packagesRoot = resolve(root, 'packages')
  10. const packages = readdirSync(packagesRoot, { withFileTypes: true })
  11. .filter(group => group.isDirectory())
  12. .flatMap(group =>
  13. readdirSync(resolve(packagesRoot, group.name), { withFileTypes: true })
  14. .filter(pkg => pkg.isDirectory())
  15. .map(pkg => `packages/${group.name}/${pkg.name}`),
  16. )
  17. for (const path of packages) {
  18. execFileSync('node_modules/.bin/publint', [path], { cwd: root, stdio: 'inherit' })
  19. }