Skip to content

Instantly share code, notes, and snippets.

@raygesualdo
Created October 30, 2025 17:28
Show Gist options
  • Select an option

  • Save raygesualdo/28849b6ce3768353e5f92267ef294fda to your computer and use it in GitHub Desktop.

Select an option

Save raygesualdo/28849b6ce3768353e5f92267ef294fda to your computer and use it in GitHub Desktop.
Using jscodeshift to extract information about a code base
import type { FileInfo, API, ASTNode } from 'jscodeshift'
export default function transformer(file: FileInfo, api: API) {
const j = api.jscodeshift
const root = j(file.source)
// Walk the AST, extract information about each file, and persist that information somewhere
return
}
pnpm jscodeshift --transform ./extract.mts --parser=tsx /path/to/files
# OR
npm run jscodeshift --transform ./extract.mts --parser=tsx /path/to/files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment