verify-package-invariants.ts 709 B

123456789101112131415161718192021
  1. /** Verify package-owned invariant source and publication rules. */
  2. import { resolve } from 'node:path'
  3. import {
  4. collectPackageInvariantViolations,
  5. formatPackageInvariantViolation,
  6. packageInvariantOwners,
  7. } from './package-invariants.ts'
  8. const root = resolve(import.meta.dirname, '..')
  9. const violations = collectPackageInvariantViolations(root)
  10. if (violations.length > 0) {
  11. console.error('verify-package-invariants: violations found:')
  12. for (const violation of violations) {
  13. console.error(` ${formatPackageInvariantViolation(root, violation)}`)
  14. }
  15. process.exit(1)
  16. }
  17. console.log(`verify-package-invariants: ${packageInvariantOwners(root).length} hand-owned package companion(s) conform.`)