1// @ts-check
2// Runs the JSDoc placement codemod used before snapshot and release builds.
3// The transformer keeps exported API docs attached to nested signature/type
4// nodes that can otherwise lose their leading comments during doc generation.
5import * as Glob from "glob"
6import * as Jscodeshift from "jscodeshift/src/Runner.js"
7import * as Path from "node:path"
8
9// Look up files in all workspace packages including those nested in
10// sub-packages (e.g. `packages/ai/openapi`).
11const pattern = "packages/{*,*/*}/src/**/*.ts"
12
13const paths = Glob.globSync(pattern, {
14 ignore: ["**/internal/**"]
15}).map((path) => Path.resolve(path))
16
17const transformer = Path.resolve("scripts/codemods/jsdoc.ts")
18
19Jscodeshift.run(transformer, paths, {
20 babel: true,
21 parser: "ts"
22})