openpencil/tools/package-quality/src/packages.ts
Danila Poyarkov 7f91594d0c refactor: standardize acronym casing
- Rename first-party API, RPC, JSON, CORS, SVG, JSX, and related identifiers to preserve acronym casing
- Keep upstream and serialized boundary names unchanged
- Add a lint guardrail and migration notes for exported APIs
2026-08-10 15:48:16 +03:00

27 lines
716 B
TypeScript

import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
interface RootPackageJSON {
workspaces?: string[]
}
interface WorkspacePackageJSON {
private?: boolean
}
const rootDir = fileURLToPath(new URL('../../..', import.meta.url))
function readJSON<T>(path: string): T {
return JSON.parse(readFileSync(path, 'utf8')) as T
}
const rootPackage = readJSON<RootPackageJSON>(join(rootDir, 'package.json'))
export const publicPackageDirs = (rootPackage.workspaces ?? []).filter((workspaceDir) => {
const workspacePackage = readJSON<WorkspacePackageJSON>(
join(rootDir, workspaceDir, 'package.json')
)
return workspacePackage.private !== true
})