Created
October 30, 2025 17:28
-
-
Save raygesualdo/28849b6ce3768353e5f92267ef294fda to your computer and use it in GitHub Desktop.
Using jscodeshift to extract information about a code base
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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