publint-all.ts 1.0 KB

1234567891011121314151617181920212223
  1. import { execFileSync } from 'node:child_process'
  2. import { existsSync, 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. .filter(pkg => existsSync(resolve(packagesRoot, group.name, pkg.name, 'package.json')))
  16. .map(pkg => `packages/${group.name}/${pkg.name}`),
  17. )
  18. for (const path of packages) {
  19. execFileSync('node_modules/.bin/publint', [path], { cwd: root, stdio: 'inherit' })
  20. }